LED control via Octoprint?

If this is the wrong section please let me know and I will move.
I am thinking of setting up a webcam with my octoprint. I will need to control LED lights in order to see what is printing. My thought for this set up is the wire 12v DC lights from an inverter to a 3-way 12v switch. One position on the switch with direct on, so that if I am standing next to the printer I can turn the lights on and off. I want the other position to be wired in such a way that the circuit is controlled by the Raspberry Pi. I am wondering the following (there may be other things I am not thinking of)

  1. Is there a USB dongle that I can use to plug into the Pi that can power the LEDs on and off?
  2. Is there a way I can a button on the interface to turn the lights on and off when viewing remotely?
  3. Can I set up the software to turn the lights on automatically when I switch to the camera view?

Hi @BC320!

You can do this by using the Enclosure Plugin.
The LED can be switched on and off by a conventional or a solid state (MOSFET) relay.
Also o yo can attach a switch or a button to turn the lights on and off.
This is all realized with the GPIO pins of the Pi.

For switching on the light on (camera) demand, you can get more info here:


Hi Ewald,
This is exactly what I am looking at doing now, I have seen the "Enclosure Plugin" and plan on using that to control the lights, but I have never created a circuit or used a "MOSFET" in my life. Are you aware of a how to guide that could take me through the steps of building the circuit and setting everything up?
Thanks

Good luck. I never figured it out. Just tapped into my PSU and added a manual switch.

If you're still interested, this is a fairly well done tutorial for LED control using mosfets:

I just thought of a simple way for the led lights. I an using TP-Link plug to control my printer so going to just plug the led light in the same plug by adding adapter. Same outcome you only want the lights in when printer is on.