detecting both ground and 12V input

Status
Not open for further replies.

ranco980

Newbie level 4
Joined
Nov 5, 2010
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,321
Hi :-o

i am looking for a way to detect both ground and 12V (actualy between 11V and 14V) at the same input with a microcontroller.
i thought of two solution that i am looking for the best way to implement (cost/affective)
1. connecting the same input to two microcontroller inputs 1 for ground and 1 for 12V: adantage: inputs can be fast and clean (can use it for both regular inputs and digital signals disadantage: waisting 2 microcontroller inputs, waisting transistors. is there a good chip for that?
2. i am not sure how to do that but i was thinking maby using the ADC input. perhaps i can make the input be for example 2.5V when input is floating, ~5V when input is about 12V and 0V when input is ground. adantage: sounds like a cheap solution (aldo i am not sure how to do that), using only one input dissadvantage: slow reading

i was hoping to get best ways to implemt both solutions (or if one has a better one :wink

Thx in Advanced and BR
Ran.
 

I think you should select the second alternative, you can use flash adc if you want fastest conversation rate.
 

If I grab correctly what you write, you have an input signal that can assume any value between 0 Volt and 14 Volt, and you are interested in knowing when the input value is "exactly" zero Volt or goes above 11 Volt.
In this case I can suggest you to use analog comparators instead of ADC. Basically, comparator has two pins: one of them can be used as reference and, when the voltage on the other pin gets higher/lower than the reference, you can trigger an interrupt. Clean and elegant solution with very quick detection.
You need an MPU with two comparators, for example have a look at the ATMEL XMega MPU series (ALL models have at least 2 comparators).
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…