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
  • 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 2604 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…
  • kidiccurus
    kidiccurus over 11 years ago in reply to fustini

    Would it be possible just to use a resistor in place of a pot, to use up some old parts.

    P.S. video games beat football every time.

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

    Hi - the Python script I wrote doesn't currently: https://github.com/pdp7/tweetypi/blob/master/display-hashtag.py   But you could definitely change the behavior of the while loop that starts at line 18.

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

    I'm interested in building this project.  Does the display-hashtag command support multiple hashtags or can you only follow one at a time?  Thanks.

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

    I can confirm that the library you are using does not utilize bidirectional communication. It only requires the enable, register select, and 4 data lines to be connected to the Pi's GPIO so you are completely safe as long as LCD pin 5 is held low and not left floating. One would just need to be very careful here when building this circuit It is somewhat hard to tell but it does appear that LCD pin 5 is indeed connected to ground in your picture.

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

    I'm using the Adafruit_CharLCD library and I believe it does handle this properly.  In practice, I never had any problems.

    • 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 © 2025 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