01-12-2016 10:40 AM
Hello!
I need to read out the state of a microswitch, I have the following model:
http://sensing.honeywell.com/micro-switch-914ce-limit-switch-914ce1-3a-highres.jpg
I have a cDAQ card NI 9209, +-10 V AI. If I get a 10VDC PSU, and wire up this particular microswitch with the PSU and the NI9209, would it work? Do I need to use some resistors to protect the DAQ module? Sorry for the dumb question, I am not an electrical engineer 🙂
thanks!
Solved! Go to Solution.
01-12-2016 10:53 AM - edited 01-12-2016 10:58 AM
This should work, but a couple comments:
First, I wouldn't use a 10V power source. All you really need is enough to see a voltage change when the switch changes state.
Second, you will need a resistor. Try googling "pullup resistor". You should find info on how to size the resistor and wire it up. Also the purpose of the resistor isn't to protect the DAQ input, it's to protect the power supply and switch. Depending on how sophisticated the power supply is, tying its output directly to ground can cause it (and/or the switch) to fry -- or at least crowbar the power supply.
Third, for future reference, the prefered way of reading a switch closure like this is with a digital input. With an analog input the latency (how long it will take to detect that the switch has changed state) is a function of the analog sample rate. For example sampling at a 1Hz rate will only allow you to see changes once per second, whereas sampling at a 1kHz rate will allow you to see state changes every millisecond.
Fourth, there is a thing called "contact bounce". Basically when a pair of contacts close they don't just snap together and that's that. Rather unless the contacts are "wetted" (a thin coating of mercury is common) the contacts will bounce for a few msec before settling closed.
Mike...
01-12-2016 10:59 AM
01-13-2016 02:41 AM
This would be ok? I would use a PSU like this: http://uk.rs-online.com/web/p/din-rail-panel-mount-power-supplies/6138808/
I would use only two wires of the SPDT switch, as an SPST. Thanks!
01-13-2016 04:02 AM
HI Blokk,
yes it will work. But it depends on what you expect. Do you ask for a High or a Low Signal on your DAQ input? If you close S1, you will get a LOW or " 0" Signal on your DAQ. If you open the S1, you will see an HIGH Signal on your DAQ. If you want wo have an HIGH Signal when you close S1, you should use the Pulldown version.
Best Regards
Chris
01-13-2016 04:20 AM
Hello,
Both case is ok for me, I just need to do a negation in the code depending on the logic.
thanks for feedback! 🙂
01-13-2016 05:28 AM
Whilst it work fine, I wouldn't spend £40 on a 5V power supply just for a single switch unless I was going to use it for something else as well (e.g. to power the rest of a circuit etc.). You only need a tiny amount of current for a switching circuit - you could probably use a USB socket which will give you 5V or one of those wall-wart type power supplies.
01-13-2016 06:25 AM - edited 01-13-2016 06:26 AM
I agree with you, however in our case I would prefer a more robust "industrial" solution. We already have some different PSUs with DIN rails in an electrical cabinet, and it would be nice compact way to integrate this 5VDC PSU into the same place. Besides, it might be possible we will need to integrate new pneumatic valve(s) into the rig in the future, so more switch circuits might be expected later.
The total material cost of this new experimental rig which we build now is about 50k EUR. So lets say this component does not impact the total budget too much...
01-13-2016 07:25 AM
Ah ok, yeah - if it's part of a much larger system then it makes more sense, although in that case you probably already have some power supplies in the electrical cabinet - you could use a voltage divider to scale any DC voltage (e.g. 24V, 12V) down to something safe to use with your analogue input module. e.g.
You just need to choose the ratio of Rtop and Rbottom such that Vout = 5 (or 10, since you have a 10V AI module) and Vin is your DC supply voltage. You then just need to make sure that the sum of the resistances will cause only a small amount of current to flow through the switch (e.g. the total is something like 10k ohms).
01-13-2016 07:36 AM - edited 01-13-2016 07:56 AM
Hmm, thanks, this is indeed a simpler solution 🙂 I have already a 24VDC PSU in the rig, which will supply like 8-10 pressure sensors. So I will just create another parallel output from this 24V PSU, and add the voltage divider as you described.
edit: so I would make it in the following way. But why you say the sum of the resistors will decide the flowing current? When the switch is closed, the top resistor value will matter only, no?