Arduino Character to Node-RED Graphics - Easy

Arduino Character to Node-RED Graphics - Easy

Arduino programmers habitually utilize serial print for diagnostics; format that serial stream to spoof JSON and send on to Node-RED.

  • 1,157 views
  • 0 comments
  • 15 respects

Components and supplies

Apps and online services

5375661 civlawqa6s
Node-RED
https://nodered.org/

About this project

Long ago

I wrote some Arduino code for a friend with an experimental airplane; he wanted to have digital instruments using OLED high contrast displays rather than the common analog meters. The sketch consisted essentially of reading an analog port, manipulate the 10-bit value, and display that information on the OLED character display.

Recently

With the advancing years, micro-everything has gotten considerably more powerful and the world expects to see fancy graphics: even simple projects such as a thermometer or humidity. Maybe it is all overkill from the IoT devices all around us, but refreshing old Arduino projects to drive graphic displays can be complex and time-consuming and the cost of graphic displays are still many times the price of the straight forward character displays.

Not every project

Can use the technique that I show here, but many can. The idea is to keep the character-based Arduino sketch roughly the same but send the character information out the serial port: you may already be doing this as part of the original project diagnostic output. The trick is to add some simple formatting to the serial print stream and mock a JSON formatted stream; the output can be sent by TTL serial, BlueTooth, LoRa, or any other transport method to a device running the free Node-RED software: https://nodered.org/

For my specific project, I am using a Raspberry Pi 3B, but one can also run Node-RED on Android, Linux, Windows... or even choose to use one of the cloud hosting environments (discussed in the link above) and move your project into IoT land.

Arduino side

Taking an existing project that uses character-based (or graphic) display, what is needed is to send the data being displayed to a serial port in a special format. The format must start with

Serial.print("{

and the data-name token must exist similar to

"Gas_Lvl\":");

and then the actual numeric value as a character string (default print style)

Serial.print(temp);

and the next necessary separator

Serial.print(",");

Let's view this as I would write it in a sketch

Serial.print("{\"Gas_Lvl\":"); Serial.print(temp); Serial.print(",");

The above name token and variable value and separator can be repeated as often as necessary for other data.

The last data name-token and variable value and terminating character for the faux-JSON string may look like

Serial.print("\"Current\":"); Serial.print(temp);  Serial.println("}");

The Node-RED server and graphic side

I am not going to bore you with any Node-RED installation and configuration information: the internet is full of this material, repeated many times. Select the installation for your hosting system: Windows, Linux, Raspberry Pi. The server and client side User Graphic Web-interface can be run on one platform or separated on two platforms; perhaps the server on a Raspberry Pi and the GUI on an Android tablet or cellphone. Many choices are available to suit your specific needs.

The Arduino serial stream (faux-JSON) must be provided in some manner to the Node-RED server as input; the simplest being a serial TTL connection.

The server serial connection has a property sheet which needs to be completed to match the Arduino serial parameters, in the example above. Other transport methodologies will require connector properties matching the specific hardware used.

A full Node-RED project does not have to utilize all of the JSON elements, a sub-set will work adequately

Property sheet - samples

Results

Summary

Upgrading an old character-based Arduino project to a modern Graphical User Interface or potentially move to an IoT deployment could not be easier! Of course, there are other methods and tools, but few are free.

Please continue your reading here to learn more about Node-RED.

I hope you have fun with your new tool. An overview PDF of the Arduino Engine Monitor in PDF is attached for anyone curious.

Ray

Code

Arduino Engine MonitorArduino
Overview document PDF
No preview (download only).

Schematics

europa-nodered-test_Pfv2yi0WSw.txt

Comments

Similar projects you might like

Interfacing Arduino With Node-RED

by Gokul Periyasamy

  • 24,247 views
  • 1 comment
  • 17 respects

Interfacing Arduino MKR or ESP via MQTT - Node-RED 101

Project in progress by Officine Innesto

  • 4,760 views
  • 3 comments
  • 8 respects

Arduino + Raspberry Pi + Ubidots Made Easy

Project tutorial by David Escobar

  • 15,087 views
  • 4 comments
  • 43 respects

Graphics Test ILI9341 TFT LCD SPI Display

by TechArea

  • 5,384 views
  • 1 comment
  • 7 respects
Add projectSign up / Login