Go Down

Topic: Optical Level Switch Wiring Problems. (Read 718 times) previous topic - next topic

h2oyeller

Greetings new guy here. Working on a level sensor and solenoid valve control project. Have Madison Optical level sensors (OPT4303-3 & OPT4303-5). Basically identical except one High in Air and the other is Low in Air. Have everything wired up and working in concept but when I start doing some possible failure scenarios I'm getting troubling results. I first stumbled across the floating input pin problem and was able to find the pull-up resistor fix. So if I lose the signal control wire (green) going to the input pin I can at least control the input. However now the issue I am having is if the sensor loses the Power or Ground wire, depending on the sensor, I have a change in the input value which in turn would trigger my valve. Not good! The sensor will be located a good distance from the controller so losing a wire may not be a unlikely event. Any ideas how I can wire to avoid this problem or should I drive the sensor power with an output pin from the Arduino? Here is the switch diagram. I have the 3 wire version (no black led lead). Greatly appreciate any feedback, ideas or suggestions. Thanks

jremington

#1
Oct 02, 2013, 07:00 am Last Edit: Oct 02, 2013, 07:04 am by jremington Reason: 1
The data sheets for those sensors are as near to worthless as I can imagine!
http://www.cdiweb.com/ProductDetail/OPT43035-Madison-Company/412112/#.Ukul3FNu3DA

If you are seriously concerned about device failures, you will need a lot more information. I suggest to contact Madison's technical support to learn, for example, the typical current draw and the load (current and voltage) specifications for the output. Perhaps they have technical info on reliability and functionality checks as well. I'm assuming here that these are not simple switches, but have some electronics inside. Otherwise, why would there be a spec for 5-12 V?

Presumably, the sensor draws some power regardless of the output state, so if you power the sensor from the arduino side you can at least check that it is drawing the nominal amount of current. That would verify power and ground leads as well as nominal functionality. If the current draw is around 5-10 mA, you could use an optocoupler to verify that the sensor is drawing current. For example, place the LED side of the optocoupler in series with the sensor positive supply lead.

However, wire breaks would not be the only failure mode. You could also have shorts to ground on the positive power lead and on the signal output lead. Without more info there is no easy way to check the latter.  Perhaps the best bet is to use high quality 3-conductor cable and place sensors in pairs.

dc42

I suggest the following. Connect three 1k resistors in series between +5V and ground. Instead of connecting Red to +5V and Green to ground, connect these wires to the 2 junctions between the 3 resistors. Use an analog input pin instead of a digital one, enable the internal pullup resistor, and connect a 0.01uF capacitor between the input and ground. Then you will get +1.7V or +3.3V on the pin if the switch is working and the wires that it connects are OK, or +5V if the switch or one of the wires it connects has gone open circuit, or 0V of there is a short to ground.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

jremington

#3
Oct 03, 2013, 02:40 am Last Edit: Oct 03, 2013, 03:37 am by jremington Reason: 1
The resistor divider is a nice trick and would work if the device actually is a switch. However, the data sheet says that the output is "digital, high in air", that the operating voltage range is 5-12V and that there is reverse polarity protection. So, it seem likely that the device is NOT just a switch but has some internal electronics.

h2oyeller

Thanks for the info and ideas so far. I have a call into the manufacturer to see what additional information I can yield from them. Also a label attached to the sensor leads indicates supply current 15mA.
http://www.madisonco.com/downloads/data_sheet/Madison-Optical_Switches.pdf
Of course the phototransistor is present and they do offer other items with input voltages of 24vdc and some have different output voltage options. I'm guessing the phototransistor could have some design options to accommodate different operating environments. But really I have no clue. Amazing as these things are tiny. But so goes the world.
When I feed 5v I get 4.82v on the output wire when high and 0v when low. So maybe treating like a switch isn't out of the question.
I wouldn't mind trying to come up with some simple short circuit design to cover the possible breaks and shorts. I mean this sensor really isn't that much different in operation to other sensors commonly used. What do others do to guard against such possibilities?
I'm also thinking I could at least from a software side limit the time the valve could be open and if it exceeds that time shut down the controller until a manual reset is executed. This is not ideal as fill times will vary significantly on certain applications so I would have to tailor fit which is not ideal. However I probably will have some type of time concept built in as I think it is appropriate anyway but I don't want to have to rely on it completely. Again thanks. Keep those wheels churning.

dc42


The resistor divider is a nice trick and would work if the device actually is a switch. However, the data sheet says that the output is "digital, high in air", that the operating voltage range is 5-12V and that there is reverse polarity protection. So, it seem likely that the device is NOT just a switch but has some internal electronics.


Good point! I took the schematic literally and didn't look at the datasheet.

Here is another possibility. Close to the switch, connect three 10K resistors in a star configuration. Connect one point of the star to the sensor +5V, one to sensor ground, and one to the sensor output. Connect the centre of the star to the analog input through the cable, add the capacitor and enable the internal pullup as before. Then you will get an output of 1.7V when the sensor output is low, 3.3V if it is high, and something else if there is a break in the cable. I think the only wiring fault this doesn't detect is a short between the switch output (before it goes through the resistor) and +5V or ground.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Go Up