LCD Displaying system temperature    LCD Displaying torrent status

I previously had posted on how to communicate with an Arduino and display messages on an LCD using python. And I’ve been working on Raspberry Pi as well, setting it as a torrent box.

So I thought of hooking up these two together so that the LCD can display the torrent status. I also added two buttons so that I can scroll through the list of torrents. The Arduino is connected to the RPi via the USB, and the Arduino is powered by an external AV adapter. Initially I thought this will be unsafe, but apparently it is safe to do so (,22132.0.html, The LCD also displays the current system temperature.

The source code the the python program and the Arduino can be accessed at:

Other Resources:

I’ve got an Arduino UNO board, and a Hitachi HD44780 type LCD. I wanted to write a python program to communicate with the Arduino board. The board can be connected to the computer via USB, and it appears as a COM port. Therefore we can easily communicate with the Arduino serial interface with python.

My aim is to create a python program that takes the input from the keyboard and display on the LCD. The LCD is connected to the Arduino board as mentioned in the Arduino example:

Circuit Diagram

The following is the code for the Arduino:

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  lcd.begin(16, 2);

void loop() {
  if (Serial.available()) {
    delay(100);  //wait some time for the data to fully be read
    while (Serial.available() > 0) {
      char c =;

To access the serial ports you need to set up the pySerial module for python. The Python code:

import serial
import time

s = serial.Serial(11, 9600) #port is 11 (for COM12), and baud rate is 9600
time.sleep(2)    #wait for the Serial to initialize
while True:
    str = raw_input('Enter text: ')
    str = str.strip()
    if str == 'exit' :

I’m on a windows machine, and by default the Arduino is connected to COM12. Note that we need to wait for a little while after initializing the serial connection.

Arduino Board and the LCD Ready for input

Arduino Board and the LCD Ready for input

Arduino Board and the LCD, Python message is displayed

Arduino Board and the LCD, Python message is displayed

Python Console

Python Console