Raspberry Pi Stock Ticker With Surplus Store LCD

In this Instructable, I create a scrolling stock ticker with the Raspberry Pi.

I found an LCD in the surplus store that didn't have much information, but after some searching and playing around, saw that it was based of the popular HD44780U. This is a 16 character LCD, and looks like 16x1 unit


However, it seems to function as an 8x2 (display is like 1234567812345678).

I used Adafruit's tutorial to set it up - see http://learn.adafruit.com/drive-a-16x2-lcd-directly-with-a-raspberry-pi/overview for more information - I'll not repeat how to set up the circuit here. The main difference is that this LCD has only 15 leads, not 16, and the last 15th lead is for a non-existent backlit display. Ignore the 16th lead in Adafruit's setup.

I also used Adafruit's python library for character LCD displays - Adafruit_CharLCD.py - however, I had to make a few important modifications for my needs. First of all, I made some changes for it to support the 8x2 display (to automatically scroll over to the 2nd line when the first 8 characters have been filled up).

I also modified it to support any arbitrary length string, by displaying 16 (8x2) characters at a time, and then going to the next 16, and so on, until the end.

I also added another method to support scrolling text. With a simple call, the LCD will do a marquee type scrolling of the text. The caller can provide it any arbitrary length string without worrying about scrolling details. I tried to search for any existing work doing this already, but could not, so hopefully this will help others looking for something similar.

Now that I have scrolling text supported on the 8x2 LCD using Raspberry Pi, the next step is to get stock data (I used yahoo for the data).

I used the pycurl library to invoke yahoo's api and get the results - thanks to http://www.gummy-stuff.org/Yahoo-data.htm for the pointers in the right direction.

To install pycurl on your raspberry pi distribution, do the following:

sudo apt-get install python-pycurl

The url for getting stock data is http://download.finance.yahoo.com/d/quotes.csv?s=^IXIC&f=sghn (see the above site for what kind of fields you would like to retrieve) s = stock symbol, g = Day's Low, h = Day's high, n = stock name (it is recommended to have the name as the last field, as names can sometimes have quotes ", which can throw off your parsing of the fields).

I've attached the source code for stockTicker.py - as you can see, it is quite straightforward, and the call to the lcd is simple.

I've also attached my modifications to Adafruit_CharLCD.py - replace that in your environment with this file (first back that up, by copying it to Adafruit_CharLCD.py.bak (that's the convention I use)).

PS - Can't seem to upload the video to Instructables - I uploaded it to YouTube instead - here's the link - http://www.youtube.com/watch?v=0xPcbMepSuk

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Be the First to Share


    • Instrument Contest

      Instrument Contest
    • Make it Glow Contest

      Make it Glow Contest
    • STEM Contest

      STEM Contest

    5 Discussions


    3 years ago

    Thanks for this tutorial. i got a similar display (from an old Printer)- but sometimes some charakters are disturbed or missing, i think my display needs more time to react. And I want to display my IP, i tried to change the Adafruit-Script (Time + IP) for the 16x2 Display but I failed - here to say i have never did any Python programmings at all. Maybe you can help me.

    Thanks and greetings from Germany,



    5 years ago on Introduction

    hi. can you please send me the the python codes you used in your marquee? if you can. please send it in this email. inreambonanza@gmail.com. thank you so much!

    1 reply

    5 years ago on Introduction

    I don't know how long ago you posted this project. Can you share the store where you found the display? I'm always looking for good places to buy new stuff for my RPi. Thanks!

    1 reply


    I posted this in May. I got the display from HSC Electronics (http://www.halted.com) in Santa Clara. It is a very nice store with lots of eclectic surplus stuff! Happy hunting! :-)