Wiring a non-latching switch with LED
-
@nightowl999 said in Wiring a non-latching switch with LED:
Is that a problem? I was following the guidance provided by @burtonenator in this thread, so hopefully I haven't introduced - or imported - a typo...
I don't have a Duet 3, but based on the pin names I think the code you show is aimed at a Duet 3 mini 5+ which does seem to have both pins (i.e. a separate in & out pin on IO_0)
I can't see any input pin 0 on the 6HC mainboard and OUT0 appears to be a high current output with an external supply.EDIT:
There is an IO_0 on the 6XD -
@owend
I was going to use this io0.in and .out, and I'm pretty sure @burtonenator is using a MB6HC and it worked for him. -
@nightowl999 said in Wiring a non-latching switch with LED:
I was going to use this io0.in and .out, and I'm pretty sure @burtonenator is using a MB6HC and it worked for him.
Couldn't see for looking.
That should be fine then. -
@owend
Whew! Thank you -
I need to extend this question a bit...
The external switch I'm using to activate the pause.g and resume.g macros during a projectworks really well, even turning on/off the LED within the switch - thank you @burtonenator!
But the LED in the switch is 12V, so I sourced some 5V white LEDs to replace it, but that's pretty dim too, so I'm guessing the 5V supply at the io_n pins doesn't provide much in the way of current to drive the LED, which is fair enough.
The momentary switch is connected across the io0.in and GND, and the LED across the io0.out and 5V.
As an alternative, I was thinking of reverting back to a 12V LED and use one of the Out4-6 headers instead. The current (haha) configuration is this:
; Extract from config.g M950 P8 C"!io0.out" ; create output/server port 8 on inverse io0.out global PausePress = false ; LED code in pause.g and resume.g files M42 P8 S0 ; pause/resume LED off set global.PausePress = !global.PausePress ; toggle the value from whatever it was before ; trigger2.g echo "called at " ^ state.time G4 S1 ; delay 10ms to debounce if sensors.gpIn[9].value=1 echo "debounce" M99 ; break out if sensor value is zero again (bouncing) if job.file.fileName !=null ; if there's a job filename then it's reasonably safe to say we are printing if global.PausePress == false ; the button hasn't been pressed so we'll pause echo "Pause" M25 ; pause the current toolpath else echo "Resume" ; resume the current toolpath M24
Assuming it would be OK to power an LED from one of the Out4-6 headers in the first place (please tell me if it's not!), wouldn't it just be a case of supplying 12V from there to the LED?
Failing this, I could use a relay and an external 12V supply.
I'm still using the Duet3 MB6HC powered via a 24V PSU, with RR 3.4.1 firmware and DWC 3.4.1.
Thanks
-
-
@owend said in Wiring a non-latching switch with LED:
The Output pin you choose may or may not have the capacity to drive the LED(s) directly (depends on what you're connecting). Refer to the specifications and if necessary either run it off a fan output or supply an external power source to the LED which you can control with the I/O via a mosfet module or similar.
So I'm going to go down this route after all. I've ordered a batch of mosfet modules, due to arrive today, which will help me sort this out.
Looking at the connection diagram for this though, am I correct in thinking I could now ignore the io0 voltage pins and connect the MB6HC io0.out and GND pins to the VCC and GND pins on the mofset module (which means the io0.in and io0.out would share the same GND pin)...
...and still use this configuration code in the config.g file:; Pause LED M950 P8 C"!io0.out" ; create output/server port 8 on inverse io0.out
...and this in the pause.g and resume.g files:
M42 P8 S0 ; pause/resume LED off set global.PausePress = !global.PausePress ; toggle the value from whatever it was before
Connecting the supply and outputs from the module are straightforward, thankfully!
Thank you
-
@nightowl999
No, looking at that layout you will use the 3.3v to VCC and GND to GND
io0.out to signal.
VIN is your external power source. -
@nightowl999
I don't have a duet3 but there are a number of higher output options on them.
OUT3-OUT7
They also support 12v internally and external voltages by jumper selection.
I suggest you read the docs on fan configuration and using a fan header as a gpio.
You may not need a mosfet module -
Thank you @owend
I'm going to use the mosfet just to switch the power to the LED on and off, and I understand the VIN/GND and V+/V- connectivity.
What I didn't understand is the way to connect the mosfet to the i/o port on the MB6HC, but you've made that clear, but I'd like to understand something...
In an earlier post, it was suggested I could connect the io0.in and GND for the switch and (possibly) io0.out and 5V for the LED. As I'm now using an external, independant power supply for the LED, is it because the mosfet needs the 3.3V/5V to power it?
I'd assumed (wrongly, it seems) the io0.out and GND would work to activate the external 'switch' within the mosfet, in reverse to the way the external switch activates the MB6HC's 'switch' io0.in and GND, and why I was asking if I could use the same GND.
I'm using 5V LEDs, so the using OUT3-7 isn't an option, but I do have fans configured from OUT7 - I try not to be lazy and look this stuff up first, but it's not always written for the technically challenged user, to be honest!
-
@nightowl999
The mosfet module is essentially another plc (as opposed to a mosfet which is a single component)
It requires power for the logic circuit and a signal to tell it when to open/close the gate. -