Arduino Projects with an LCD (Using Sparkfun RedBoard)

Updated 16 May 2018

Arduino Projects with an LCD (Using Sparkfun RedBoard)

Welcome to Project Set 4 in the Sparkfun Inventors Kit Guide! In this tutorial, we will look into using Liquid Crystal Displays (LCD's) to print data. This ability allows us to remotely set up an Arduino and display component data (such as temperature, humidity, barometric pressure) without needing a connection to a computer or COM Port. We will demonstrate this idea by coupling the LCD with the TMP36 Temperature Sensor provided in the Sparkfun Inventors Kit Ver4.0 in Circuit 4B and by making a portable, interactive game on the LCD for Circuit 4C. 

A Brief Description of LCD's

A Liquid Crystal Display is a multi-pin component that uses liquid crystals and polarised light to light up a display. The LCD included in the Sparkfun Inventors Kit has a character matrix of 16 x 2 with each character space being 5 x 8 pixels in size. The pixels are what we will control to be on or off to display a character (data) in the character matrix. If you're interested in learning about how an LCD works, we have a great tutorial which covers the Pinouts of an LCD, as well as how to read and write to it. The 'Pinout diagram' for the LCD can be found below and in your Sparkfun Guide; it will be your best friend through this Project Set. 


The LCD has 16 Pins total. Pins 1-6 and Pins 11-16 will be used in this project set to supply power, control the backlight and contrast and to write data to.

Circuit 4A

Welcome to your first LCD project! This Circuit will introduce you to the LiquidCrystal library, it's relevant objects and methods as well as how to electrically connect the LCD to the RedBoard using the breadboard. We will be printing "Hello World!" to the LCD screen and will hence need to know how to create an LCD object, initialise the LCD, clear it, set the cursor and write to it! Don't worry, we'll step through it together. 

Firstly, we need to include the library header file. This is done using the '#include' statement shown below. Creating the LCD object is similar to how we created an object for the Servo Motor in Project Set 3. From the object we will use the begin() method to specify the LCDs size and to initialise it. To make sure that the LCD is fresh and ready for us to write to, we use the clear() method which flushes all pixels to their 'off' state. The setCursor() method tells the LCD which position in the character matrix we want to start writing data to. Finally, the print() method prints it's argument to the LCD, this means that we can print variables and strings (a set of characters) to the display directly!


Important notes:

  • Disconnect the RedBoard from the computer before connecting anything to the Power Bus
  • Make sure that the LCD is connected correctly (Pins 7-10 aren't used)
  • Ensure +5V isn’t connected straight to GND through the power rail or otherwise

Circuit 4B

This Circuit will introduce a new analog component, a temperature sensor! A temperature sensor has an internal structure that outputs a voltage to a pin relative to the ambient temperature of the room. While we don't need to know the specifics of how this device works, we do need to know how to turn the output voltage into a useable temperature reading. Algorithms are what we will be using to make this voltage-temperature conversion. The first algorithm to read the actual voltage at the pin, 0V - 5V and not 0 - 1023, the second algorithm to convert this actual voltage to a temperature in °C. The algorithm to do this second transformation is found from the properties of the TMP36 Sensor. The two algorithms are displayed below.


The polarity of the TMP36 is quite important to consider when connecting it as, if connected incorrectly, the sensor will heat up very quickly and will do so to temperatures that will burn us! Its Pinout is shown below with the flat-face of the component head facing us.


Important notes:

  • Disconnect the RedBoard from the computer before connecting anything to the Power Bus
  • Make sure that the LCD is connected correctly (Pins 7-10 aren't used)
  • Make sure that the TMP36 is connected the correct way to avoid it heating up
  • Ensure +5V isn’t connected straight to GND through the power rail or otherwise

Circuit 4C

This Circuit will finish off Project Set 4 and will incorporate the use of the DC Barrel Jack connection for the first time! This means that, after the program is successfully uploaded to the board, this Circuit will become portable and playable with no computer connection needed! Circuit 4C will also introduce pointers to your programming toolkit which are useful for saving data and time when performing lots of computations with arrays or structures. A pointer is an object which has the capacity to 'point' to another value stored in program memory, that is, it stores the location of the 'pointed-to' variable, not the value of the variable itself. Another concept covered in this Circuit is that of debouncing. When a button is pressed, the physical connection can sometimes bounce between connected and disconnected creating multiple presses. To stop this from occurring, a method known as debouncing is used so that the RedBoard only reads one press of the button at a time. 

Important notes:

  • Disconnect the RedBoard from the computer and Barrel Jack supply before connecting anything to the Power Bus
  • Make sure that the LCD is connected correctly (Pins 7-10 aren't used)
  • Ensure +5V isn't connected straight to GND through the power rail, Push-Button or otherwise

Well done! Only one more Project Set to go! The Final Project Set involves the use of motors and wheels to make an autonomous robotic car! If you would like to see projects involving Motion you can visit Project Set 3.

Have a question? Ask the Author of this guide today!

Please enter minimum 20 characters

Your comment will be posted (automatically) on our Support Forum which is publicly accessible. Don't enter private information, such as your phone number.

Expect a quick reply during business hours, many of us check-in over the weekend as well.



Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.