Introduction: Controlling Widgets Using Raspberry Pi

About: 4D Makers is a group of curious engineers and enthusiasts who finds great satisfaction in creating and building anything from electronics.

This demonstration features the uLCD-220RD-Pi, a display module pack for the Raspberry Pi. The uLCD-220RD-Pi is made up of a uLCD-220RD 1.38″ round TFT LCD display module, a 4D Serial Pi Adaptor, and a 5 way interface cable, for quick and easy connection to a Raspberry Pi.

In this demo the Raspberry Pi acts as a host which controls the uLCD-220RD. The uLCD-220RD was programmed with several widgets, which are then shown depending on the commands coming from the Raspberry Pi host.

This program is tested on Raspberry Pi 2 with Pixel image. It can also run on other Raspberry Pi variants. But, if you are using Raspberry Pi 3, make sure that you first visit this link:

https://www.raspberrypi.org/forums/viewtopic.php?... to configure the UART of Raspberry Pi 3.

This demo was tested on a Raspberry Pi 2 running Raspbian with PIXEL. It can also run on other Raspberry Pi variants. However, if you are using the Raspberry Pi 3, make sure to visit this link first to properly configure the UART port:

https://www.raspberrypi.org/forums/viewtopic.php?...

Step 1: Build

Components

  1. uLCD-220RD-Pi Module Pack
  2. uLCD-220RD-Pi
  3. 4D-Serial-Pi Adaptor
  4. 5-Way Cable
  5. uUSB-PA5 (programming adaptor for the display module)
  6. Workshop4 IDE (IDE for programming the display module; can be download from 4D Systems website)
  7. uSD Card
  8. Raspberry Pi 2 Model B loaded with the Raspbian + PIXEL image
  9. HDMI Cable
  10. Wifi Wi-Fi Dongle
  11. Power Supply for the Raspberry Pi

Step 2: Program

  1. Download the project here.
  2. Extract the attached zip file to a folder then open the ViSi-Genie project “demo1”.
  3. After opening the project file, go to the Project menu and make sure that the Comms Speed and Display parameters are correct as shown above.
  4. Now connect the uLCD-220RD to the uUSB-PA5, then the uUSB-PA5 to a USB port of your PC using a mini-USB cable.
  5. Now go to the Comms Menu and select the correct COM port for the uUSB-PA5, then click on the red button, as shown below.
  6. If the uLCD-220RD is properly connected to the PC, the red button should now turn blue and the name of the display module should be displayed.
  7. Download the Program to the uLCD-220RD
  8. At this point, mount the uSD card to the PC using a uSD card reader or adaptor. Go to the Home menu and click on the (Build) Copy/Load button, as shown below.
  9. The project should now start the build and compile process.
  10. Worshop4 will prompt for the correct drive for the uSD card. Select the appropriate drive from the drop-down menu.
  11. Workshop4 will then compile the source code and download the program to the flash memory of the uLCD-220RD.
  12. Now unmount the uSD card from the PC and mount it to the uSD card slot of the uLCD-220RD. A gauge widget should now appear on the uLCD-220RD. It is now ready to receive commands from a host.

Download the ViSi-Genie-RaspPi Library

  • The Raspberry Pi must now run a program which will communicate with the uLCD-220RD. The source code for the program is attached. To be able to compile the source code on the Raspberry Pi, you need to install first the ViSi-Genie-RaspPi-Library, which can be downloaded from this link:

https://github.com/4dsystems/ViSi-Genie-RaspPi-Lib...

Follow the instructions on how to install the library on that link.

Step 3: Connect the Raspberry Pi to the ULCD-220RD

Connect the 4D-Serial-Pi Adaptor to the Raspberry Pi, then connect the 5-way cable to the 4D-Serial-Pi Adaptor. Lastly, connect the other end of the 5-way cable to the uLCD-220RD. The final setup is shown in the picture above.

Step 4: Setup the Raspberry Pi Host

After installing the library and connecting the hardware, you can now compile the source code and run the program on the Raspberry Pi. Follow the procedure below.

  1. After Downloading the file, open the terminal and go to the folder which contains this file: ViSi-Genie-RaspPi-Demo-220RD
  2. Unzip the file using this command:
    pi@raspberry: ~ $ sudo unzip ViSi-Genie-RaspPi-Demo-220RD.zip
  3. Navigate to the folder where the contents of “ViSi-Genie-RaspPi-Demo-220RD.zip” were extracted to. pi@raspberry: ~ $ cd ViSi-Genie-RaspPi-Demo-220RD
  4. In LX Terminal type the command to compile :
    pi@raspberry: ~$ sudo make
  5. Run the program using this command:
    pi@raspberry: ~$ ./demo_220RD

The uLCD-220RD should now start displaying the different widgets, according to the serial commands received from the Raspberry Pi host.

For more information, see the application note:
ViSi-Genie Connecting a 4D Display to the Raspberry Pi