How should we control and connect an Arduino with Duet Wifi 2?
-
adruino sbc headers output
-
What are you looking to accomplish?
-
We are looking to control any unused or expansion pins as I/O pins in order to tell the Arduino when to run and receive feedback back to the duet.
What's the best approach, should we try to remap the pins in the firmware, or simply use the current mapping and gcodes for different purposes? -
Still unclear as to the goal, which will affect the answer.
Because the answer to the way you asked it in the first post could easily be: Connect them with a piece of wire, if it is a 3.3V Arduino, and with a wire that passes through a Level Shifter, if it is a 5V Arduino. That's probably not very helpful...
What does "When to run" mean? or "receive feedback"? Can you give one or two examples?
-
Well, that's vague...
Assuming that you want to be able to tell an external Arduino when something happens, it will kind of depend on what events you want to signal, as well as what I/O you want to talk to the duet about.
I'm looking at doing a few external things with an Arduino myself, like adding some "on printer" controls (Baby stepping, possible direct axis control, homing, manual mesh leveling) probably with something like a RepRapDiscount 2004 controller (Since I have 2 or 3).
In my case, I'm pretty sure that the way that I'll do that communication is via the PanelDue port as serial communication, and configure the spare Arduino to send gcode over serial.
If you are doing that, I'm sure that you could insert gcode into the config.g file to send a "hello" message to the PanelDue port, which your other arduino could listen for and then begin whatever other code you want it to run. whether you could get sufficient communication this way I guess depends on what information you want your other arduino to monitor, and what kinds of things it needs to tell the Duet that it has managed. Some things will be easy enough to monitor over the serial line, other things might require a hardware trigger, though configuring the Duet to send such triggers might be a trick.
-
Thank you for the thoughtful responses. We ideally wouldn't need the Arduino if we were able to control all of the expansion pins with C like the Arduino. Is this possible? That would help us decide which path to choose.
-
You can control unused i/o pins using the M42 GCode command, see https://duet3d.dozuki.com/Wiki/Using_servos_and_controlling_unused_IO_pins. Does that help?