You have a Sonoff Basic R2, which is why GPIO 14 was not found. The older ones don't have the large black wires for the mains current. The GPIO 2 pin with cause a boot failure if it is held low when the unit is powered on. I've done several with the external switch connected to the RX pin (GPIO3). Programming was easy using Hpme Assistant and ESPHome. Using GPIO3 (RX) will let you use a toggle switch, for example, a standard light switch. You just have to flash it before soldering on the switch wires. The program can be updated over-the-air so the serial connections won't be necessary after flashing.
I would have just gone Tasmota on that. It comes with a UI for the web, can be direct driven by URL Post commands. The default button is an on/off by default as well. The external switch is a useful addition for your use case though.
I looked into tasmota a bit, but they focus so much on the MQTT / home assistant stuff that I never found that info. After several people mentioned that there actually is a web interface I finally found it buried deep in the project's web pages. Oh well, this was a fun challenge. And I learned some stuff.
@@pileofstuff MQTT is a great way to communicate with these. Tasmota does have a lot of Home Assistant fans, so it is easy to get lost in the documentation. Home Assistant seems to be popular :)
@@pileofstuff One day I will get you on Node-red and MQTT. I think you'll genuinely love it...but this was a good project in its own right and I learned some stuff along the way.
Itead also have a Zigbee version of this. Most of the Itead WiFi stuff is highly hackable as they are based around the ESP8285 chip, which is pretty well an ESP8266 with 1mb RAM onboard. They are a really great devices. Very popular with "Makers." The SonOff Mini is also great if you have less space. You can modify the SonOff Basic t0 be a dry contact relay as well. I use one with Tasmota as a "smart" thermostat.
Neat lighting on your Ender 3. I did similar, instead running a strip inside the bottom-facing v slot of the top rail. I also placed a short strip directly onto the hotend cover to illuminate under there. I still haven't gotten around setting up Octoprint, but I have all the parts to get it working.
The Sonoff S31 has regular AC receptacles, and does Kill-a-watt-like power monitoring, which I've seen used for interesting things like detecting when the washer's done by the drop in power draw. An interesting member of the Sonoff family (I'm using with Tasmota and Home Assistant).
btw, the s31 is not supported by the sonoffs web interface still , cant even be turned on or off . the camera cant trigger a scene like they say it can. and ittt support is usless unless you want to pay for iftt and the advancded sonoff subscribion
I have about 6 running tasmota connected in the power cord, the lights don't have an earth so wiring is easy. I've also go two in 6gang extension leads. I just cut the outer cover of the cord away, cut the L and N then run the earth over the top of the pcb. This way you don't need a connector on the earth to find room for in the box. Nice beer.
Thank you for your time and nice video. I would assume Tasmotizer tool would be much easy to set up your GPIO pins. Haven't tried with ESP tool to flash the chip yet. May do it sometimes. Sorry I missed how you connected the push button switch to the R2 device. Would assume you wired one end to GPIO2 where you connected 10K Ohm between GPIO2 to 3V3 pin. Then the other end of the switch wired to the GND pin. If that is what you did, I would like to give a shoot. This will be a cool to use the R2 to control a light through App/HA or a physical switch button. Thank you.
The button on the sonoff originally is programmed to manually turn the unit on/off. Cool that you were able to add a second switch and enclose it in an electrical box and I don't blame you for not wanting to use the factory software. Security concerns aside, seems a little strange to send the commands all the way to China and back if you don't need to access over the internet
Yep. But it can be handy to have some internet-accessible server if you want to control it from your mobile phone, for example when that is not on your wifi but using 4G for its connection. Also when at your own home. I really like this idea though and simply use the webbrowser while on local site!
Hi - You should flash these Basic units using Tasmotizer. The R2 also has a switch built in. I also run Octoprint with the tasmota plugin which allows you to switch everything off from the octoprint webpage. I have all of this setup on my printer for the last few years and works perfectly.
I'm doing something very similar to this only in hacking a smart bulb for fun. I picked a difficult one on accident because it's RGB seems to be set via a serial protocol. But I have control over the white right now. I want to write it myself in Arduino for learning and just need to tap it's direct programming lines as it's esp8255 based (esp8266 with less flash) but otherwise I should be good to go.
This might be useful for me as a basement workshop hazardous (mainly thermal) kill switch and double checker, like if I was using hot air or a hot plate, I want to keep certain appliances like that on a dedicated power bar I can switch off upstairs if I forget and maybe have it semi-automated where I know I only need the stuff for a few hours so I set a 6 hour power strip shut down timer and have it protect me from myself
Fantastic work. It really never crossed my mind to try to program that thing directly. I've flashed tasmota on them and that's pretty cool, but I could really see some benefit to running fully custom code. I need to make some ESP8266s that are directly powered by AC and this may be the way to go. Thank you.
probably 100% uslsess, but i wonder if the espixel firmware or similar could run on these. it has 1 pin of io and thats all you need to drive ws2211........ it may even be able to power small strips
14:20 "Hey, it's uploading". I actually got a laugh out of this. Nothing ever works for me first time even if I do follow the instructions (or think I have). It always seems to take some phutzing around and alignment of the planets before I work out what the secret sauce is.
Point to note. You had some issues after programming with it doing funny things. You still had the UART dongle connected. There's a very good chance that dongle won't be providing enough power to run the wi-fi. I've had this issue before at least. After connecting the mains is worked fine
I kinda followed along but my OCD got hung up on that 12V relay. Where do its coil contacts go on the board? Are you just supposed to kludge 12V in from the outside world?
@@pileofstuff Were they ment to be switching something on 12 V like in a car? Easy to hook up 12 Volt from that for the relais and have the other end of the coil be switched by fet or transistor or even optocoupler but a bit hash to directly link to a GPIO-output
Note: If you select the D1 Mini as a board you can just use Dx directly in code like "byte relayPin = D5" So no need to add that conversion in the comments. And you can just use the button on the Basic to do the toggle. That's what the stock firmware does as well. And an ESP does come with internal pull up's on most of it's pins just like a basic Arduino ;) Also, Tasmota i still VERY usable without Home Assistant. I would certainly check it out because you could have done all this with Tasmota as well without a line of code ;)
I though about using the built-in button, but I didn't feel like messing with extending it outside the case. Some days I have an odd mix of laziness and doing pointlessly hard things...
I dont see point in these things. I thought sonoff can be controlled thru any internet. My home is in city A and i want to control my light from city B. It means I cant do that? It only works in local server. That sucks
All very good, but you do know you could have done the same thing with just one of those relays and one GPIO pin on your Raspberry Pi? There's an Octoprint plugin that adds a power button on the Octoprint web server, took me about ten minutes to set everything up and cost virtually nothing to implement. K.I.S.S.
You leave it on. Just log into Octoprint, upload a file, pre-heat and print, when it's done, you just turn off the printer again (there's probably a plugin that will do this automagically by now, but I prefer to do it manually), job done. Mine's been on non stop for nearly two years without any issues. Costs virtually nothing to run.
@@ste76539 That's an option, but where mine is it gets unplugged by other people sometimes, so I prefer to shut it down properly when I'm not using it.
Well done for spending all that time and going down the rabbit hole only to find it goes a lot deeper than you expected.
Holy crap! This is what I need in my life! This is an awesome project and I can see it being expanded to so many things!
I think I have 8 of them running lights, fans and water taps for gardening. Regular plants... Not Weed.
Great project, and for those naysayers saying that version of pi doesn't work, I guess you proved them wrong. Great setup and idea.
I still would recommend that people use the supported hardware, but in my case I use the most basic feature s so I don't overload the poor little guy.
This is awesome, I just used two of these in my latest video! Thanks for the tutorial :)
You have a Sonoff Basic R2, which is why GPIO 14 was not found. The older ones don't have the large black wires for the mains current. The GPIO 2 pin with cause a boot failure if it is held low when the unit is powered on. I've done several with the external switch connected to the RX pin (GPIO3). Programming was easy using Hpme Assistant and ESPHome. Using GPIO3 (RX) will let you use a toggle switch, for example, a standard light switch. You just have to flash it before soldering on the switch wires. The program can be updated over-the-air so the serial connections won't be necessary after flashing.
I would have just gone Tasmota on that. It comes with a UI for the web, can be direct driven by URL Post commands.
The default button is an on/off by default as well. The external switch is a useful addition for your use case though.
I looked into tasmota a bit, but they focus so much on the MQTT / home assistant stuff that I never found that info.
After several people mentioned that there actually is a web interface I finally found it buried deep in the project's web pages.
Oh well, this was a fun challenge. And I learned some stuff.
@@pileofstuff MQTT is a great way to communicate with these. Tasmota does have a lot of Home Assistant fans, so it is easy to get lost in the documentation. Home Assistant seems to be popular :)
@@pileofstuff One day I will get you on Node-red and MQTT. I think you'll genuinely love it...but this was a good project in its own right and I learned some stuff along the way.
Itead also have a Zigbee version of this. Most of the Itead WiFi stuff is highly hackable as they are based around the ESP8285 chip, which is pretty well an ESP8266 with 1mb RAM onboard.
They are a really great devices. Very popular with "Makers." The SonOff Mini is also great if you have less space. You can modify the SonOff Basic t0 be a dry contact relay as well. I use one with Tasmota as a "smart" thermostat.
Neat lighting on your Ender 3. I did similar, instead running a strip inside the bottom-facing v slot of the top rail. I also placed a short strip directly onto the hotend cover to illuminate under there. I still haven't gotten around setting up Octoprint, but I have all the parts to get it working.
The Sonoff S31 has regular AC receptacles, and does Kill-a-watt-like power monitoring, which I've seen used for interesting things like detecting when the washer's done by the drop in power draw. An interesting member of the Sonoff family (I'm using with Tasmota and Home Assistant).
btw, the s31 is not supported by the sonoffs web interface still , cant even be turned on or off . the camera cant trigger a scene like they say it can. and ittt support is usless unless you want to pay for iftt and the advancded sonoff subscribion
I have about 6 running tasmota connected in the power cord, the lights don't have an earth so wiring is easy. I've also go two in 6gang extension leads. I just cut the outer cover of the cord away, cut the L and N then run the earth over the top of the pcb. This way you don't need a connector on the earth to find room for in the box. Nice beer.
Thank you for your time and nice video. I would assume Tasmotizer tool would be much easy to set up your GPIO pins. Haven't tried with ESP tool to flash the chip yet. May do it sometimes.
Sorry I missed how you connected the push button switch to the R2 device. Would assume you wired one end to GPIO2 where you connected 10K Ohm between GPIO2 to 3V3 pin. Then the other end of the switch wired to the GND pin. If that is what you did, I would like to give a shoot. This will be a cool to use the R2 to control a light through App/HA or a physical switch button. Thank you.
The button on the sonoff originally is programmed to manually turn the unit on/off. Cool that you were able to add a second switch and enclose it in an electrical box and I don't blame you for not wanting to use the factory software. Security concerns aside, seems a little strange to send the commands all the way to China and back if you don't need to access over the internet
Yep. But it can be handy to have some internet-accessible server if you want to control it from your mobile phone, for example when that is not on your wifi but using 4G for its connection. Also when at your own home.
I really like this idea though and simply use the webbrowser while on local site!
Hi - You should flash these Basic units using Tasmotizer. The R2 also has a switch built in. I also run Octoprint with the tasmota plugin which allows you to switch everything off from the octoprint webpage. I have all of this setup on my printer for the last few years and works perfectly.
Flash it with Tasmota and you get everything you want and lots more
That is an option.
I feel that I learned more doing it this way, though.
I used the dual switch plastic boxs for my SonOffs. Left plenty of room for reset and pushbuttons.
I looked for those, but as I said, plastic electrical boxes are not very common here.
@@pileofstuff Got mine at Home Hardware.
@@DrexProjects Didn't try there - the closest one is quite a distance away.
@@pileofstuff Oh ya st. b is miles from nowhere.
Well done
Those Back box's don't exist in the UK which is a shame as they look so useful!
The Tasmota FW is one of the best options for these units.
I mostly did this for the challenge and the learning.
@@pileofstuff I figured as much, just wanted to give you something to add easy functionality if you decide to extend your Home Assist. network...
I'm doing something very similar to this only in hacking a smart bulb for fun. I picked a difficult one on accident because it's RGB seems to be set via a serial protocol. But I have control over the white right now.
I want to write it myself in Arduino for learning and just need to tap it's direct programming lines as it's esp8255 based (esp8266 with less flash) but otherwise I should be good to go.
This might be useful for me as a basement workshop hazardous (mainly thermal) kill switch and double checker, like if I was using hot air or a hot plate, I want to keep certain appliances like that on a dedicated power bar I can switch off upstairs if I forget and maybe have it semi-automated where I know I only need the stuff for a few hours so I set a 6 hour power strip shut down timer and have it protect me from myself
Fantastic work. It really never crossed my mind to try to program that thing directly. I've flashed tasmota on them and that's pretty cool, but I could really see some benefit to running fully custom code. I need to make some ESP8266s that are directly powered by AC and this may be the way to go. Thank you.
probably 100% uslsess, but i wonder if the espixel firmware or similar could run on these. it has 1 pin of io and thats all you need to drive ws2211........ it may even be able to power small strips
@@grimninja2004 I may have to check that out!
14:20 "Hey, it's uploading". I actually got a laugh out of this. Nothing ever works for me first time even if I do follow the instructions (or think I have). It always seems to take some phutzing around and alignment of the planets before I work out what the secret sauce is.
i realize I'm kinda randomly asking but does anybody know a good website to watch newly released tv shows online ?
@Edgar Castiel I watch on FlixZone. You can find it on google =)
Point to note. You had some issues after programming with it doing funny things. You still had the UART dongle connected. There's a very good chance that dongle won't be providing enough power to run the wi-fi. I've had this issue before at least. After connecting the mains is worked fine
I kinda followed along but my OCD got hung up on that 12V relay. Where do its coil contacts go on the board? Are you just supposed to kludge 12V in from the outside world?
No idea. I'll have to dig deeper when i have time.
I suspect those relays are simply the wrong ones.
@@pileofstuff Were they ment to be switching something on 12 V like in a car? Easy to hook up 12 Volt from that for the relais and have the other end of the coil be switched by fet or transistor or even optocoupler but a bit hash to directly link to a GPIO-output
@@elvinhaak The problem, as I see it, is there is no way to get 12 volts onto the board.
If you clean up too much you find yourself changing channel name to neaterpilesofstuff 😏
Great project 👍
Hi, a relay connected to pi gpio can do the same. There are a script to do it on octopy
It can turn everything off, but it can't turn the Pi itself on remotely.
Did you just say "Snot-soldered" @17:42? Every time I tack-solder something, henceforth it shall be called "snot-soldered".
Maybe...
Note: If you select the D1 Mini as a board you can just use Dx directly in code like "byte relayPin = D5" So no need to add that conversion in the comments. And you can just use the button on the Basic to do the toggle. That's what the stock firmware does as well. And an ESP does come with internal pull up's on most of it's pins just like a basic Arduino ;)
Also, Tasmota i still VERY usable without Home Assistant. I would certainly check it out because you could have done all this with Tasmota as well without a line of code ;)
I though about using the built-in button, but I didn't feel like messing with extending it outside the case.
Some days I have an odd mix of laziness and doing pointlessly hard things...
I dont see point in these things.
I thought sonoff can be controlled thru any internet. My home is in city A and i want to control my light from city B. It means I cant do that?
It only works in local server. That sucks
A nice video and fun to watch tell the truth did teenager help a tad with the code:-)
It was the other teenager.
All very good, but you do know you could have done the same thing with just one of those relays and one GPIO pin on your Raspberry Pi? There's an Octoprint plugin that adds a power button on the Octoprint web server, took me about ten minutes to set everything up and cost virtually nothing to implement. K.I.S.S.
I thought about that, but i couldnt figure out how to use the Pi's GPIO to remotely turn the PI on.
You leave it on. Just log into Octoprint, upload a file, pre-heat and print, when it's done, you just turn off the printer again (there's probably a plugin that will do this automagically by now, but I prefer to do it manually), job done. Mine's been on non stop for nearly two years without any issues. Costs virtually nothing to run.
@@ste76539 That's an option, but where mine is it gets unplugged by other people sometimes, so I prefer to shut it down properly when I'm not using it.
Nice. But I prefer a switch I can just turn on and off without relying on a computer or WIFI conection..
I'm trying to reduce the number of times I have to run up and down the stairs.
My knees arent getting any younger...
@@pileofstuff - Well, most people just switch things on when they go upstairs, and switch them off before they come down!