Facebook Pixel

AN-00187 ViSi Simple Raspberry Pi Core Temperature Monitor

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
Supported Environment ViSi
Difficulty Medium

 

File Downloads
Files

Description

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.

 

Application Overview

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.

Setup Procedure

Setup WiringPi on Raspberry Pi

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.

ViSi Setting Up the Raspberry Pi for ViSi Projects

Raspberry Pi – 4D Systems Intelligent Setup Test

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.

ViSi Setting Up the Raspberry Pi for ViSi Projects

 

Create a New Project

For instructions on how to create a new Designer project, please refer to the section “Create a New Project” of the application note

Designer Getting Started - First Project

For instructions on how to create a new ViSi project, please refer to the section “Create a New Project” of the application note.

ViSi Getting Started - First Project for Picaso and Diablo16

 

 

Design of the Project

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.

ViSi coreMon  Project

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.

Includes section

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.

Initializing the micro-SD Card

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’.

Serial information monitor

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.

Custom RS-485 Communication Protocol

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.

 

Raspberry Pi Core Monitor

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.

Building the C Project from terminal

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 Raspberry Pi to 4D Systems Intelligent Display

Connect the pins of the Raspberry Pi and 4D Systems Intelligent Display Module following the connection guide below.

Run the ViSi Based Program

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

ViSi Getting Started - First Project for Picaso and Diablo16

 

Share: