Who would have believed this is possible! Nick and Peter Hoddie had a chat at OpenJSWorld22 and Peter has started a project to run Node Red flows on ESP8266 and ESP32 using Javascript and Moddable. I purchased Peters book on Kindle and over the last few days, setup the tool chain and did some of the examples. I now have simple Node Red flows running on both these devices.
Thanks and well done Nick and Peter!
Here are the links
https://www.moddable.com/
https://github.com/phoddie/node-red-mcu
https://github.com/Moddable-OpenSource/moddable
Hey @mtoko,
Thanks for sharing this!!!
Have been hoping for many years that something like this would ever appear...
Can you give an idea of the amount of work/time to get started with this?
Bart
Hi Bart, it took me some time, but I was learning some new stuff along the way. The Getting Started guide on the Moddable Github page is the place to start. I followed these instructions and got everything to work with the simulator and an ESP8266. This is to understand the Moddable and Javascript on ESP8266 and ESP32. I did get the book from the Moddable site on Kindle (+/-600 pages) and there is plenty of good info and examples. When I was confident I moved onto the Node Red for Moddable (on Github) and followed the instructions on that. It is early days but I have got basic MQTT working and can control pins on the ESP using the PiGPIO nodes in Node Red.
So, with someone of your skill about an hour
I'm really having a lot of trouble believing this!!!
For a doubting Thomas such as myself - can you post some screenshots/little snippets of code to convince me that this isn't just an early April Fool!
I've had a look at the links now and I can maybe believe it now
I was think no-way can we edit/run flows on such devices!
And , of course, they can't run a live editor but it seems they can read and execute a flow sequence in a flows.json file
Very clever
Hey Simon,
Didn't have a chance yet to read about it. Do you mean that you run the Node-RED flow editor e.g. on a Raspberry, and that you generate (e.g. for a limited set of nodes) some code that can run on the microcontroller afterwards? So you can't see status update or debug messages in your flow editor. Or am I completely wrong?
@mtoko: Do they share the recordings of those OpenJSWorld22 speeches somewhere? Very curious about that one to be honest...
You export the flow as normal and then copy it into a Node.js folder that is downloaded to the ESP
This is the extract from the instructions which suggests that the debug can be used and the results display in the ESP debugger, but I don't understand this and have not tried it yet
Debug
- Console output is displayed in the xsbug log pane
- Sidebar output is displayed in the xsbug message pane
- Display of selected property or complete message
- Output to node status (maybe meaningless on device)
From what I understand this was not a particular presentation, Peter and Nick met up for a chat and this was the great result
Ah ok, thanks for the clarification!!
So they show currently everything in the xsbug window.
It is getting a bit more clear now:
- Run a normal Node-RED runtime, e.g. on a Raspberry.
- Create a flow with a limited set of core nodes (supported by Moddable).
- Export that flow to a json file.
- Upload that file where Moddable is running.
- The Javascript engine runs the nodes from the json file, and logs its output to the Js debugger.
If I would have been retired now, I would immediately start experimenting with this
That diagram is how I understand it. Remember this is all very new and is not the finished article. I think it would be good for members of the community to apply their Node Red experience and assist with the development
Had a quick look at the commit history of node-red-mcu, which tells me that the first commit was 5 days ago. A Node-RED runtime for mcu in one single JS file. Very impressive...
I will make an attempt to give this a try this week. It should be fun and very interesting.
Wow something which i have been looking for . Any idea how to add modbus and bacnet alongside i2c and serial port?
...new usecases come to mind immediately.
Like, making remote sensors and relays more intelligent/robust in terms of availability/connection to the central Logic-Unit (Node-Red), hence making them go into failsafe mode based on rules given in a local flow.
Something I normally implement in local tasmota rules engine. Now this offers the use of the same platform and ways of deployment...good for the platform ecosystem.
Any video to help us understand the concept and a working demo project?
Rather than shoehorn NR into a space it was never intended to be; Would a better idea be to build an automation/flow using the NR interface, then have that compile down for use on the ESP MCU? This would effectively be a translation from the script that underpins NR into the C++ that can be compiled to the final binary for flashing onto the ESP?
I personally find coding automation in the Arduino IDE painful, and would deffo find doing it in NR easier, even if that means limited nodes to work with perhaps?
There's still a long way to go ... but first steps are done: https://github.com/ralphwetzel/node-red-mcu-plugin
In the Moddable YouTube channel, there is a video than can help us! Getting Started with the Moddable SDK and the ESP8266
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.