On 02/25/2013 09:23 PM, Yan Seiner wrote:
>
>
> I have a "smart relay" that's controlled by a tri-state switch. The
> switch has a power lead and one wire out of it that works like this:
>
> State 1: 12V nominal
> State 2: floating (not connected)
> State 3: ground
>
> I need to detect the state of this switch with my TS7200. How do I
> translate this into 2 (or 3, I have inputs to spare) bits for a TS7200
> DIO header?
>
> Thanks.
>
> --Yan
I haven't done this, and I can't speak authoritatively, I can just give
you my opinion regarding how I would try to go about it... I guess I'm
just brainstorming. If you are trying to detect switch changes within a
millisecond, I think my whole idea won't work. If your switch changes
state every 10 seconds, and you can allow 1/2 a second to detect it, I
think this will work.
I think I would use an analog input, and a voltage divider circuit, 2
resisters in series with a lead from the center to the analog input. If
you use something like 3.3k and 1k, that will bring your 12v down to
something like 3v so you can use a 0-3.3v analog input. Then, also
connected to this "center tap" run a another voltage divider with a
capacitor tied to a 3.3v source on the board somewhere. This resistor
should match the lower half of your first voltage divider.
So now, when your switch is ON, you'll get a reading of about 3v. When
your switch is OFF, you'll get a reading close to zero. When your
switch is floating, you'll get a reading half way in between. If your
analog input device gives you a 0-4095 integer reading, I think ON will
come in around 4000, OFF will come in close to 0, and floating will be
in the middle, like 2000. Just try it and see what the readings are,
and choose arbitrary points in between as limits. Then in software your
choices become something like "if x > 3000, switch is ON, else if x <
1000 switch is OFF, else x is somewhere in between which means switch is
FLOATING".
This approach using resistors and capacitors means you have an RC timer
circuit, which means when the switch changes state it will take some
amount of time for things to settle as the capacitor builds charge. My
electronics classes in college were 30 years ago, so the recollection of
specifics is pretty fuzzy. I just remember that depending on what you
choose for values you get different settling time.
I invite comments and criticism from actual electronics experts... would
this work?
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|