Case for 4-channel USB relay and USB power connections
Obliczymy ostateczną cenę na podstawie wybranego pliku. Sprawdzisz ją i zaakceptujesz przed płatnością.
Zapisane na tym urządzeniu.
Case for 4-channel USB relay and USB power connections to control my 3d printer enclosure fans/lights.
- Ocena
- 0 / 5
- Polubienia
- 5
- Pobrania
- 48
- Wydruki
- 1
- Wyświetlenia
- 478
- Oceny
- 0
Aktualizacja u źródła:
Informacje o modelu
- Źródło
- Printables
- Kategoria
- Electronics
- Licencja
- Creative Commons — Attribution — Noncommercial — Share Alike
This is my solution to controlling the lighting and fans in my enclosure. My parts:
- 4-channel 12V USB Control Switch Relay Module
- 10pc 2.0 USB-A breakout boards (only need 4, though)
- Adjustable power supply converter
- 12volt power supply (I had one of these just laying around)
The relay board fits snugly into the bottom of the case. The 4 USB ports are screwed into the top (I used just one 3mm screw/connector). I then wired in a power step-down converter and adjusted it's output to 5V (need a small Philips screwdriver and a multimeter).
Run the ground (negative/black) from the power step-down module to the ground on all four of the USB boards. Run the positive (red) from the power step-down module to the input (COM1/2/3/4) on each of the relays and then another wire from the relay “on” (NO1/2/3/4 - “normally open”) port to the positive on each USB board.
The front USB cable connects to my Raspberry Pi running Octoprint.
Then I installed Jan Dittberner's “usbrelay” program by simply running:
# sudo apt install usbrelay
Running “usbrelay” will display any USB relay boards it finds and the values to turn each port on and off (the “QAAMZ_” at the end):
$ usbrelayDevice Found type: 16c0 05df path: /dev/hidraw0 serial_number: Manufacturer: www.dcttech.com Product: USBRelay4 Release: 100 Interface: 0 Number of Relays = 4QAAMZ_1=0QAAMZ_2=0QAAMZ_3=0QAAMZ_4=0
Using this, I've written scripts like “light_1_on” and “fan_1_off” etc. to turn the ports on and off. In my case, light_1_on is simply:#!/bin/bashusbrelay QAAMZ_3=1 2>/dev/null
I also wrote “toggle" scripts that are just slightly more complicated - here's “toggle_light_1”:
#!/bin/bashexport PATH=$PATH:$HOME/bin
STATE=usbrelay 2>/dev/null | grep QAAMZ_3 | sed 's/.*=//'if [[ "$STATE" == "1" ]] ; then light_1_offelse light_1_onfi
Using these scripts along with event triggers in Octoprint, the lights in my enclosure automatically turn on at the start of a print. At the end, the fan turns on. After 10 minutes the fan turns off and 5 minutes after that the lights turn off.