element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Blog Display tweets on a character LCD
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
GPIO Pinout
Raspberry Pi Wishlist
Comparison Chart
Quiz
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: fustini
  • Date Created: 26 Nov 2012 10:25 AM Date Created
  • Views 2786 views
  • Likes 1 like
  • Comments 10 comments
Related
Recommended
  • rpiintermediate
  • raspberry_pi
  • twitter
  • rpi
  • adafruit

Display tweets on a character LCD

fustini
fustini
26 Nov 2012
imageWant to build this project?
View Parts

 

image

I followed Adafruit's great Drive a 16x2 LCD with the Raspberry Pi tutorial using:

  • 16x2 character LCD
  • Adafruit Pi Cobbler
  • breadboard
  • potentiometer

 

However, wallarug identified a problem with the Adafruit_CharLCD library for the Rev 2.0 Pi as GPIO 21 and 27 have changed.  It turned out the simplest fix is to switch the pin numbering scheme to that of the physical header rather than the Broadcom SoC.  Until Adafruit accepts my pull request, I'd recommend using Adafruit_CharLCD from my repository if you have a Rev 2.0 Pi.

 

After sorting that out, I wrote a Python script to display tweets for a given hashtag (display-hashtag.py) which can be found in my tweetypi GitHub repo.  I use Python Twitter Tools by Mike Verdone to search Twitter.

 

Follow these instructions to install the hashtag display:

pi@raspberrypi ~ $ sudo pip install twitter

 

pi@raspberrypi ~ $ mkdir python

 

pi@raspberrypi ~ $ cd python

 

pi@raspberrypi ~/python $ git clone https://github.com/pdp7/Adafruit-Raspberry-Pi-Python-Code.git

Cloning into 'Adafruit-Raspberry-Pi-Python-Code'...

remote: Counting objects: 185, done.

remote: Compressing objects: 100% (117/117), done.

remote: Total 185 (delta 83), reused 158 (delta 56)

Receiving objects: 100% (185/185), 55.25 KiB, done.

Resolving deltas: 100% (83/83), done.

 

pi@raspberrypi ~/python $ git clone https://github.com/pdp7/tweetypi.git

Cloning into 'tweetypi'...

remote: Counting objects: 13, done.

remote: Compressing objects: 100% (10/10), done.

remote: Total 13 (delta 2), reused 8 (delta 2)

Unpacking objects: 100% (13/13), done.

 

pi@raspberrypi ~/python $ cd tweetypi

The only required argument for display-hashtag is the hashtag. The usual '#' hashtag prefix should be omitted from the argument as it is added by the Python code. The defaults assume 16x2 char LCD:

sudo ./display-hashtag bears

Here's a video clip of it running:

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

The HashTagDisplay class supports character LCD from 16x1 up to 20x4.  Here would be the arguments for 20x4 LCD:

sudo ./display-hashtag --verbose --cols 20 --rows 4 --delay 3 bears

 

image

Video clip of 20x4 display:

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

Cheers,

Drew

 

 

element14
Product Name*DescriptionBuy All Parts
Raspberry Pi Model B with SD Card Raspberry Pi model B and 8GB SD Card with NOOBS preinstalled
Optical Mouse Basic USB optical mouse
Raspberry Pi Power Supply 120-240v to 5V power supply with micro USB connector
Keyboard Basic USB keyboard
16x2 character LCD 16x2 character monochrome LCD
10k trimmer potentiometer 10k ohm, single turn trimmer potentiometer
Adafruit Pi Cobbler GPIO breakout kit for Raspberry Pi
Breadboard Basic breadboard with 830 connection points
Jumper wire bundle Jumper wires for use on breadboard

 

*Products and resources listed are listed to help members build their own Pi Projects. They are suggestions and listed for educational purposes. For substitutions of any parts, please post a question asking the original author.
  • Sign in to reply

Top Comments

  • fustini
    fustini over 12 years ago in reply to Former Member +1
    Hi - yeah, the 5V LCD and the 3.3V I/O Pi seemed strange at first, but as the Adafruit tutorial explained, the Pi pins are only output mode to the LCD. 3.3V is ok for a High with 5V LCD. There is no 5V…
  • Former Member
    Former Member over 12 years ago

    I have not looked at your code in detail, is there ever an instance where pin 5 on the LCD could be pulled high? This is where I would be concerned. I agree that you would be 100% safe as long as LCD pin 5 was never pulled high (this changes the data direction).

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • fustini
    fustini over 12 years ago in reply to Former Member

    Hi - yeah, the 5V LCD and the 3.3V I/O Pi seemed strange at first, but as the Adafruit tutorial explained, the Pi pins are only output mode to the LCD.  3.3V is ok for a High with 5V LCD.  There is no 5V coming back to the Pi pins from the LCD.  I suppose there is the potential for a problem if one makes a wiring mistake.  A logic level converter would be the safest way but does add cost and complexity.

     

    I think you are right regarding the pot.  Adafruit includes 10k pot I see with their LCDs.  I think I was having trouble finding something bigger than 1k from Newark that had a knob on it.

     

    P.S. how depressing to revisit this post where my LCD displays the Bears record of 8-3, before they promptley fell off a cliff.  oy, someday I'm going to give up on football and save myself the time, money, and frustation image

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 12 years ago

    I have noticed that you have specified a 1k potentiometer in your parts list. However, upon reading the datasheet for the LCD, a 10k to 20k pot is recommended. Just thought I would make you aware of this. Also, have you ever had any issues when reading from the LCD since the LCD you have specified uses 5V logic levels and the GPIO pins on the Pi are not 5v tolerant?

     

    Nash Kaminski

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • fustini
    fustini over 13 years ago in reply to Former Member

    Hi, I can't seem to replicate that even with a new user on my linux system (so it wouldn't have anything auth settings cached): 

     

    gittest@lappy486:~$ git clone https://github.com/pdp7/tweetypi.git

    Cloning into 'tweetypi'...

    remote: Counting objects: 100, done.

    remote: Compressing objects: 100% (78/78), done.

    remote: Total 100 (delta 54), reused 48 (delta 16)

    Receiving objects: 100% (100/100), 18.47 KiB, done.

    Resolving deltas: 100% (54/54), done

     

    You could try the git protocol instead of http with this command:  

     

    git clone git://github.com/pdp7/tweetypi.git 

     

    It's read only so I wouldn't imagine there would be a un/pw needed.  You can also download the files as a zip with:  https://github.com/pdp7/tweetypi/archive/master.zip

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 13 years ago

    Hi Drew,

    It's asking me for a user/password when I :

    git clone https://github.com/pdp7/tweetypi.git

    What am I doing wrong or ??

     

    Ta Neil

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
<
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube