Home Creators Posts Import Register Favorites Logout

Content

Hi folks - I'm super-pleased to hear that some of you have been trying out Node-RED after following my last few videos! I know that there's quite a steep learning curve and lots to get your head around, so in this latest video I've tried to create a really basic "Hello World" example of how to connect an Arduino to Node-RED - it uses a single Reed switch to detect the presence of a magnet, and the Arduino then uses Serial.print to send a 1 or 0 value over the USB cable to the PC. 

Rather than just displaying that value as a debug message on the Arduino IDE serial monitor (which I've done in previous videos), the PC uses the "Serial In" node to read that value as input to a Node-RED flow, and displays the result on a live-updated web dashboard. This is the basic building block from which you can build more complicated GM dashboards to monitor the state of all the puzzles in your ER room.

If you're not onboard with the whole Node-RED thing, don't panic! I'll be returning to doing some more traditional Arduino ER Puzzle tutorials after Christmas. My plan is to then include Node-RED integration as an "optional extra" in all my future tutorials, so you can take it or leave it, but I really want to try to show off some more cool Node-RED stuff first. I'm hoping to get out the way during the rest of November and December.

As always, thankyou for your ongoing support - you're all lovely. And please ask if you have any questions. x

Files

Using Arduino with Node-RED to create a Simple Web Dashboard

This is an introductory video that attempts to demonstrate a very simple example of how to connect an Arduino UNO to Node-RED, using a serial connection via USB cable (i.e. exactly the same way you would normally upload a new sketch to your Arduino board). The Arduino can write data, such as the readings of any sensors, to the serial connection using the Serial.print command. Instead of simply showing this data on the Arduino IDE Serial Monitor, this data can be received by the Node-RED server running on a PC which can then trigger a whole range of other hardware, evaluate complex logic, or display the current state of the device in a browser-based graphical dashboard. This makes it ideal for controlling and monitoring Arduino-based props in an escape room, for example. Node-RED is free, open-source software that can be downloaded from https://nodered.org/ In this tutorial, I'll just create a very simple webpage containing one text node, whose value changes between 0 and 1 depending on whether a Reed switch attached to the Arduino detects a magnet or not. In future videos, I'll extend this example to more complex cases of sending multiple sensor values, how to send data from Node-RED to Arduino, and alternative connection methods such as MQTT. For an example of other ways in which Node-RED can be used in Escape Rooms, check out: - https://www.youtube.com/watch?v=3jm2uED1wlg - https://www.youtube.com/watch?v=nPNFbN80pSg Timings --- 00:00-01:29 Introduction and hardware explanation 01:30-05:45 Arduino Code 05:46-07:10 Demonstration output using Arduino IDE serial monitor 07:11-12:05 Creating the Node-RED flow 12:06-12:52 Wrapup This video was made possible due to the generous support of my amazing patrons: https://www.patreon.com/playfultech

Comments

Polo Roset

Hi Alastair, first I want to thank you for your great work ! I've installed Node-RED and I can connect to localhost and everything looks OK. But when I want to install the "node-red-node-serialport " palette it fail. The log file talk about Python, but in your video it seem there is no need to have Python installed. Did I miss something ?

Timothy Riseborough

Hi Alistair, Firstly, thanks for all the videos - I was completely new to this, learnt a lot from you on YouTube and have come on leaps and bounds since becoming a patreon! I have even been inspired to use Node-RED and try to create a command centre! It's going well except I am currently having one issue with my latest attepmt. It's very similar in setup to your video above, except I'm using an Arduino Nano and 4 RFID sensors. When the correct Tag is placed against a sensor, it outputs a 1 to the serial monitor, otherwise it prints a 0. The only other difference is there is a momentary push button that players use to check their solution, and are given feedback via LEDs (its a cross between your object placement puzzle and mastermind puzzle). My issue is that the Node-RED Dashboard is a 'press' behind so isnt accurate - tells me what I did l the time previous (I hope thats clear). I've looked at the print out on the serial monitor on the Arduino IDE and its printing to that as I would expect - can you provide me any guidance? Thanks again for all your wisdom! Tim