Controlling Arduino from Node-RED with Firmware Firmata

In this opportunity we will use Node-RED to control an Arduino MEGA 2560 R3, thanks to the collaboration of a colleague Absolutely Automation  I indicated this method that allows to easily control an Arduino if complications.

Also in one of the comments does anyone consult if there is a more practical way to control from Arduino and Node-RED? I’ve decided to do a tutorial to take this solution into account.

In my case I have installed Node-RED on my pc with lubuntu, in other applications can be installed on a Raspberry pi, although you must take into account the speed and performance in case of very complex applications.

Lubuntu (Ubuntu/Debian)

In case of being a Windows user, I recommend installing Virtualbox and creating a virtual machine with Linux (Lubuntu) or Ubuntu or Debian.
Recommended Tutorial:

Install lubuntu (Ubuntu) from Scratch

 

If you start with a linux operating system in my case lubuntu

Tutorial Recommended How to install permanent Lubuntu (Ubuntu / Debian)

Full Migration to Lubuntu Operating System

 

Tutorial 2: Install Node-RED in linux

 

Installation Node red Platform

Basic Test: Controlling Arduino from Node-RED – Firmware Firmata

 





 

1 Install Nodes for Arduino

From Node-RED from the node palette we can directly install the Arduino nodes, and in the example we will copy the basic blink example in the arduino GPIO 13.

information package npm: node-red-node-arduino 

2 Upload Firmware Firmware from Arduino IDE

This code technically is a very fast protocol that directs the control of GPIO, ADC, PWM and handling of Strings through the serial port, there are several versions of the firmware but we will use StandardFirmata included in the sample libraries.

Materials





 

Conclusions and Considerations

A timely solution for simple applications that allow the blade to be connected directly to the PC.

The great disadvantage in general of the controls made from an external platform, without executing code properly on the board, is the safety or autonomy in case of disconnection in this case, disconnection of Node-RED, but guaranteeing a robust hardware should not be feared.

References

 

Leave a Reply