-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node-Red Serial port? #80
Comments
@crossband docker containers are placed in a sandbox and cannot access system hardware unless explicitly told to do so. I haven't 'enabled' the serial device by default, because I haven't had the opportunity to test it yet. I've got a usb serial device lying around in a drawer somewhere, I'll try to get it working by Friday. There are some hoops with rights and the dialout group. That functionally I would need to build into the stack script node-red-stop will not work when executing from the Pi's terminal. The sandbox concept means for all intents and purposed the nodered container is separate machine. Therefore you would need to access its terminal (like using ssh) to run commands against that container. The preferred way of stopping and starting containers is via the docker command. You can type |
I did a quick test and i was able to connect to the serial port, would you mind testing the following for me? edit you docker-compose.yml file and under nodered insert the privileged key
i can connect to my serial port but i've got nothing to talk to at the moment. I'd appreciate if you could test and let me know then i can update the project to reflect the changes |
I forgot to add you will need to run |
Thanks Graham for your prompt reply. It worked!
|
I'll push an update later to make it available to everyone. For now to 'protect' your version from being overwritten the next time when you build the stack edit the file called services/nodered/service.yml (that file is used to build the docker-compose.yml file). add the privileged key there as well and if you build the stack select "dont overwrite" for node red |
added to project on latest push |
…rt9001 Mosquitto - remove port 9001 from template
Hello Graham, thank you in advance for you wordeful effort. I'm getting an issue similar to Crossband. A device (USB 2 RS485 dongle) connected to my RPi4 is giving me problems in nodered. It has worked almost 12 hours (polling time 1 sec)... and then I get Error: {"name":"TransactionTimedOutError","message":"Timed out","errno":"ETIMEDOUT"} I tried to add privileged: YES in docker-compose.yml Today no way. Added /dev/ttyUSB0 (needed!!) and /dev/ttyUSB1 (not needed)....but no luck Can you help me with this? Thank you for your effort! Regards Paolo |
After seferal I get timeout from time to time Your feedback would be highly appreciated!! Thank you again |
First, please see this project is dormant. If you really are still on this repo (gcgarner/IOTstack) you might want to migrate to sensorsIot/IOTstack because it's getting a bit more maintenance. My guess is that the USB device is disconnecting periodically and that's what is causing it to change its name.
I have two "solutions" to offer you but I'd like you to carefully consider whether doing the work of reading the RS485 adapter from Node-RED is the most appropriate way of going about it?
Possible solution 1 - Node-RED talks to the hardwareSee this gist for background info. Just ignore the fact that it's discussing 3D printers and a totally different container (OctoPrint). It boils down to the steps at device discovery:
Once that is in place then, when you connect the USB device, it should show up as
If When disconnecting/reconnecting reliably shows up as
If it were me, I'd probably go for the second line so what I was seeing inside containerspace was the same as I saw outside. However, if the Node-RED mechanism for getting to external devices only likes standard-form names, you might have to make do with the first line. I've never tried anything like this with Node-RED but my experience with OctoPrint tells me that an external device going away can be expected to cause the container to crash. Node-RED might be smart enough to only crash the flow, and it may even recover gracefully, but I kinda doubt it because device-mapping is a Docker thing, not a Node-RED thing. If the device going away crashes the container, docker will auto-restart the container. If the device still isn't there (eg you unplugged it), the container will go into a restart loop. If you're running other flows besides this one, you'll lose those too. It's these kinds of issues that lead to the question I posed at the beginning, and the idea of "a better way"… Possible solution 2 - work with the systemSee this gist. It talks about logging CPU temperatures but it's no great stretch to use this basic approach to run an external process (possibly in conjunction with the udev rule set as earlier) to probe the RS485 adapter, format the data into an MQTT message, and send it on its way. Hope something in this helps you solve your problem. |
Hello Paraphraser!!
I understood it now!
THIS IS VERY HANDSOME. Mention for good coaching. Sounds like u're a Morpheus..
In the project i will need 2 further simple "dry contacts" collected on Rpi GPIO.
mmm. gonna study this more to understand 100%. But I'm thinking what I've done: just before the start of the above mentioned misreadings I connected the arduino (just to have power supply) to a RPi usb port.
Not confident with MQTT yet.
Many many "Thank you" for your brilliant advice!!! |
Dear All,
I have grafana, influxdb, mosquitto, nodered and portainer installed on Raspberry Pi 4, everything seems to be running. Node-Red GUI is also accessible on port 1880.
But I can not get the local serial port to work. Serial device is definitely working, I have checked it using
screen /dev/ttyUSB0 115200
command. But it shows "not connected" in GUI.Node-Red commands like
node-red-stop
are also do not work.Did I perhaps something wrong? I have installed it following the IOTstack instructions, using
./menu.sh
.The text was updated successfully, but these errors were encountered: