Go Down

Topic: Impossible Sensor? (Read 7225 times) previous topic - next topic


The map command is the KEY!!!! lol... I'm going to dig into this during lunch but now that I see I don't have to have a perfect 0v - AREF voltage, I see where you guys where coming from!

Please excuse my dumbness when it comes to this stuff... I'm an ME and would rather machine parts all day than work with electronics, not to mention micro processors. I really find this interesting and will continue to learn, but man is it slow going!!!

Thanks guys!

It just gets slow and difficult at a different level... Nothing Changes! 8)

Best Wishes.


Mar 07, 2011, 04:04 am Last Edit: Mar 07, 2011, 04:40 am by RobDrizzle Reason: 1
Ok... So I got my voltage divider working well. 0 PSI = 4.60v and 100 PSI = 1.55v (close enough for me). I have the arduino picking up power from the USB and the sensor's voltage divider is powered by a 9v battery. I get a 4.5v with a multimeter across Vout and ground but the arduino is reading all over the place (2.5 - .88 volts) and is acting like it is just picking up noise.

I didn't see anything jumping out at me that was wrong so again I'm asking for your help!

I had the Vout plugged into analog pin 0 and was running this program to watch everything.

Code: [Select]
int pressurePin = A0;

void setup()

void loop()

int pressureLevel = analogRead(pressurePin);
//pressureLevel = map(pressureLevel, 0, 1023, 318, 943);
//pressureLevel = constrain(pressureLevel, 318, 943);
//float pressure = pressureLevel;

//pressure = (pressureLevel);

float pressure = getVoltage(pressurePin);

Serial.print("PSI = ");
Serial.print("Volt = ");


float getVoltage(int pin){
 return (analogRead(pin) * .004882814);

Am I missing a connection? Do I need to pull a wire the center of the voltage divider to "AREF"?


Have you consider using:

Configures the reference voltage used for analog input (i.e. the value used as the top of the input range). The options are:

    * DEFAULT: the default analog reference of 5 volts (on 5V Arduino boards) or 3.3 volts (on 3.3V Arduino boards)
    * INTERNAL: an built-in reference, equal to 1.1 volts on the ATmega168 or ATmega328 and 2.56 volts on the ATmega8 (not available on the Arduino Mega)
    * INTERNAL1V1: a built-in 1.1V reference (Arduino Mega only)
    * INTERNAL2V56: a built-in 2.56V reference (Arduino Mega only)
    * EXTERNAL: the voltage applied to the AREF pin (0 to 5V only) is used as the reference.

And check example in IDE->File->Examples->Analog.


Am I missing a connection? Do I need to pull a wire the center of the voltage divider to "AREF"?

My guess is your forgot to wire a jumper between the 9 volt negative terminal and a Arduino ground pin. Without it there is no common reference between the two separate electrical circuits, the voltage divider and the arduino, and floating wandering numbers are likely what you get (and deserve  :D )



^^^^That is actually what I was assuming. I didn't do it cause I was unsure if it would be ok to plug the 9v into the ground of the board. I can use any pin labeled ground right?


I connected a ground (quickly) before I went to work.... I was getting the right voltage reading from the serial.print and that looks to have sovled the problem. I'll know more tonight when a run the sensor through the range of pressure but it's looking promising!

Thank you very much for the tip!!!!!



Great! Just to chime in on the ground issue.

There is no problem connecting grounds together unless there's a big ground loop, not your problem.

From my limited teaching experience in electronics, 50% of something not working was because it's not turned on, the other 50% is ground not connected :)
Serial LCD keypad panel,phi_prompt user interface library,SDI-12 USB Adapter

Go Up