|Description||This application note demonstrates how to display the Raspberry Pi core temperature into a Workshop IDE-ViSi based project. The core temperature is retrieved using system calls and then sent via UART to the display module. This application note is limited to retrieving the core temperature to simplify the demonstration.|
|Supported Processor||PICASO, DIABLO16|
UART/Serial communication with Raspberry Pi is one way to transport information from-and-to a Raspberry Pi and an external device. This application note demonstrates how to use the 4D Systems Intelligent display to show the core temperature.
Before getting started, the following are required:
- The target module can be a PICASO or a DIABLO16 display
Visit www.4dsystems.com.au/products to see the latest display module products that use the Diablo16 processor.
- 4D Programming Cable or µUSB-PA5
- micro-SD (µSD) memory card
- Workshop 4 IDE (installed according to the installation document)
- When downloading an application note, a list of recommended application notes is shown. It is assumed that the user has read or has a working knowledge of the topics presented in these recommended application notes.
- Raspberry Pi module
Raspberry Pi is a credit-card sized single board computer that is capable of running a several Linux distribution images. The Linux images running on the Raspberry Pi is a stand-alone operating system that is capable of allowing internal processing and communication with external devices.
This application note demonstrates how to display the Raspberry Pi core temperature into a Workshop IDE-ViSi based project. The core temperature is retrieved using system calls and then sent via UART to the display module. This application note is limited to retrieving the core temperature to simplify the demonstration.
The procedure included in this section is referenced from the official WiringPi Download and Install procedure. The content of this section intends to consolidates setup procedures necessary to establish serial communication between Raspberry Pi and 4D Systems intelligent displays using the aforementioned library.
After setup of the Raspberry Pi is made, it is necessary to test the functionality of the inter-connectivity. To test the UART communication please refer to the link below.
For instructions on how to create a new Designer project, please refer to the section “Create a New Project” of the application note
For instructions on how to create a new ViSi project, please refer to the section “Create a New Project” of the application note.
The demo project uses two types of widgets that are available in the Workshop IDE, namely - text labels and LED digit object. The LED digit will be used to display the core temperature.
The LED digit’s properties can be changed to display only whole numbers. For this application note, the temperature of Raspberry Pi will be displayed only up to the first decimal point.
**Any changes in the placement of the LED Digits should reflect on the project code. Failure to update the placement position of the LED digits will result to object being shown at the wrong position.
This project uses the com0 UART port of the 4D Systems intelligent display module. The following set of statement shows the content of the project ‘coreMon’. The project was made to be used with this application note for demonstration purposes.
Workshop IDE-ViSi environment have statements that are automatically loaded when starting a project. The last line was manually included. The LEDDIGITSDISPLAY.inc was included to support the LED digits object. Without the include file, errors will be experienced during build of the project.
Projects that make use of images and graphics will require a micro-SD for storage. The following set of statements initializes the micro-SD and load the images into a variable ‘handl’.
Receiving the information sent from the Raspberry Pi is fairly easy. The following set of statements constantly monitors and retrieves valid information from COM0 using the serin() function .
Each time the function finish executing the resulting value read is saved in a variable ‘m’. Whenever the result of serin() is invalid, a value’ -1’ is received on variable m. Knowing the value of invalid results, we can now filter the incoming serial information.
A user defined serial communication protocol is used in this application note. The following defines the protocol utilized.
For additional information on how create a user defined communication protocol for other application and use. Please refer to the following application note.
The content of the application note is not limited to rs-485 networks. The information on data packet generation is included with brief explanations for use and generation.
In this section a simplified explanation on retrieving core information is presented. C programs in Raspberry Pi are fairly easy to create, build and run.
To build the c-project coreMon, use the command below. The command is in using the wiringPi format. After building the c-project, change the resulting coreMon project output file permission. To do this, use the commands below.
/home/pi$ gcc coreMon.c -o coreMon -O3 -Wall -I/usr/local/include -Winline -pipe -L/usr/local/lib -lwiringPi -lwiringPiDev -lpthread -lm
/home/pi$ sudo chmod +x coreMon
Finally, to run the project, use the command below.
/home/pi$ sudo ./coreMon
After successfully, building and compiling the simple program the image below will be seen on the raspberry monitor.
Connect the pins of the Raspberry Pi and 4D Systems Intelligent Display Module following the connection guide below.
For instructions on how to save a ViSi project, how to connect the target display to the PC, how to select the program destination, and how to compile and download a program, please refer to the section “Run the Program” of the application note