1

I am working on a simplest project of driving LCD display with raw GPIO pins without the use of any I2C interface. The Tutorial I followed is given in the link below. https://www.youtube.com/watch?v=cVdSc8VYVBM

I have a Rpi model B+ and a 16x2 LCD module.

The pin connections are exactly the same as described in the video. The code is given here : http://pastebin.com/bYM1DtpF

I am accessing Rpi with ssh. Whenever I try to run the program it gives these strings of warning messages.

pi@raspberrypi ~/lcd $ sudo python lcd.py

lcd.py:98: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
  GPIO.setup(LCD_E, GPIO.OUT)  # E
lcd.py:99: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
  GPIO.setup(LCD_RS, GPIO.OUT) # RS
lcd.py:100: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
  GPIO.setup(LCD_D4, GPIO.OUT) # DB4
lcd.py:101: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
  GPIO.setup(LCD_D5, GPIO.OUT) # DB5
lcd.py:102: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
  GPIO.setup(LCD_D6, GPIO.OUT) # DB6
lcd.py:103: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
  GPIO.setup(LCD_D7, GPIO.OUT) # DB7
lcd.py:104: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
  GPIO.setup(LED_ON, GPIO.OUT) # Backlight enable

But nothing happens except only the upper row of the LCD is glowing. No messages appear on the display. Is there anything wrong with the code or anything wrong with how I run the program?

3

Try adding

GPIO.cleanup()

to the end of your code. This will ensure that the GPIOs are reset when you exit the program. That way when you re-initialize them, you won't get that error anymore.

As far as the display goes, make sure to adjust the contrast of the LCD before trying to use it. If you have a variable resistor controlling the contrast, turn it up until you can see rectangles lit up for where every character should be displayed. Then, turn the contrast down just below that level.

There are also some good libraries for controlling the LCD, I use RPLCD on my RPi model 2 B, and it doesn't need the I2C pins. Not sure if there is anything different between the two models for this library

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.