Hi. I have been trying to get Arduino to work with externally powered IR sensors for a while now with little results. Initially, I was using Arduino to rout the signal from the sensors to Max MSP, but now I need Arduino to read them. The model number of the sensor I'm using is SSR-0P-4E. The problem is getting the sensor to communicate with the Arduino in a manner that is controllable. There is one "control" wire that connects directly to the Arduino digital "in" pin from the sensor. The Arduino code is told to read the sensor, and then print what it "sees" in an on/off fashion (0's and 1's). The Arduino reads that there is something connected to the pin by switching from all "0's" to displaying "1's" also, but there is an identifiable pattern to the numbers. A reading might look like: "1,1,1,1,1,1,0,0,0,0,0..." or "1,0,1,0..." both of which repeat. A voltage meter test revealed that there was 1.489 Volts passing through the "control" wire to the digital input pin. Is this a problem of not enough voltage being sent to the pin to read it, or the way Arduino is reading the incoming voltage/sensor control message? I found that Arduino registers as "HIGH" when a pin reads more than 2.5V and "LOW" when the voltage is less. Is this a power supply issue since I have to use external power for the sensors (their operating voltage is between 10 - 30VDC)? I'm using a 12VDC wall wart. Any help would be much appreciated.
It is difficult because you don't say how you have wired it up. Is the repeating pattern dependent on any changes you are making. If no I suspect you haven't actually connected it to the pin you think you have because you get that sort of pattern with a floating input or where you have not connected the ground of your external supply to the ground of the arduino. For best results connect it to an analogue input and red the values then you can set your own threshold for zero and one.
A Google search for "SSR-0P-4E" turned up nothing related to IR sensors.
well I got:- www.plcsystems.ru/catalog/Sensor/doc/pe18mmss.pdf top hit.
Thank you for the quick replies! The sensor functions as expected, i.e. outputs the corresponding values of "on" and "off" when arduino is routing the information to Max MSP. There is also a light on the sensor that visibly indicates when the IR beam is broken between the sensors (transmitter & receiver) by being either on or off. I believe the sensor can pretty well be ruled out as the problem, which makes this more difficult. This is the way my setup is wired: IR sensor receiver has its own power from a wall wart that outputs 12VDC (which takes care of power and ground as they both go back to the wall wart). The third and last wire is connected to the control wire coming from the sensor and leads to the digital input pin on the Arduino. That's it. Addressing the question of if the values change when I do something, the answer is yes. However, the values only change when I connect the pin. For example, when I digitalRead the sensor "control" pin when nothing is attached to it it gives me all "0's." When I connect the "control" wire from the sensor to the pin the serial monitor gives this reading: " 1, 0, 1, 0..." It seems like the Arduino thinks the sensor is turning on and off. Could this be because of the voltage being lower than 2.5V as I stated previously? But then, why would it spike to 2.5V and then go low over and over when the reading from the volt meter was 1.489V? What is happening here? (I also tried to analogRead the signal and it went from "0" to "1023" over and over with random numbers mixed in between such as 297 or 623.)
(which takes care of power and ground as they both go back to the wall wart)
No it doesn't take care of the ground. The ground from the wall wart MUST be connected to the ground of the arduino. If not you get effects like you are seeing as there is no reference between the two systems.
Although you are concerned with inputs the same applies for outputs and is described in this link:-