E-Mail Arduino serial data using Node-RED
|In one of my blogs we have seen how to post data to the twitter using node-red. In this blog we will see how send a mail when we have some data over the serial port. We will be using the Serial input in the node-red to capture the data from Arduino. We can extend this concept to other input types as well, for example we can listen to a MQTT topic and send an email when ever we receive a message in the topic. The email may not have to be with the static content, we can send the same content we received in the topic and the content of the email.
We can even include some processing of the input information instead of sending every message, like sending email only if the temperature is more than configured value.
First you need to load the following code to your arduino.
void setup() { Serial.begin(9600); } void loop() { delay(15000); Serial.println("test data from Arduino UNO"); }
Then build the following flow in your node-red
Node RED Flow:
select the Arduino COM port for serial component.
You need to smtp details to configure the Mail element.
I will be using gmail smtp. To use gmail, you need to generate application specific password.
Click on generate, you will be provided with a password ,paste it in node-red mail config.
Deploy your flow, you should see a mail in your inbox after 15 seconds.