Como recibir datos de un sensor de arduino y mostarlos en node-red

Ayuda necesito mostrar datos numercos de un poenciometro en node red

(translation)

How to receive data from an arduino sensor and show them in node-red

Help I need to show numeric data of a poenciometro in node network

What platform are you running node red on?
What version of NR and node?
Have you looked at sending the data via MQTT?
¿En qué plataforma está ejecutando el nodo rojo?
¿Qué versión de NR y nodo?
¿Has considerado enviar los datos a través de MQTT?

la verdad no tengo idea de eso solo continuo de un proyecto de un amigo, y el arduino en una palabra y este recibe datas, pero ahora necesito que aprezca datos analogicos de n portenciometro en nodered

(translation)
the truth I have no idea of that only continuous of a project of a friend, and the arduino in a word and this receives data, but now I need you to appreciate analog data of n portenciometro in nodered

Without knowing that information, my suggestion would be to use MQTT to send the data from the arduino to what ever platform node-red is running on.
Sin conocer esa informaciĂłn, mi sugerencia serĂ­a usar MQTT para enviar los datos desde el Arduino a cualquier plataforma en la que se ejecute node-red.

If the arduino is already printing out data to the serial port then just use a serial in node to read the data directly into Node-RED via a local serial port.

Martin no se si se puede hablar algo que no se ingles por aqui pero bueno… lo más sencillo que flashees el standardfrimdata en la placa de arduino y la dejes conectada a la raspberry por usb, en node red has de instalar el módulo de arduino desde la paleta y entonces directamente puedes leer las entradas de la placa o escribir salidas, para empezar echale un ojo a https://nodered.org/docs/hardware/arduino

Un saludo

I’m doing exactly the same things right now !
The Arduino sends data on serial other USB (I use arduino’s Serial.print() function in the arduino side.
Let say your potentiometer is on A0, the code on arduino should look like this

void setup(){
Serial.begin(9600);
pinMode (A0, INPUT);
}
void loop(){
int var = analogRead(A0) ;
Serial.print(var);
delay(500);
}

The code in node-red should look something like this :

[{"id":"a1c90746.59bee8","type":"debug","z":"e85c43df.7ea198","name":"","active":true,"console":"true","complete":"payload","x":482.5,"y":109,"wires":[]},{"id":"8797ffc8.4ebaa8","type":"serial in","z":"e85c43df.7ea198","name":"","serial":"9939954d.414a","x":146.5,"y":101,"wires":[["a1c90746.59bee8"]]},{"id":"9939954d.414a","type":"serial-port","z":"","serialport":"/dev/ttyUSB0","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","newline":"\\n","bin":"false","out":"char","addchar":false}]

Then you should be able to see the potentiometer value in the debug tab.
You mustn’t use the serial monitor at the same time, otherwise, it will mess around with the node-red serial ! But at least you can use it (serial monitor) to see at first time if you can read your potentiometer data on it ! Then close it and rune node-red.
Let us know if it works as you expect !

1 Like