General hardware capabilities questions
-
Greetings,
I'd like to ask a very high-level question: Can the Duet be thought of as being expandable (beyond the daughter boards sold specifically for it, of course) and programmable like an Arduino, or is it not advisable to attempt to integrate new circuits or code because you would have to edit the firmware (which is something I'm definitely not interested in doing)?
My current interest is in bed leveling, so let me use that as an example : To integrate the output of 3 piezo sensors placed under the bed, I gather a circuit must be made that changes the piezo output into a simple open/closed signal. I'm guessing that signal is then fed into z_probe_in, in effect "tricking" the Duet into thinking that a single switch is being used for the z_probe.
If that's semi-accurate, what I'm wondering is if there is a way to do more in software to minimize or eliminate what needs to be done in hardware. For example, are there empty pins that can read an analog signal, and can code be (easily*) added to process the signal so that if it meets certain requirements, e.g., voltage and duration, the "open/closed" determination can be made in software instead of hardware?
*I've read that the Arduino can only run one program at a time. I assume the Duet is the same, which leads me to guess that only DuetWiFiFirmware.bin can be running on the main processor, implying that to add functionality, the firmware must be edited, unless it would automatically run other uploaded files as daughter processes.
Thanks,
James -
An Arduino that is not running any firmware already is easy to program. But if you have an Arduino that is already doing something complicated such as controlling a 3D printer, then adding a totally new function without disturbing what is already happening is much harder. The Duet is no different (actually it's a little easier, because CoreNG incorporates an ADC schedule manager, whereas Arduino doesn't). It will be easier when we switch DuetWiFiFirmware over to use a RTOS (real-time operating system), but still not trivial.
Although the Duet does have a lot of spare pins if you don't connect an expansion board, my recommendation is to use a separate processor (e.g. attiny) to convert your piezo outputs to a single digital signal. A similar arrangement is commonly used to combine the outputs of three FSRs under the bed supports of a delta printer - see e.g. https://www.ultibots.com/johnsl-fsr-endstop-board/. You could probably adapt and reprogram that board to work with piezos.
-
Great, thanks for pointing me in the right direction!
By the way, what's the sampling rate on the Duet inputs? I'm wondering how fast an on/off event needs to be before it becomes a problem in that it might be missed.
For anyone else interested in the attiny route, seems like something like this might be appropriate: http://www.mouser.com/ProductDetail/Microchip/ATTINY104-XNANO/?qs=L9xfcFkVX3c9sGQfoloaGA%3d%3d
-
That depends on the event. The analog inputs are sampled 1000 times a second.
The adafruit trinket would be another suitable hardware platform for monitoring the piezos.