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

**URL:** https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693
**Category:** Share Your Projects
**Created:** [25 December 2022 19:56 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693 "2022-12-25T19:56:53Z")
**Posts on this page:** 20
**Page:** 3

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [4 February 2023 17:14 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693/41 "2023-02-04T17:14:45Z")

</div>

> [@BartButenaers](#):
>
> I don't really understand how an injected message arrives on the mcu, or how the mcu can show messages in the debug bar via the debug node

I think it is just the same as with normal node-red. With that, when you press the inject in the browser, it sends a message to the node-red server, which does its bit, and the debug node sends it back to the browser. With the mcu edition it is basically the same, except that the node-red server (mcu version) is running in the device.

**[Edit]** Perhaps you meant how does the comms work between the browser and the device, in which case ignore me.

---

<div class="post-metadata">

### Author: ![ralphwetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphwetzel/32/53713_2.png) [@ralphwetzel](https://discourse.nodered.org/u/ralphwetzel)
#### Post date: [4 February 2023 19:00 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693/42 "2023-02-04T19:00:49Z")

</div>

> [@BartButenaers](#):
>
> When I start my flow editor, the MCU sidebar is empty in the beginning (when the MCU sidebar is my default sidebar at startup):

Could you please open an issue at the repository. Not much explanation necessary - just to ensure I remember it on the long run.

> [@BartButenaers](#):
>
> Then the same error keeps popping up in your sidebar. Do you have any idea how I could solve this?

Yes. This is a "speciality" of Node-RED [when it runs as a service](https://github.com/ralphwetzel/node-red-mcu-plugin#raspberry-pi-additional-preparation-steps). In short, it doesn't have access to the host environment. Thus despite you defined those variables, they are not available to Node-RED. The solution is straight forward ... and explained in the [Readme](https://github.com/ralphwetzel/node-red-mcu-plugin#raspberry-pi-additional-preparation-steps). You have to do this for MODDABLE and for IDF\_PATH.

> [@BartButenaers](#):
>
> 1. Does the Inject node (which is triggered periodically) run on the mcu? If so, then the button of the Inject node won't be triggering messages I assume or does it somehow?

Put an `AND` between your sentences. The inject node runs in the runtime - that runs on the MCU. The editor runs locally on your system. As with legacy Node-RED, the editor sends the trigger signal, which is then forwarded to the runtime ... on the MCU.

To sum it up: Node-RED MCU Edition provides the same user interaction features as legacy Node-RED.

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [4 February 2023 22:41 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693/43 "2023-02-04T22:41:07Z")

</div>

@ralphwetzel,

I hope you and the guys have had a good exhibition today...  
And thanks for supporting me meanwhile!

1. I have create an [issue](https://github.com/ralphwetzel/node-red-mcu-plugin/issues/14) in your Github repo.

2. I had already added the moddable stuff to my settings.js file, but I have now also added the espressif stuff:

3. Afterwards I got this new error:

4. Then my build for my wt32-eth01 seemed to have run successfully. But I don't see anything in my Debug Panel, although I have set the inject node to keep injecting messages:

---

<div class="post-metadata">

### Author: ![ralphwetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphwetzel/32/53713_2.png) [@ralphwetzel](https://discourse.nodered.org/u/ralphwetzel)
#### Post date: [5 February 2023 08:25 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693/44 "2023-02-05T08:25:29Z")

</div>

> [@BartButenaers](#):
>
> I hope you and the guys have had a good exhibition today...  
> And thanks for supporting me meanwhile!

Hi @BartButenaers !  
We had ... and we're expecting another one full of interesting exchange around Node-RED and the Node-RED MCU Edition. It's too bad you didn't get the clearance to stop by ... 😉 !

> [@BartButenaers](#):
>
> I don't think it is mentioned in the documentation. Might be worth adding it...

It is; step 8 in [Installing](https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/devices/esp32.md#installing-2). As you don't need this on the other platforms, I'm sure it easily can be overlooked...

> [@BartButenaers](#):
>
> I just unconnected the IO0 pin to leave programming mode. I assume that should work because I have entered the wifi credentials.

The feedback from the MCU to the Node-RED editor is established (only) via the serial connection. Thus it's launched just after finishing the flashing process. If you have to detach the device (as I understood), this is going to cut the feedback line. For this case, there's a way to re-establish the link (after you've re-attached the device) without performing another build run: Press the down arrow of the `Build` button & select "Reconnect to xsbug...":

This should open `xsbug` and as well establish the link to the Node-RED editor...

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [5 February 2023 20:00 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693/45 "2023-02-05T20:00:12Z")

</div>

I think that the _"reconnect to xsbug"_ works (when the wt32-eth01 is connected via the USB-TTL converter to my Raspberry), because I see no errors:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/8/9890f01ff9b76ea6eb52284d3ad122a38231fdb3.png)

But I don't get anything in my Debug sidebar.  
Not really sure how to determine in which step I have done something wrong...

Is this perhaps something I should ask Andy on Github?

---

<div class="post-metadata">

### Author: ![ralphwetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphwetzel/32/53713_2.png) [@ralphwetzel](https://discourse.nodered.org/u/ralphwetzel)
#### Post date: [5 February 2023 20:29 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693/46 "2023-02-05T20:29:59Z")

</div>

IIRC correctly, you're running your Pi headless. Are you able to `ssh` or to `vnc` into your Pi?

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [5 February 2023 21:37 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693/47 "2023-02-05T21:37:32Z")

</div>

> [@ralphwetzel](#):
>
> IIRC

Good memory...  
Yes indeed it is headless. And yes I can access it over ssh via Putty.

---

<div class="post-metadata">

### Author: ![ralphwetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphwetzel/32/53713_2.png) [@ralphwetzel](https://discourse.nodered.org/u/ralphwetzel)
#### Post date: [6 February 2023 19:20 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693/48 "2023-02-06T19:20:00Z")

</div>

Ok then! Let's try if it works in general - and afterwards let's make it talk to Node-RED:

I assume that you installed [xsbug-log](https://github.com/Moddable-OpenSource/moddable/tree/public/tools/xsbug-log) from the Moddable SDK.

Please access your Pi, `cd` into the `Working Directory` (that should be logged at the beginning of the build process) & then run ( as safety measure)

```bash
source $IDF_PATH/export.sh

```

followed by

```bash
mcconfig -d -l -m -p esp32/wt32_eth01 -t xsbug

```

Doing this, we take Node-RED out of the game and just perform the basic XS build / connect process; we run the flow on the MCU and - rather than opening xsbug - reroute the debug messages to the console window.

If that works, we'll continue to verify the feedback path to Node-RED.

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [6 February 2023 22:23 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693/49 "2023-02-06T22:23:02Z")

</div>

Hi Ralph,

1. Seems that xsbug-log has been installed already in:  
`/home/pi/Projects/moddable/tools/xsbug-log/xsbug-log.js`

2. This was at the start of my build log:

3. Here you can see the result of those commands:

Not sure what I should see here, but I assume _"Terminated"_ is not the best scenario...

---

<div class="post-metadata">

### Author: ![ralphwetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphwetzel/32/53713_2.png) [@ralphwetzel](https://discourse.nodered.org/u/ralphwetzel)
#### Post date: [7 February 2023 07:07 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693/50 "2023-02-07T07:07:13Z")

</div>

> [@BartButenaers](#):
>
> Seems that xsbug-log has been installed already in:  
> `/home/pi/Projects/moddable/tools/xsbug-log/xsbug-log.js`

That's the source path.  
Please take care that you as well `npm install`ed it as stated [here](https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/tools/tools.md#arguments) in the second `Note`. It's called as a `node` script & thus installation in mandatory to use it...

If you then run (notice the missing `-t` flag)

```bash
mcconfig -d -l -m -p esp32/wt32_eth01

```

it should launch a compiler run.

With

```bash
mcconfig -d -l -m -p esp32/wt32_eth01 -t xsbug

```

you should at least get the `# starting xsbug` line as before.  
All is good, if this is followed by a log message each time the inject node injects...

---

<div class="post-metadata">

### Author: ![jmorris644](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jmorris644/32/31964_2.png) [@jmorris644](https://discourse.nodered.org/u/jmorris644)
#### Post date: [7 February 2023 21:49 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693/51 "2023-02-07T21:49:48Z")

</div>

I have been following this thread with great interest. I just had my first success with a esp-c3-32s-2m. I had a simple inject node to a debug node. I could see my inject response on both the NR console debug window as well as the xsbug window.

Now do try and do something more fun with it. 🙂

edit: Ok, I am trying another flow. But I am now consistently getting `termios.error: (5, 'Input/output error')` during the load. Do I need to do something with the ESP between loads?

---

<div class="post-metadata">

### Author: ![ralphwetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphwetzel/32/53713_2.png) [@ralphwetzel](https://discourse.nodered.org/u/ralphwetzel)
#### Post date: [7 February 2023 22:18 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693/52 "2023-02-07T22:18:26Z")

</div>

> [@jmorris644](#):
>
> Do I need to do something with the ESP between loads?

Not necessarily. It could help though to unplug the ESP once and thus reset the port...

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [7 February 2023 22:38 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693/53 "2023-02-07T22:38:14Z")

</div>

> [@ralphwetzel](#):
>
> Please take care that you as well `npm install`ed it as stated [here](https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/tools/tools.md#arguments) in the second `Not`

Hmm, this is getting embarrassing 😳  
I really thought that I had executed nicely all the steps required to get this stuff up and running. And over and over again it seems that I have somehow forgotten to run stuff...

Ok, I did some extra steps:

1. Navigated to that folder and npm installed it:

2. I ran the mcconfig command without `-t`:

3. Suddenly I remembered that last weekend I had detached my wire to put the wt32-eth01 in _ **programming mode** _. So I added the wire again (between pins IO0 and GND), and then it started flashing:

4. I think the flashing was ok, because I got a prompt:

5. I have closed the prompt (via CTRL-C) to execute your last command with the `t` option this time. But then I get this:

Damn my (very limited) Node-RED time is up again for today ...

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [8 February 2023 09:54 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693/54 "2023-02-08T09:54:46Z")

</div>

I am hoping to find time to get started playing with this. Is the Wemos D1 Mini supported already? I couldn't find any direct info about using that board with Moddable.

---

<div class="post-metadata">

### Author: ![ralphwetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphwetzel/32/53713_2.png) [@ralphwetzel](https://discourse.nodered.org/u/ralphwetzel)
#### Post date: [8 February 2023 10:05 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693/55 "2023-02-08T10:05:34Z")

</div>

> [@Colin](#):
>
> Is the Wemos D1 Mini supported already?

You can build for all ESP32 (and...) boards, no matter what brand.  
Those "supported" generate predefined settings, e.g. for the available infrastructure (e.g. buttons or LEDs), to make life a bit easier. It just saves you from finding this data in the documentation.

There should be nothing that stops you from being successful as well with another board...

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [8 February 2023 11:24 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693/56 "2023-02-08T11:24:40Z")

</div>

OK, thanks.

---

<div class="post-metadata">

### Author: ![jmorris644](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jmorris644/32/31964_2.png) [@jmorris644](https://discourse.nodered.org/u/jmorris644)
#### Post date: [8 February 2023 14:39 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693/57 "2023-02-08T14:39:22Z")

</div>

Interesting, if I chose the wrong ESP32 I would get a mis-match failure when trying to flash.

---

<div class="post-metadata">

### Author: ![jmorris644](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jmorris644/32/31964_2.png) [@jmorris644](https://discourse.nodered.org/u/jmorris644)
#### Post date: [8 February 2023 14:40 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693/58 "2023-02-08T14:40:29Z")

</div>

I have tried that. At times I also get an error something about serial crosstalk. Is there a way to slow the serial speed down?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [9 February 2023 09:21 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693/59 "2023-02-09T09:21:45Z")

</div>

I have installed the SDK and ESP8266 support with very few issues (on Ubuntu 22.04) and tested it with the Moddable hello world example. The ESP8266/nodemcu option seems to work ok so far with the D1 Mini.  
I installed the plugin in node-red. When I start node-red I get a message in the log

```auto
9 Feb 07:48:13 - [info] *** node-red-mcu-plugin:
9 Feb 07:48:13 - [info] It looks as if a new platform option has been added.
9 Feb 07:48:13 - [info] Please raise an issue @ our GitHub repository, stating the following information:
9 Feb 07:48:13 - [info] > New platform: esp32/atoms3
9 Feb 07:48:13 - [info] > New platform: esp32/wt32_eth01

```

Do I need to worry about that?

I added a flow with inject and debug node and selected the flow for mcu build, set the build config to  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/b/8b3684ddd237f2fe7fd7d7c37af9749e0b736830.png)

Deployed an clicked MCU Build button. In the mcu console it built it and flashed it ok, finishing with

```auto
Writing at 0x003fc000... (100 %)
Wrote 128 bytes (75 compressed) at 0x003fc000 in 0.0 seconds (effective 254.1 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

```

In the node red log I see

```auto
Launching mcuProxy:
- Listening for MCU @ :::5004/IPv6

```

With anticipation I clicked the Inject button in the flow, but sadly, after everything looking so good, nothing happened.  
I don't know what to do now.

---

<div class="post-metadata">

### Author: ![ralphwetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphwetzel/32/53713_2.png) [@ralphwetzel](https://discourse.nodered.org/u/ralphwetzel)
#### Post date: [9 February 2023 09:54 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693/60 "2023-02-09T09:54:20Z")

</div>

> [@Colin](#):
>
> Do I need to worry about that?

No.

> [@Colin](#):
>
> I don't know what to do now.

At least you should see the `xsbug` window opening at the Ubuntu desktop...

[Previous page](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693.md?page=2)

[Next page](https://discourse.nodered.org/t/node-red-mcu-plugin-v1-0-integrating-node-red-mcu-edition-into-the-node-red-editor/72693.md?page=4)
