[How To] Sonoff S20 Motion Sensor mod

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
bobbybeans
Normal user
Posts: 119
Joined: 26 Feb 2017, 17:30

[How To] Sonoff S20 Motion Sensor mod

#1 Post by bobbybeans » 23 Jun 2017, 12:23

Hey guys I have been working on a project with the Sonoff S20 which I believe it would be applicable to all versions. I wanted to create a walk through an explanation of what I have done. So far I have had smashing results.
So in an effort to combine sensors so I have less plugs around. I wanted to take the S20 wall plugs and modify them. With additional sensors an it has 2 extra GPIO pins and built in power
I’ll try to explain with pictures and what not - if there are mistakes I will try to edit for correction if someone point it out

Items needed

Sonoff S20
Soldering Iron
Solder
Snips
Small amounts of wire
3d printer for the insert
Sandpaper
Mini IR Pyroelectric Infrared PIR Motion - https://tinyurl.com/y8b5ok5m

What I assume
You already have a flashed S20 with EasyESP. This saves me time to type as there are already tons of threads across the internet on how to flash it and have it configured like you want. I run r148. You can run earlier or later I would assume those work, I will not provide details of other versions.

You have also soldered a header onto the 4 pins of TX,RX, PWR and GND

Items attached
Sonoff S20 Insert STL file - It would not let me attach on the website STL not recognized format - https://ufile.io/5h70u
Config for Sonoff r148 that you can import and have it all setup ready to go - I will have to upload it later, I thought I could simply edit the txt config to remove my wifi and pass but apparently not. will have to reconfig at a later time.

My Goal – To mod the S20 to look nice and add functionally to it without losing any functionally. This means after installing the PIR sensor you can still use the button for whatever you want to program it to

First step gather supplies and 3d print the STL file, should only take a few minutes no support is needed. I printed mine in clear but you can do whatever colour. I printed with a .2 layer height with a .5 mm nozzle stepped down the extrusion in to .38 (you might as well use .4 mm n , but I was to lazy to change). You will notice in the print, you will most likely lose part of the sides about halfway up. That is ok I just designed the walls a little thin, it’ll still work

If you don’t have a 3d printer use 3dhubs.com to find someone in your area. Or I MIGHT be willing to sell them, not really to get a profit but at the bare min you’d pay for shipping and cost of plastic so I don’t lose money ( I will consider this) UK only most likely

Second Step to take your PIR sensor and remove the black pin header but leave the pins, then cut the pins with snips to about half the length. Sand the sides of the PIR a little until smooth as it is a very tight fit in the insert I made. I couldn’t risk making the insert any bigger for fear of it not either fitting or not automatically coming back after you push the button.
20170621_204218.jpg
20170621_204218.jpg (2.73 MiB) Viewed 13944 times
20170621_204310.jpg
20170621_204310.jpg (2.55 MiB) Viewed 13944 times
Third – slip 3 wires through the bottom hole of the insert you printed. Then solder the wires to the PIR and slip the PIR into the casing insert. I used those cables with ends on them already that’s why I had to do this step as they wouldn’t fit through if I soldered them before. If you have regular wire skip this step
20170622_225647.jpg
20170622_225647.jpg (2.03 MiB) Viewed 13944 times
Fourth – take apart your S20 and remove the button insert, leave the clear plastic bit that is glued in.

Fifth – take the cap off the PIR and slip it through the back of the front case then refit the cap back on the pir. It should stay in by itself with the cap being on
20170621_204327.jpg
20170621_204327.jpg (2.57 MiB) Viewed 13944 times
20170622_225723.jpg
20170622_225723.jpg (2.35 MiB) Viewed 13944 times
20170622_225628.jpg
20170622_225628.jpg (1.78 MiB) Viewed 13944 times
Sixth – take the wires and hook them to ground, power and one of the TX or RX pins or solder them. I just had ones that slotted on so I could take them off if I needed to reprogram it
20170622_225705.jpg
20170622_225705.jpg (2.3 MiB) Viewed 13944 times
Seventh – power unit up and go to advance settings and disable the serial ports, then reboot. – other option is you can upload my config to your device. You will just have to change the IP’s, wifi name and pass before you reboot. But the rest of the settings will be loaded into it then you can skip step 8 . Please note my firmware I have disabled the green LED from working in the settings tab where you select the GPIO for the LED. You can reenable it. I just don’t care for it as it is super bright at night and have a few of these in my room

Eight – go back to settings, go into devices add a switch, do not have it pulled high. Have the GPIO 1 or 3 selected depending which you chose tx or rx pin .

