I'm trying to read a signal from an existing IR gate sensor with my arduino. Basically there is a coin dispenser that counts the coins one by one as they pass through the IR gate sensor. When a coin pushes through the sensor I get 5V on the signal line. So I'm trying to read that 5V signal like I would a switch.
The issue I'm having is that the coin dispenser is connected to an outlet with a 3 prong plug. So I have an earth ground on the dispenser. Here is what I've tried
When I power via USB connected to my laptop (not connected to power supply), then the reading floats a bit.
If I power the arduino via usb to my laptop (no power supply) and tie the arduino ground pin to the chassis of the dispenser then I get accurate readings.
Power arduino via 2 prong 9V power supply. I get no reading.
Power arduino via 2 prong 9v power supply and tie arduino ground pin to chassis of dispenser. I get no reading.
Do you all have any idea how I can get an accurate reading consistently?