Optocoupler systems

Hi all,

I have a project to integrate an electronic lock into the solar powered swing arm gate controller using PiPico. The gate doesn’t have an electronic lock “output” to control a lock. So In am thinking of using a pico to perform this function. The gate control board has an output for a beacon/alarm but it fluctuates in voltage from like 0-24v in cycles to blink the beacon or make an alarm sound. So I am hoping that I can take the the “first” 24V signal from the beacon /alarm output and use an optocoupler “type” system to get the 24V down to a safe voltage for pico input then with programming on the pico control a relay to engage the 24V lock when the gate opens. I also want to use the pico to control delayed locking when the gate shuts.
I am wanting to ask questions about the best way to implement the Optocoupler system, I have used them before in a microcontroller to control higher voltage applications but never in reverse to sense higher voltage for a microcontroller input. Can this be achieved?

Many thanks

KD

1 Like

Hi Kirk
The LED in the Otto coupler will (or should) have a series resistor to control the LED current. You have to increase this to accommodate the 24V. By adding to it if the device you are using has already got one fitted to accommodate a lower voltage or if this is not the case by fitting one.

You need to know what current (mA) the LED requires and the forward voltage drop. Should be between 1 and 2 V. (Data sheet)

You could probably assume 2V as the actual current you finish up with is not too critical.
So your formula would be 22 (V) divided by the required current (mA) which would yield a result in kΩ. As I said the actual current is not critical as long it is in the ball park so the nearest resistor value in the 1% series should be fine. Don’t forget this is the TOTAL resistance so if one is already fitted just subtract that value from your formula result and go for the closest 1% value.

Cheers Bob

3 Likes

Hi Kirk
My latest topic would interest you.

Versatile Opto Coupler 3 to 30V Input

This arrangement will accept 3 to 30V input and have a LED current go approx 5.5mA irrespective of input voltage. No series resistor needed.

For your application simply connect the output emitter to ground and the collector to Pico digital input with an external or internal pull up resistor to 3.3V. This output will be LOW active
Cheers Bob

3 Likes