Saturday, March 14, 2020

Woods WiOn 50055 Trigger & Sensor (For Ocotpi)

I was given a Creality CR-10S, and use OctoPi to control the printer.

I wanted to be able to have OctoPi power on and off the printer.

Modifying the Woods WiOn 50055 outlet is perfect for me:
  • Has USB ports to power the Raspberry PI 3 B+.
    • I did learn that I need to use 20AWG usb cables.  The voltage drop on the 28AWG cords that come with everything has too large of a voltage drop.
  • Has an internal switch, and status LED.
  • I can also control it remotely, via WiOn's app.
Finished External Modification: (3.5mm Jack)

I decided to accomplish this by interacting with the WiOn's (ESP8266) GPIO ports that interface the momentary push-button, and power indicator LED.  I could have done it by writing custom firmware for the device, but I didn't want to rely on a network being available.

The USB power supply, and the ESP8266 inside this device do not share a common ground, so I opted to use a NTE Electronics NTE3086 Dual Optocoupler.  Probably good idea to do this, none the less.

Even though this was designed with a Raspberry PI in mind, there is no reason why you couldn't use this with any other circuit that supplies 3.3VDC.  I've also tested the trigger with 5VDC.

The WiOn toggles power on the release of the momentary switch (LOW to HIGH). That translates to HIGH to LOW on the LED side of the optocoupler.


Schematic:


 Circuit On StripBoard:

Ended up just using StripBoard because the circuit was so simple.

3.5mm to Dupont connector for Rasbperry PI: 


OctoPrint PSU Control Settings:

Software:
OctoPrint
PSU Control


Trigger Portion:
I opted to use GPIO 17 for Trigger.  PSU Control allows you to call a Python program to control power. 

Python Code:
## Using GPIO 17 (BCM) to toggle the WiOn device on and off.
## WiOn trigger toggles on Hight to Low.

## Import GPIO library
import RPi.GPIO as GPIO
import time
GPIO.setwarnings(False)

GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
GPIO.output(17, True)
time.sleep(1)
GPIO.output(17, False)


Thw follow screen is where you set up switching and sensing.  You can see where I call my Python program.

I opted to use GPIO 04 for Sensor.  This GPIO pin is pulled up internally with a resistor.  The optocoupler pulls it down whenever the WiOn's power LED is illuminated.

OctoPrint PSU Supply Settings:

You may be interested in my older programming based WiOn entry:
Woods WiOn Indoor Wi-Fi Outlet Modification (Amazon Echo Too!) 

No comments:

Post a Comment