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