using opto switch with GPIOs

Hi guys
I am trying to build a coin counter and install it in a vending machine i have. The machine only takes loonies and has only 1 product. I simply want to be able to count the coins and update a database online which can be accessed by the user from the web.

I found a opto switch which might do the trick.

Can i simply install this in one of the GPIOS on BBB? Can someone tell if I can use that opto switch with BBB?

I would need a more convenient design so i can position the optoswitch inline with the coin hopper in vending machine.


Well. with a 30V output and the BBB only handling 3.3V, I would have to say no. But, I would need to look at a data sheet to see for sure.


Hi there Cyclops;

I took a quick look at the data sheet and 30 volts appears to be the MAXIMUM voltage you can have across collector to emitter.

I would hook the collector to 3.3V with about a 10K resistor and the collector to ground. That should give you a 3.3V logic signal.

Worst case you can clean it up a bit with a CMOS buffer.