Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


chimera

563 posts

Ultimate Geek
+1 received by user: 199

ID Verified

#223117 13-Sep-2017 16:12
Send private message

Electronics nerds,...

 

I have an alarm system where I have PIRs that read back to the controller as 9V when triggered and 5.5V when idle.

 

I need to convert from 9V to 3.3V, and 5.5V to 0V (or thereabouts) for GPIO input pins on an ESP8266 chip, as I want to read movement in the various zones, then have that sent as MQTT messages from ESP to OpenHAB which updates with the "date/time of the last movement detected".  I'll be using a Wemos D1 mini board.

 

I can't quite work out the resistor values for R1 and R2 to get the desired results however, there is a very fine tolerance for both and quite possibly not enough variance to differentiate between "high" and "low".  For example:

 

R1 = 6800 ohms, R2 = 900 ohms

 

Vin = 9V, Vout = 1.05V

 

Vin = 5.5V, Vout = 0.64V

 

Would a 3 resistor voltage divider work better?

 

I also can't find the datasheet for the Wemos D1 mini to find what the variance is for pin = LOW vs pin = HIGH, I seem to recall reading in the past LOW is < 0.75V or so.  If anyone knows has a link it would be most appreciated.

 

Anyways, is a voltage divider suitable in this case, or is there another solution that would work better?  I think I read somewhere that I could use MOSFET's to do this?

 

Any ideas?  

 

 

 

Thanks

 

 


View this topic in a long page with up to 500 replies per page Create new topic

This is a filtered page: currently showing replies marked as answers. Click here to see full discussion.

Aredwood
3885 posts

Uber Geek
+1 received by user: 1749


  #1864865 14-Sep-2017 00:57

@chimera Use a voltage comparator. The LM339 would be ideal for what you want. You simply feed 2 different voltage levels into it, and an output switches on and off depending on which input has more voltage than the other. Jaycar sell it for $2.40 ZL-3339

 

Connect the LM339 to the 12V supply from the alarm. Use 2 resistors as a voltage divider to get whatever voltage you want as your "changeover voltage" (7V maybe?) Connect that voltage to all of the minus input pins of the comparator. and connect each + input pin to an alarm zone. Since the LM339 is a quad comparator, it will do up to 4 alarm zones.

 

The output pins are open collector, meaning they are either open circuit, or connected to ground. If the ESP8266 has inbuilt pullup resistors on it's inputs, simply connect it's input pins to the comparator outputs. Otherwise just connect 10K resistors between the ESPs 5V rail and the input pins. Because of the open collector design, you can connect the comparator output pins together, if you want to monitor say 4 zones, but you don't need to know which zone got triggered. Just that a zone got triggered.

 

Swap the + and - inputs if you want to swap the output between 0V = zone triggered and 0V = zone normal.

 

Another trick is to use a 10K multi turn variable resistor as a voltage divider. Connect the end terminals to 12V and ground. And the wiper terminal is your reference voltage. So you can then adjust the changeover voltage easily if you want.

 

Remember to link the alarm system ground and the ESPs ground together.








chimera

563 posts

Ultimate Geek
+1 received by user: 199

ID Verified

  #1892799 30-Oct-2017 19:30
Send private message

Created another instructable for this... to me its a good way of sharing an idea, plus by me documenting it, helps commit what I've learn't to memory!

 

https://www.instructables.com/id/Alarm-PIR-Movement-to-Home-Automation/

 

Thanks again Aredwood!

 

 


View this topic in a long page with up to 500 replies per page Create new topic








Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.