# Serial out node - how to send break and idle instruction?

**URL:** https://discourse.nodered.org/t/serial-out-node-how-to-send-break-and-idle-instruction/72075
**Category:** General
**Created:** [12 December 2022 12:19 UTC](https://discourse.nodered.org/t/serial-out-node-how-to-send-break-and-idle-instruction/72075 "2022-12-12T12:19:55Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![pablodaw](https://avatars.discourse-cdn.com/v4/letter/p/c57346/32.png) [@pablodaw](https://discourse.nodered.org/u/pablodaw)
#### Post date: [12 December 2022 12:19 UTC](https://discourse.nodered.org/t/serial-out-node-how-to-send-break-and-idle-instruction/72075/1 "2022-12-12T12:19:55Z")

</div>

Hi.

How can I send 88 usec break and 8 usec idle state before the main data frame, using node (e.g. Serial Out)?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/c/5c76bb3b0767f63cf286098da12e8a1d069c2ecc.jpeg)

---

<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: [13 December 2022 10:21 UTC](https://discourse.nodered.org/t/serial-out-node-how-to-send-break-and-idle-instruction/72075/2 "2022-12-13T10:21:32Z")

</div>

Does the hardware you are using allow the serial port to be driven like that? If the hardware does not support then there is nothing that node-red can do.

---

<div class="post-metadata">

### Author: ![pablodaw](https://avatars.discourse-cdn.com/v4/letter/p/c57346/32.png) [@pablodaw](https://discourse.nodered.org/u/pablodaw)
#### Post date: [14 December 2022 18:05 UTC](https://discourse.nodered.org/t/serial-out-node-how-to-send-break-and-idle-instruction/72075/3 "2022-12-14T18:05:31Z")

</div>

I have no idea, Colin. That's why I want to test it.  
This break is just a low state of line - a bunch of zero bits, just without surrounding start and stop bits. Why would serial port not support this?

---

<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: [14 December 2022 18:37 UTC](https://discourse.nodered.org/t/serial-out-node-how-to-send-break-and-idle-instruction/72075/4 "2022-12-14T18:37:07Z")

</div>

What hardware are you using for the serial port? Direct to gpio pins or a usb serial dongle, or what?

---

<div class="post-metadata">

### Author: ![pablodaw](https://avatars.discourse-cdn.com/v4/letter/p/c57346/32.png) [@pablodaw](https://discourse.nodered.org/u/pablodaw)
#### Post date: [14 December 2022 18:49 UTC](https://discourse.nodered.org/t/serial-out-node-how-to-send-break-and-idle-instruction/72075/5 "2022-12-14T18:49:36Z")

</div>

RS-485 hat over Raspberry Pi.

> **[2-CH RS485 HAT - Waveshare Wiki](https://www.waveshare.com/wiki/2-CH_RS485_HAT)**

---

<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: [14 December 2022 20:54 UTC](https://discourse.nodered.org/t/serial-out-node-how-to-send-break-and-idle-instruction/72075/6 "2022-12-14T20:54:33Z")

</div>

So the question is, is it possible, using the HAT that you linked to, to send an 88 usec break and 8 usec idle state before the main data frame? I think that is a question that you need to direct to a Pi forum or to the supplier of the HAT. Do you know if it is possible to do it with a standard USB/RS485 interface? Googling for Pi DMX suggests that you need specific hardware for driving a DMX bus. This for example [https://www.instructables.com/Raspberry-Pi-as-a-DMX-light-controller/](https://www.instructables.com/Raspberry-Pi-as-a-DMX-light-controller/)

---

<div class="post-metadata">

### Author: ![pablodaw](https://avatars.discourse-cdn.com/v4/letter/p/c57346/32.png) [@pablodaw](https://discourse.nodered.org/u/pablodaw)
#### Post date: [14 December 2022 21:25 UTC](https://discourse.nodered.org/t/serial-out-node-how-to-send-break-and-idle-instruction/72075/7 "2022-12-14T21:25:22Z")

</div>

Yes, I know there are plenty of hardware dedicated to RPi and DMX, including USB dongles, but I've been successfully running DMX over other RS485 shield, like Zihatec on Arduino, which is also a regular RS485 hat.

Maybe I should rephrase my question to:  
_How can I send 88 usec break and 8 usec idle state before the main data frame, using node (e.g. Serial Out)_, assuming that my hardware supports it?  
It's a general software-based question. I guess DMX isn't the only protocol using this kind of break.

---

<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: [14 December 2022 21:32 UTC](https://discourse.nodered.org/t/serial-out-node-how-to-send-break-and-idle-instruction/72075/8 "2022-12-14T21:32:16Z")

</div>

> [@pablodaw](#):
>
> I've been successfully running DMX over other RS485 shield, like Zihatec on Arduino

How do you achieve the break in that setup?

**[Edit]** Or alternatively, forget about node-red for the moment, assume you are using Python or whatever language you like, how would you achieve what you want on the Pi? Once that is answered then it should be clear how to do it in node-red.

---

<div class="post-metadata">

### Author: ![pablodaw](https://avatars.discourse-cdn.com/v4/letter/p/c57346/32.png) [@pablodaw](https://discourse.nodered.org/u/pablodaw)
#### Post date: [14 December 2022 22:00 UTC](https://discourse.nodered.org/t/serial-out-node-how-to-send-break-and-idle-instruction/72075/9 "2022-12-14T22:00:37Z")

</div>

There are a couple of Arduino C++ libraries that allow sending this type of signal over RS, like DMXSimple, DMXMaster or DMXSerial - they work fine.

Alright, assuming that I already have a python code running DMX, what then? I know there are nodes executing python scripts, but they have unacceptable latency.

I understand your point - why am I asking about a node if I'm not even sure if my hardware can handle DMX. Well, It's an academic question about how can I model a particular protocol using Node-RED, and understanding it better in general.  
When I send a bunch of bytes over Serial Out node, it surrounds it with one start bit and one or two end bits (or parity bit). My question is simply - is Node-RED capable of adding a break and mark-after-break in the beginning of the signal. I cannot just add 22 zero bits instead of this break, because they will also be wrapped in start/end bits.

Take a look at the end of that python code - the last four lines. This is how it's done in python.

> <https://github.com/MattIPv4/PyDMXControl/blob/master/PyDMXControl/controllers/_SerialController.py>

---

<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: [14 December 2022 22:16 UTC](https://discourse.nodered.org/t/serial-out-node-how-to-send-break-and-idle-instruction/72075/10 "2022-12-14T22:16:51Z")

</div>

> [@pablodaw](#):
>
> ```
> self.__device.send_break(100e-6)
> sleep(10e-6)
> self.__device.write(data)
> 
> ```

Is that code intended to be used on a pi with an usb/rs485 dongle?

If so then I stand corrected. I did not think it was possible. I think the serial node would have to be extended to provide that.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [12 February 2023 22:17 UTC](https://discourse.nodered.org/t/serial-out-node-how-to-send-break-and-idle-instruction/72075/11 "2023-02-12T22:17:21Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
