Thursday, July 14, 2016

ESP8266 and PIR sensor (1) Not Working (?)


As i have some of these PIR motion detecting sensors and i wanted to know if my (5 - 20 volt) sensor does work with ESP8266 test module.
The spoiler of the story is already in the title.
With the signal to PinPir (I tried several pins), GND and  +Power to VCC ( 3.3 Volts) i tested the ESP8266 with the program below. This program also toggles another led ( PinChk ) every time the timer routine tests PinPIR.
First the PIR sensor seemed to react on movements.The PIR sensor has a jumper for Single or Repeat Trigger and adjustments for Sensitivity and Time delay. I did not want false alarm signals so did more tests. 
My conclusion is this PIR module does not work reliable on 3V3 if connected the standard way ! This is not a big surprise, the specs say you need 5 - 20 Volts!
ESP8266 and PIR sensor (Not working !!)This configuration starts to give false signals after some time especially if you use the (more power consuming) RGB leds and afer a time you can even remove the PIR sensor and get almost the same results as without the PIR sensor.

' PIR test
cls
' Pin Pir 2 GPIO2

let PinPir = 2

' Pin Led    14 GPIO14
let PinLed = 14

' Pin Chk    4 GPIO5
let PinChk = 4

' Switch off the a RGB leds 
io(po,12, io(pi,1) ) ' 12  GPIO12 RGB led GREEN
io(po,13, io(pi,1) ) ' 13  GPIO13 RGB led BLUE
io(po,15, io(pi,1) ) ' 15  GPIO15 RGB led RED

x = 0
html | <h1>Test Pir sensor</h1> |
html | <br> |
html | <br>Pir sensor controls the Led<br> |
button " Exit ", [Exit] 
html | <br> |
timer 60 ,[PirChk]
html | <br> |
wait 

[PirChk]
' toggle PinChk checkled
x = x + 1
io(po,PinChk,x )
if x > 1 then x = 0

io(po,PinLed, io(pi,PinPir) )
wait

[Exit]
io(po,PinLed, io(pi,1) )
end

A negative result is also a result, i decided to publish it for you (and as a reminder for myself). Perhaps a part of the problem is the wiring of my ESP test module, but 3.3 Volt is also below the specs of this PIR module !
But this is not the end of the story. I did a search on the internet (i need a PIR sensor for my project) and found an interesting article about my module...  As i have planned some other things you have to be patient before i can publish my test results.


1 comment:

Jan Jeronimus said...

Part 2 where you can see how to use the PIR sensor with 3V3 :
http://blog.jeronimus.net/2016/07/esp8266-and-pir-sensor-2.html