-
1Flash Sonoff with Micropython and connect
Pry open case and solder on the 5 pin male header. Follow the offical docs to see details for most of the software stuff: https://docs.micropython.org/en/latest/esp8266/tutorial/intro.html
On your computer, install esptool.py and download the latest micropython build.
Connect with ttl cable to the new header, see the pic for pinout.
To enter flash mode, hold the button when pluging in the usb. You may need to install drivers (https://www.adafruit.com/product/954)
Erase the flash (esptool.py -p COMX erase_flash). Unplug usb, hold button, plug back in.
Flash firmware (esptool --p COMX write_flash -fs 1MB -fm dout 0x0 esp8266-20XXXXXX-vX.X.X.bin).Install Putty and connect to the repl (select serial, enter your COM port, default baud rate is 115200)
At the >>> prompt type "import webrepl_setup". Follow the prompts to turn on webrepl and set a password.
Unplug the usb, plug it back in (no need to hold button)
In your browser, to go http://micropython.org/webrepl/
Connect your computer's wifi to MicroPython-XXXXXX access point. On the website, click "connect". Enter your password when prompted. Upload your main.py file under "Send a file".
Good job, you're now connected via the webrepl, and you won't need the ttl cable anymore to make updates. Disconnect the webrepl and unplug the ttl cable.
-
2Build out the system
Cut the extension cord in half and strip the ends. Install cord grip in box with reducers if needed.
Solder wires to female header (see pic for pinout). Plug in header and feed wires out of Sonoff case. Make sure wires are marked on other end.
Close up Sonoff case and put in the box. Feed wires out box through cord grip, feed in output end of extension cord through same cord grip. Wire in these output wires on the output screw terminal.
Feed in input end of extension cord through the other cord grip. Wire in these input wires on the input screw terminal.
Tighten both cord grips and install the lid.
Crip on the ring terminals on open end of the thin wires. You only need three wires (one ground, two inputs), but I ran four wires to have a spare input. I added some solder to make them more secure.
Now make the level sensor. Cut all-thread to the appropriate lengths. Two pieces should reaching from the top of the tree stand to the lowest point you think the water should go. Add about 1" above the stand. Mine ended up being 5.5". One more piece reaching below stand screws, plus 1" above. Mine ended up being 3".
Drill holes in paint stick about 3/4" apart big enough for all-thread to go through. Feed the all-thread in holes, putting nut & washer on both sides. See pic.
Test fit level sensor in tree stand to ensure levels are correct, adjust if needed.
Place ring terminals on all thread, making sure the ground is on one of the long ones. Secure them with another nut on top.
Test it. Plug it in and connect to the access point again. Connect to the webrepl as you did before.
-
3Final install
Once the tree is up, place this all at the base. Fill up water pick reservoir with water. Plug in the water pick to output end of the extension cord and place the pick in the tree stand. Place water level sensor on the tree stand. Plug in the device to the wall, and if there is no or low water in the tree stand it should start and run until it reaches the high level or times-out. Fill stand with water manually to ensure it shuts off properly.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.