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?
From what you said, I'm looking at number 2 and 4 where the biggest difference was your power supply. Both times you had the Arduino ground connected to chassis ground of the dispenser. On number 2 you used your computers USB power but on number 4 you used 9v power. Perhaps there was some bad connection made on the ground when you were trying it on #4. I'd try powering the arduino up off the computer again, make sure you're getting a reading, then try the 9v and then go back to the computer. If you get a reading off the laptop, then none on the 9V and then again when back on the laptop you have at least eliminated the possibility of a bad ground connection. I'm not the best at Electronics, still a rookie myself but I hope this helps some!
Yeah, but it's strange that when I use the 9V 2 prong power supply with a ground strap connected to the coin dispenser's chassis (earth ground). Do you have any idea what could be causing that issue? Is there something weird about tying the arduino to earth ground when it's power supply is only the 2 prongs?
Ok strange. I think I may have just not had a good connection on my ground strap. Because I reattached it and used the 9v power supply with the ground strap to the chassis and it is working well now.
I was just super confused why that wouldn't have worked.