Connecting PanelDue and Arduino to one serial port
-
Hello, its my first post here
I would love if someone could please give me a hint on how i can
connect both PanelDue and arduino to DuetWifi's serial port (the PanelDue port).
i want the arduino to acts as a sniffer for M408 Status responses while the PanelDue connected and functioning.
the arduino will control addressable led strip according to printer status.
Is there any other solution then using the micro usb port?Thanks
-
Unfortunately that is not going to be easy and usually not possible.
The UART serial ports are a 1 to 1 communication port. They work very simple: each side have an RX (Receive) and TX (Transmit) pin; the RX is connected to the other's TX and TX is connected to the other's RX so that anything transmitted by one, is received by the other.
It may be possible, since you only sniff for it. Connect the TX on the Duet, to the Arduino's RX pin - don't connect your Arduino's TX, since it is not important and should not be used (trying to write to a data line while another may be trying to write will probably destroy both).
Your Arduino needs to use 3.3V logic, otherwise it may struggle to read the 3.3V logic communication (it is very close to the threshold for HIGH and LOW on 5V logic).
Your code should then be able to read all traffic from the Duet to the PanelDue; you will need to filter out what you don't need.
This is not easy and mistakes can damage all components involved.
Another options is to use an ESP board (basically like and Arduino, with Wifi), which then connects via Wifi, and requests the information on demand. -
Sniffing should work quite easily. There is no "sharing" hardware required, beyond wire. The multiple RX hardware ports represents tiny (very tiny) loads as compared to the TX hardware port.
Hook Panel Due up normally; also connect TX on Duet to RX on Ardunio. DO NOT connect Arduino TX to anything. That's all that should be necessary.
3.3V Arduino... or a 3.3 to 5V converter to 5V arduino.
In the Arduino code, normal serial handling as built in, open the port at the baud rate the PanelDue is using, and you should immediately see characters every time the Duet sends.
-
This is kind of what I was suggesting in the other post.
If you have 2 UARTS on your arduino, put it in the middle, but you shouldn't actually need to.
If you just grab the ground and the Duet's TX pin, you should be able to read the Duet's responses to the PanelDue's M408 queries without the need for any other operations.
If you want to make sure that there is no level loss, you COULD probably use an op-amp as a buffer, which could then also manage the level shift from 3.3V at the Duet's output to 5V for the Arduino's UART. The op-amp's input resistance can be plenty high enough to ensure that there is no signal loss to the PanelDue.
You should not need to connect to the Duet's RX pin. note that doing so may mess things up, since the PanelDue sends line numbers with its gcode polling of the Duet, and you'd possibly mess up the sequencing if you inject your own instructions/queries. If you're going to do your own polling, I'd strongly suggest that you look at an arduino with 2 UARTS and insert it completely between the two.
-
@supraguy said in Connecting PanelDue and Arduino to one serial port:
This is kind of what I was suggesting in the other post.
If you have 2 UARTS on your arduino, put it in the middle, but you shouldn't actually need to.
Absolutely not needed.
If you just grab the ground and the Duet's TX pin, you should be able to read the Duet's responses to the PanelDue's M408 queries without the need for any other operations.
With a 3.3V Arduino, this WILL work. Nothing additional needed.
If you want to make sure that there is no level loss, you COULD probably use an op-amp as a buffer, which could then also manage the level shift from 3.3V at the Duet's output to 5V for the Arduino's UART. The op-amp's input resistance can be plenty high enough to ensure that there is no signal loss to the PanelDue.
Not needed for buffering the input. The RX in on the Arduino is exactly the same as that OpAmp input. Maybe even less impedance...
Absolutely not needed, unless for 3.3 to 5, and I'd use a digital level shifter for that, not an analogue op amp.
You should not need to connect to the Duet's RX pin. note that doing so may mess things up, since the PanelDue sends line numbers with its gcode polling of the Duet, and you'd possibly mess up the sequencing if you inject your own instructions/queries.
Completely agreed.
If you're going to do your own polling, I'd strongly suggest that you look at an arduino with 2 UARTS and insert it completely between the two.
Also agreed, very different use case than "sniffing".
-
@danal said in Connecting PanelDue and Arduino to one serial port:
Not needed for buffering the input. The RX in on the Arduino is exactly the same as that OpAmp input. Maybe even less impedance...
Absolutely not needed, unless for 3.3 to 5, and I'd use a digital level shifter for that, not an analogue op amp.
@Danal That's my own bias showing up. I have a box full of dual and quad op-amps ready to hand, so I tend to use them as level shifters, also the pile of arduinos that I have that I might use for a project like this are all 5V logic. I'm pretty sure that I could solder up a 3.3V to 5V TL072 buffer on breadboard in my sleep. (Or 5V to 12V, since I've done lots of those for Arduino to PC RS232) Come to think of it, I probably already have a few already in the box with the op amps.
You know what they say, if the tool that you have is a hammer, make every problem look like a nail.
I 100% agree that you shouldn't need a dual UART Arduino, but I probably would want to do more with an arduino than just control some lights, if it were me. I have my own project underway, sort of concurrently developing with a raspberry pi and an arduino to add some hardware buttons to the printer. I'm not sure which SBC I'm going to choose in the end to add 6-8 buttons and a few display functions. Probably not anything that the PanelDue won't do, but since I already have the hardware, I might as well.
-
Thank you all for your responses, i appreciate your help guys.
first will try to get a converter and use it, then i will report back -
(a few months latter)
Anybody happened to implement a PanelDue serial communication sniffer with some state extraction?