You will now be able to put it back together and the push button will still work, the green LED ring will still work (if you activate it) and you will now have motion sensing
In domoticz add a standard switch for motion sensing and configure it like you normally would for a switch

This has proven very reliable. I do not believe I have received a false positive yet. I have another one that uses radar to help track False Positive against the other one and both of them are bang on. The creepy thing is about the radar one is, it can detect movement in the kitchen (which is behind my wall) Both of them correlate when people get up. The PIR and radar flips at 635 every morning and ends at about 645. This is when my flatmate gets up and leaves. Then flips on again when I get up. The radar one is very sensitive it can detect my hand movements about 2 meters away when typing and trying to sit still. I will maybe write a tutorial on the radar one if there is demand for it but it’s very similar to this one.


One request I do ask if anybody is good at modelling stuff in some cad program. Could someone make an accurate 1 to 1 scale of the S20 (uk version or all of them) I want to add more sensors that would fit really nicely around the case of it, like on top etc. However I am not that good at creating exact 1 to 1 models. Could someone do that? Haha I’ll bribe you in a few 3d printed inserts for these. I just wanted to create snap on pieces for it, which I could do after a ton of time and hundreds of prototypes but a pro/someone better than me could whip it up in maybe an hour

Justblair
Normal user
Posts: 63
Joined: 08 Aug 2016, 23:42

Re: [How To] Sonoff S20 Motion Sensor mod

#2 Post by Justblair » 23 Jun 2017, 13:28

Very good. :D

LisaM
Normal user
Posts: 513
Joined: 11 Apr 2017, 18:29

Re: [How To] Sonoff S20 Motion Sensor mod

#3 Post by LisaM » 23 Jun 2017, 13:39

Looking good.

GPIO 13/15 are exposed and can be use also. Just like tx/rx they're all used at bootup time, so it is a kind of tricky. Most likely will it work almost always (but might randomly not, driving you insane). 5V is also available at the AMS1117-3.3 for use with 5V sensors

Ps. glue the sensor to the back of the S20, there's plenty of room on the bottom side of the back (depending on your wall socket).

bobbybeans
Normal user
Posts: 119
Joined: 26 Feb 2017, 17:30

Re: [How To] Sonoff S20 Motion Sensor mod

#4 Post by bobbybeans » 23 Jun 2017, 13:55

LisaM wrote: 23 Jun 2017, 13:39 Looking good.

GPIO 13/15 are exposed and can be use also. Just like tx/rx they're all used at bootup time, so it is a kind of tricky. Most likely will it work almost always (but might randomly not, driving you insane). 5V is also available at the AMS1117-3.3 for use with 5V sensors

Ps. glue the sensor to the back of the S20, there's plenty of room on the bottom side of the back (depending on your wall socket).
Where is 13 and 15 at? I didn't know about this

also didn't know about the 5v rail. This is great and will help minimize the radar project footprint

which sensor? are we talking about the motion sensor? or radar? or future sensor?
the motion PIR can't glue it else the button behind it won't work
If its the radar sensor it actually fits perfectly within the case. I am designing a clip that it will attach to the board requiring no glue to hold securly in place
for furture other sensors, I could depending what they are but I want them to look nice. I often do a bodge job and they work but look horrible. I am slowly shifting to trying to make them look nice, be robust and funtional. The one sensors I can't use reliably on the back would be light sensors and temp which is what I want to do
Temp sensors in the back I do not feel like they would be reliable in the back as no airflow and close no the electronics which would generate enough heat to trow it off a degree or two ( haven't tested this just guessing)
for light sensors -it would detect motion and if there is not enough light in the room it would flip the relay in the s20. the one I have is in the hallway that flips a string of night lights on so you can find you way to the bathroom. curretly I just have a rule in place that if its after sunset and motion is detected flip lights on. however I want it even more accurate as the hallway has no lights and even with it not being sunsut its quite dark

LisaM
Normal user
Posts: 513
Joined: 11 Apr 2017, 18:29

Re: [How To] Sonoff S20 Motion Sensor mod

#5 Post by LisaM » 23 Jun 2017, 14:23

Attach wire at red circle for GPIO15, GPIO13 can be used by taking out the green led...
s20 GPIO15.jpg
s20 GPIO15.jpg (131.18 KiB) Viewed 13917 times

padrino
Normal user
Posts: 23
Joined: 17 Feb 2019, 15:05

Re: [How To] Sonoff S20 Motion Sensor mod

#6 Post by padrino » 04 Feb 2022, 03:54

Hi,

just stumbled over this...
Seems like a very nice project and well done.👍
As the link to the STL is dead, I wonder if it's still available somewhere?

Thanks.

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests