Node-red-mcu-plugin v1.0: Integrating Node-RED MCU Edition into the Node-RED editor

The rule of thumb is: node-red-mcu is designed to be as close as possible to legacy Node-RED. The implementation may be different & mostly optimized, the result shall be predictable - in the sense of "the same"...

1 Like

For those following this topic: @ralphwetzel fixed my issue. So now old existing config nodes (the ones with a . inside their node id) are now also supported inside mcu flows.

Now it is getting fun :champagne: :partying_face: :tada:

  1. I deploy this flow to my wt32-eth01 mcu, to send a message to my MQTT broker every 5 seconds:

    image

  2. And I deploy this flow on my NodeJs backend (like we always do), to receive those messages from my MQTT broker:

If there is any Node-RED fan on this blue planet that doesn't love this stuff, then I will eat my shoes for breakfast :wink:

2 Likes

Hi Ralph,

Would like to read my first sensor, in this case the HC-SR04 (which Andy has implemented for me already two months ago...). So I wanted to install an up-to-date generic sensor package, but that fails because npm can't find a package.json file:

pi@raspberrypi:~/.node-red/node_modules/@ralphwetzel/node-red-mcu-plugin/node-red-mcu/nodes/mcu/sensor $ ls
manifest.json  mcu_sensor.html  mcu_sensor.js  sensor.js
pi@raspberrypi:~/.node-red/node_modules/@ralphwetzel/node-red-mcu-plugin/node-red-mcu/nodes/mcu/sensor $ cd ~/.node-red
pi@raspberrypi:~/.node-red $ npm install /home/pi/.node-red/node_modules/@ralphwetzel/node-red-mcu-plugin/node-red-mcu/nodes/mcu/sensor
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/pi/.node-red/node_modules/@ralphwetzel/node-red-mcu-plugin/node-red-mcu/nodes/mcu/sensor/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/pi/.node-red/node_modules/@ralphwetzel/node-red-mcu-plugin/node-red-mcu/nodes/mcu/sensor/package.json'
npm ERR! enoent This is related to npm not being able to find a file.

Does the sensor libraries now have to be installed in another way?

From the docu in node-red-mcu:

And to install:

cd ~/.node-red
npm install [PATH TO node-red-mcu]/nodes/mcu

The nodes appears in the "MCU" section of the editor.

2 Likes

Hi Ralph,

I had overlooked that md file. Was always looking at the readme page of the repo itself...

Ok now I see a nice suite of mcu nodes:

image

Now I need to get used to this Sensor node...

I failed to read my HC-SR04 ultrasonic sensor using the Sensor node, as described here. If anybody has already used the Sensor node with success, please join that discussion if you have any tips. Thanks!!

For those having a headless Pi: thanks to an update of the Moddable SDK (by @phoddie) and the node-red-mcu-plugin sidebar (by @ralphwetzel), the xsbug-log seems to working fine now. Halleluja :wink:

Next task is to try out Peter's troubleshooting tips to analyze why my HC-SR04 sensor doesn't send any measurements to my Node-RED.

1 Like

Thx for the update. Now some one should make a step by step tutorial for the dumb ppl like me.

Had a Zoom session tonight with @ralphwetzel and @phoddie, because I couldn't get my Sensor node up and running. And now finally values from my HC-SR04 sensor arrive in my Debug sidebar, from Node-RED on my ESP32 :champagne: :tada: :partying_face:

What a service :star_struck:

Now I am getting close to a working solution. I just saw a few minutes ago that my sensor values are always the same, so I need to have a look at that. Will need to check my wiring and my sensor, to make sure it is not software related. To be continued...

Once I got it working with decent sensor values, I will write a tutorial of my steps.

5 Likes

I had hoped to be able to look in on the session, but sadly I had other commitments. Glad you are making progress.

1 Like

@BartButenaers, thanks for taking time from your busy calendar to work through this with @ralphwetzel and me today! Having everyone's eyes and expertise on the problem allowed us move quickly. It was also very interesting for me to see your workflow first hand. Thanks to patient, persistent work and feedback from you and many others (@Sineos and @Colin, included) Node-RED MCU Edition continues to rapidly improve. Very much appreciated.

4 Likes

that would be great!

Here you go...

3 Likes

Thank you for making such a great tutorial!!
I will try it next week an report back then.

1 Like

It would be fun to find a use case for this!! a lilygo esp32 watch.

https://www.aliexpress.us/item/3256801867335690.html

1 Like

Small update: I've just pushed v1.4 of this plugin to npm.

  • Support for Node-RED v3.1.0 :tada:
  • Support for the Nordic nRF52 platform (e.g. used by the fantastic Moddable Four) :champagne:
  • List of known (pre-configured) platforms updated
  • Some additional (smaller) fixes

As the change to the palette manager to support as well plugin packages is still in the making, you don't get a button to easily update the package.
Thus you need to browse for it on the palette managers Install tab - or run the update via the console.

3 Likes

Has anyone done anything with serial communications? I am thinking of installing this on a smart switch that has an 8266 but talks with a TuyaCPU via uart/serial.

Hi Joe!
It took me a while to walk through our codebase.
The answer is a bit unfortunate: Despite there are some fragments for serial / UART support, it looks as if this functionality was never exposed into a node.
@phoddie might perhaps provide further support, e.g. adding this to his suite of already existing @moddable-node-red/mcu nodes.

Serial support is very possible. The underlying support is already there in the ECMA-419 IO for ESP8266, ESP32 family, Raspberry Pi Pico, and nRF52. Wrapping that in node or two should be straightforward. I looked into that earlier this year and it is roughly the same as the existing TCP socket nodes.

When implementing nodes for the MCU, I try to avoid inventing something new and instead implement an MCU version of existing nodes. Is there a widely used or particularly well-designed serial node that could used as a target here?

Looks like node-red-node-serialport could qualify for this. About 3.5k downloads within the last week; created & still maintained by the NR core devs.

1 Like