ADC pin with pull up? detecting when nothing is connected

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi All

My AVR voltage is 3.3V so this is my ref point.

I need to read voltage that range from 0V to 3V using the ADC

So 3.3V is never read.

But i would like to know is it possible with the ADC and without disturbing it performance to have either a internal or external pull up, so when 3.3V is read i can see it as that it's not connected to my sensor.

Regards

DJ

Thanks

Regards

DJ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So you just turn on the internal pull-up, read the ADC and if you get > 3.0V you have no input.

When you are reading a real input, turn off any pull-ups so that you are not loading the input.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you want to avoid additional switching...
(but more electrical solution)

Try to think in the other way:

Add an offset of 0.3V sensor-sided (it is only present if the sensor is connected)

To avoid floating of the pin add a pull down to the ADC pin.

If you're now measuring <0.3V your sensor isn't connected.
You just have to move your interpretation from 0-3V == 0..100% to 0.3-3.3V == 0..100%.

A SUCCESSFUL day to all of you! ;)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have used an external pull up (just a simple resistor connected to the 5V supply) to connect to my ADC pin. When the ADC pin is floating, it reads 5V (after conversion in software) You can probably use the internal pull up but my app. required a variable pull up resistor.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
So you just turn on the internal pull-up, read the ADC and if you get > 3.0V you have no input.

When you are reading a real input, turn off any pull-ups so that you are not loading the input

I can give this a go. If i do now get a 3.3V, i can then switch off the pull up

Quote:

If you want to avoid additional switching...
(but more electrical solution)

Try to think in the other way:

Add an offset of 0.3V sensor-sided (it is only present if the sensor is connected)

To avoid floating of the pin add a pull down to the ADC pin.

If you're now measuring <0.3V your sensor isn't connected.
You just have to move your interpretation from 0-3V == 0..100% to 0.3-3.3V == 0..100%.

Could you explain please?

Thanks

Regards

DJ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@djoshi

What should I explain? Please be a bit more specific.

My solution will work too. The only problem you could have is, that sensor outputs normally are of low resistance. Therewith it isn't done to add the offset simply by using a potential divider because you should never load sensor outputs (..to heavy). You have really take care of impedance effects!

Quote:
without disturbing it performance

You havn't said how many additional instruction are "disturbing" to your solution.

So my solution is not easy and only worth doing if you have really no time in program flow for the additional instructions switiching the interenal pull-up and checks.

The principle is the same like sensors with current outputs have (4mA..20mA).
0mA => no sensor (often additional: 24mA => sensor broken for example)

It's a really common solution...you will find enough material (circuit diagrams...) through out the web.

I just wanted to give you a second solution... :)

A SUCCESSFUL day to all of you! ;)