This discussion is locked.
You cannot post a reply to this discussion. If you have a question start a new discussion

Arduino ADC usage

Hey all, is anyone savvy with arduino boards? 

I'm looking to use one to perform an analog to digital conversion on a measurement signal coming from a sensor.

The signal range is up to around 9V so I've potential divided this down by half so any value should be readable by the adc.

I've then used the analog read function on a0 and then done some cals to work out the source voltage and corresponding sensor pressure. 

What I'm struggling with is the input to the arduino, because when using the serial monitor the ADC signal outputted is seemingly random, and goes up and up then begins at zero again. 

Is this pin float? I feel like it is.

Parents
  • I've done a little with Arduinos (and Raspberry Pis)

    Presuming nothing has mis-configured the A0 pin (e.g. https://docs.arduino.cc/learn/microcontrollers/analog-input ) and everything's connected correctly I'd expect it to work. What sort of calculations are you doing? - you can certainly get odd effects if you inadvertently use integer rather than floating point arithmetic with small or large values or forget to initialize things when looping.

       - Andy.

Reply
  • I've done a little with Arduinos (and Raspberry Pis)

    Presuming nothing has mis-configured the A0 pin (e.g. https://docs.arduino.cc/learn/microcontrollers/analog-input ) and everything's connected correctly I'd expect it to work. What sort of calculations are you doing? - you can certainly get odd effects if you inadvertently use integer rather than floating point arithmetic with small or large values or forget to initialize things when looping.

       - Andy.

Children
  • Calculation wise its just first print the raw ADC value, then print the analog voltage value. Then double that (as its potential divided down) and then use that value to calculate the pressure based on the sensor data sheet equation. 

    I can seem to get it to work in software on tinker cad using an uno, but in practice using a nano physically the output for the adc just wanders about from 0 up to 1023 in steps then repeats. 

    It's not something to do with a pull up being defaulted on?