Introduction: Manual LCD Scroll Control

A 16 Character RGB LCD can be a godsend for printing out things easily in your project, but it is only 16 characters. Buttons can be one way of getting through each different element in a list, but if your list is rather long, then you could be asking your user to press the button for a very long time.

Instead, we'll use a handy Angle Encoder to easily scroll through a large list element and select it which one we want. This project will let us print large lists of items to our LCD and scroll up and down through them easily, without having to use a button!

Step 1: Supplies

For this project, we'll make pretty extensive use of Grove equipment, specifically the Arduino Grove Starter Kit. This kit includes a Arduino Grove base shield, Angle Encoder, and button and LCD screen! Everything we need!

  • LinkIT ONE board
  • Arduino Grove Base Shield
  • Grove Angle Encoder
  • Grove Button
  • Grove RGB LCD

Step 2: Hooking Up Your Grove Sensors

Since we're working with Grove accessories, hooking up all of your sensors couldn't be easier! The Arduino Grove Base Shield aligns perfectly with the LinkIT ONE since they have the same pin layout. Hold your base shield over the LinkIT ONE, align the pins, and gently press down. Sometimes there can be a bit of resistance, so as long as all your pins are pushed in, go ahead and give it a nice firm press.

Next, let's get all of our grove sensors hooked up.

Plug the Button into D2

Plug the RGB LCD into an I2C Slot

Plug the Angle Encoder into A0


If you're confused at all, don't worry. Just follow the diagram above and mimic it best you can.

Step 3: Using the Potentiometer

A rotary angle sensor detects what angle our know is at. We have a range of about 0-300, and we will keep reading what the angle is.

Let's look over a function we will use to get the degree of the angle sensor:

/************************************************************************/<br>/*Function: Get the angle between the mark and the starting position	*/
/*Parameter:-void														*/
/*Return:	-int,the range of degrees is 0~300							*/
int getDegree()
{
	int sensor_value = analogRead(ROTARY_ANGLE_SENSOR);
	float voltage;
	voltage = (float)sensor_value*ADC_REF/1023;
	float degrees = (voltage*FULL_ANGLE)/GROVE_VCC;
	return degrees;
}

Notice how we do an analogRead on the sensor, then perform some basic computations to give us the degrees.

If you would like to read up more, check out Grove's Wiki page on the rotary angle sensor, or other resources around the web.

Step 4: Using the Potentiometer to Scroll Text on the LCD

Now let's put in the real code. In the previous step, we discovered how to read the angle from our angle sensor. Now, we'll implement some logic to actually do something with that angle.

In layman's terms, we're going to read the angle on our sensor over and over. We'll calculate exactly how long are list is and take 300/(size of list) to give us our different intervals. For example, say we had 10 items in our list: we would want our LCD to scroll to the next element for every 30 degrees it moves, that way it is spread out easily.

Then, I attached the button Grove sensor (this part is kind of optional) to use as a selector. So now you can scroll through your list, then when you see the item you want, you can just hit the button to select it!

Download the code file attached and deploy it to your LinkIT ONE. This will enable you to scroll though lists on your LCD with ease!

Step 5: Scrolling Into the Future...

Boom. You did it! What a pro! Now you have a great project that can scroll through multiple things. Store your grocery list, store all the rooms in your house, store whatever you please! The possibilities are endless! We've created an excellent navigation menu with our simple Grove kit that can enable thousands of different projects going forward. Happy Tinkering!