Serials Communication with Arduino Uno?
-
@sindarius Oh i did get the thing with pins 8 and 9 after realising what the library was for and that the designated TX and RX pins are basically the same serial i'm using to connect to the laptop.
For connection, do you connect duet TX to pin 8, and duet RX to pin 9? -
@mintytrebor I've just installed and had a little look at this. I quite like it and might be more my speed but don't understand it really yet. It looks like it'll be capable of polling the arduino and duet at the same time and just merging them into a single file on the pc which could be useful. Maybe also a powerful option for when i'm adding more features later down the line.
Are you able to share details on what you showed here?
-
@adam-v3d you mentioned you are using a duet 2 wifi but I didn’t see what firmware version you are running on the duet
-
@adam-v3d Sure.
There is an attempt at a wiki for the nodes used to connect to the duet here :
https://github.com/MintyTrebor/NodeDSF/wiki/AboutI also have a nodeDSF channel over on TeamGloomy's discord
https://discord.gg/bXcYqGvtThe quick POC I threw together earlier, just pulls the T0 temp from the Duet object model ~5 times a second, adds a time stamp, and writes a line to a csv file. That's it. There is an import/export function in nodered, so I can share the POC with you if its useful.
I have not used nodered to talk to arduino, there is a nodered faq that covers it here:
https://nodered.org/docs/faq/interacting-with-arduino. But if all you need is serial connectivity, then something like this (https://flows.nodered.org/node/node-red-node-serialport) will probably work..
-
@adam-v3d you might like to take a look at the CN Pendant project at https://github.com/Duet3D/CNC-Pendant-Firmware. This communicates to the Duet through the serial port.
If you will he using the USB interface to the Arduino as well, then I suggest you use an Arduino Leonardo, Arduino Pro Micro, or Arduino Mega. All of these give you a hardware serial port that is separate from the USB port. Also, the Leonardo and the Pro Micro accept 3.3V input signals, so although you need a simple resistive divider to reduce the Tx output of the Arduino from 5V to 3.3V, you don't need to level shift the output from the Duet up to 5V - although I suggest you use a 1K series resistor.
-
@adam-v3d
Attached is a example flow you can import which creates 2 connections to 2 different control boards, 1 via serial com port (over usb), the second over the network using the NodeDSF nodes.For the example:
Serial Connection Board 1: Send the M409 command via serial to get the chamber temp from the object model, and request a new update every 200ms, writing the values to a csv file.
Network Connection Board 2: Connect to board, and get updated bed temp every 200ms and write result to different csv file.You can then combine this data in whatever tool is required (excel etc).
If you want to push it further you can map the data to a chart in real-time in node-red using dashboard nodes eg
Flow in node-red
-
@mintytrebor thankyou!
-
@adam-v3d Gave the node red thing a pretty good shot today, spent some time learning how it works and managed to get it working and sending back data. In the current state I have it, on a 200ms request, it take anywhere from 227ms to over 1600ms to get a response when idle and also seems to be crashing the duet quite often too which would make the test void so going to abandon that idea. Currently I can get reading every 25.5ms +-0.5ms with the arduino and would like to keep that kind of rate and precision where possible.
I got some new level shifters that seem to work a bit better so i'm going to give the direct serial connection another go and also try with the arduino mega if It doesn't go well with the uno.
-
@adam-v3d said in Serials Communication with Arduino Uno?:
on a 200ms request, it take anywhere from 227ms to over 1600ms to get a response when idle and also seems to be crashing the duet quite often too
Out of interest is that using the serial connection node?
-
@mintytrebor no sorry that was wifi, i didn't expect wifi to be good.
-
@adam-v3d the node was the DSF monitor node.
-
@adam-v3d Would you mind sharing the flow please. If you have found a new bug with the Monitor node I would like to try and track it down. I have never seen it cause a board crash, so I need to investigate.
Thanks
-
@mintytrebor Sure. flows.json