Thursday, 2 October 2014

ground - Optocouplers vs Voltage Dividers


I have a device that has a terminal that goes to 5v at certain times. I wish to sense that voltage with an ESP32. I have built this circuit using an optocoupler:


schematic


simulate this circuit – Schematic created using CircuitLab




  1. How would this circuit change if I wanted to detect 12v instead? Is it just a matter of switching R2 for a higher value?

  2. I see that voltage dividers can also be used for the same job, but I think that would only work in cases where the sensor and MCU share a common ground. How can I achieve that in this case (if at all I can/should)?


EDIT: As requested, some details of the system.


The MCU is running off 5vdc converted from 8vac provided by a bell transformer connected to the mains (it is already sensing the doorbell using optos).


The device is an alarm panel, that has various terminals to attach motion sensors (that go to 5v) as well as provide signals that the alarm is set or has been triggered (these terminals go to 12v). The panel is connected directly to the mains, but I can see it has a built in transformer, as well as terminals providing ground and 13v.




No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...