Motion sensor and deep sleep mode questions

Moderators: grovkillen, Stuntteam, TD-er

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

Motion sensor and deep sleep mode questions

#1 Post by bobbybeans » 11 Jul 2017, 14:41

Hey Guys
I have a few questions about deep sleep mode/how to wake it up/ power requirements
and how do you set up motion devices in domoticz
I just bought a wemos pocket link below
https://www.aliexpress.com/item/Wemos-e ... 44cc2f6f54

a SW-420 Normally Closed Alarm Vibration Sensor
a INA219

What I would like to do is put a battery in this and put it into deep sleep mode and attach it to my door. Once it detects vibration it send a signal to a motion detector on domoticz to track open and close of door. I would like to avoid adding a power cable as I have no power sockets near by that's why I bought this all in one item

a few question I have on this
looking at the sw 420 circuit I think I'll have to take the LEDs off as they will continually drain the battery even in deep sleep mode. Even after I remove the leds I believe this item will draw power. Can anybody with more circuit knowledge than me confirm that? I can’t really find any docs on this.
This is not just the module itself. It contains the board and a chip as well. If it does drain even without being active, is there anyway to prevent this or at least cut down the requirements

How would I hook this up to wake up the esp8266? would it break pin 16? - to add to this should I have purchased a normally open vibration circuit so that it would break the pin (close it so it wakes up upon movement) to take it out of sleep

For the INA219 I wanted to monitor the battery voltage just to get a general idea of when I will have to charge it so I can send an alert to my phone to go charge it. I know this would be possible on this device but also if I understand this circuit right it, it has a resistor to somehow calculate the battery. This is continually bleeding off the battery even in deep sleep mode. Is that correct? If so any way to prevent that?
I was thinking of adding a transistor so when the esp is awake it would flip on and allow current through, it would measure it really quick then flip off then sleep. When off it wouldn’t slowly bleed the battery, saving the battery, is this a viable solution or would the transistor skew the results?

Ok last question, for those who use domoticz. I have some motion switches currently setup and they are working. I just add a dummy switch then every time one of the devices detect motion sends it to domoticz and domoticz “turns on” the motion detector. I find this a little clunky as a motion detector doesn’t need to be a switch. I get that it goes high and low. Is there any type of dummy switch that I can do just for logging and not an actual switch but also changes the small icon back and forth? do you guys have it setup in a different and better way?

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: Motion sensor and deep sleep mode questions

#2 Post by Drum » 14 Jul 2017, 15:48

On the vibration sensor, I think you need a power supply with a shutdown pin and a timer circuit. The sensor triggers the timer circuit which applies voltage to the shutdown pin causing the ESP8266 to boot, when the timer runs out, the pin is pulled low causing the power to shut off. Use MQTT / Mosquito and node-red to track when it triggers and the voltage on the ina219.

Check on Scargil Tech Blog, https://tech.scargill.net/ he has done a lot of this and has a nice script to install everything on a raspberry pi. I have been using this setup for 6 months and it works well and you can set up notifications or dump into a sqlite database.

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

Re: Motion sensor and deep sleep mode questions

#3 Post by bobbybeans » 17 Jul 2017, 20:48

Drum wrote: 14 Jul 2017, 15:48 On the vibration sensor, I think you need a power supply with a shutdown pin and a timer circuit. The sensor triggers the timer circuit which applies voltage to the shutdown pin causing the ESP8266 to boot, when the timer runs out, the pin is pulled low causing the power to shut off. Use MQTT / Mosquito and node-red to track when it triggers and the voltage on the ina219.

Check on Scargil Tech Blog, https://tech.scargill.net/ he has done a lot of this and has a nice script to install everything on a raspberry pi. I have been using this setup for 6 months and it works well and you can set up notifications or dump into a sqlite database.
Thanks for the reply. I will see if i can buy a timer circuit or some sort. I just worry about adding stuff to projects like this as 1 item can drain the battery quickly.
The INA219 if i understand it right it measures voltage across it using a resistor. The circuit itself uses 1ma via here http://www.ti.com/lit/ds/symlink/ina219.pdf but what about the resistor does anybody know? surely that has to burn some? because just the circuit alone would last less than 90 days
battery 2000mah at 1 mah is 2000 hours / 24 is 83 days right?. This is not including the resistor and ESP

Unfortunately I am just using the basic interface and not mqtt because I have tried about 15 different webpages and I can NOT get mosquitto to start up automatically. I have tried so many different helps and forums but to no avail. every time I have to login and do mosquitto -d

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: Motion sensor and deep sleep mode questions

#4 Post by Drum » 17 Jul 2017, 22:37

The ina219 will only give a reading when the eap is active, and from your question you want the esp to boot when triggered by the motion sensor. Eap and ina219 draw very little power in deep sleep.

The problem you will have is the motion sensor needs to be on all the time.

Hmmm, IKEA has some small round motion sensor lights. They work really well on 3 aaa batteries and stays on for less than 30 seconds when triggered. It only comes on when it is dark but has a light sensor which could be covered. I will have to see if I can remove the leds and run the voltage to the shdn pin to turn the esp on...

Also solar cells can keep these running a lot longer. I have a couple running on solar cells with lipo and 4 nimh AA s and they go a long time on deep sleep for 10 minutes.

Mosquito is pretty easy to set to stary on boot. Inwould have to look but I know it is in the script Pete wrote. What are you running it on?

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: Motion sensor and deep sleep mode questions

#5 Post by Drum » 17 Jul 2017, 23:35

I just looked at the wemos board. I don't think that is good for use with batteries. It used 5v in. I think you would be better odd with a module on one of the inexpensive adapter plates and a better Ldo which can run on 3.7V or less. In my opinion the ams1117 is not a Ldo. It has a pretty big drop, but it is really cheap and dropping from 5v to 3.3v is easier than getting 3.3v from 4.2 to 3.7.v.

I have used a couple. Mcp1825 and mcp1826. 1 is 500ma and the other is 1A. Also another power board from adafruit which works relly well but is expensive. I have too look at for it.

How many of these do you need? Also take a look at the adafruit feather eap board. It has a lipo circuit built in. Rather thab changing batteries just plug in a 10 to 15k mah powerbank to recharge a 5k mah battery. The adafruit stuff is more expensive but I think it is of a much better quality than most.

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

Re: Motion sensor and deep sleep mode questions

#6 Post by LisaM » 18 Jul 2017, 13:51

Don't put the esp to deep sleep, switch it off and on! Battery will last 4ever....
PIR-ESP8266-Low-Power.png
PIR-ESP8266-Low-Power.png (4.79 KiB) Viewed 9031 times

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: Motion sensor and deep sleep mode questions

#7 Post by Drum » 18 Jul 2017, 23:04

Doh! I completely forgot about that....

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests