# Basic arduino program for beginner

I set up the circuit the exact same way as it is shown here:

https://www.sparkfun.com/tutorials/389

And used the exact same code as shown on the website. But when I press the pressure sensor, the numbers on the serial monitor change from 0.00 to 0.05 and back to 0.00 when I release the sensor. If it were working correctly, the numbers should range from 0.00 to 5.00. Any input from the arduino community would be appreciated.

Thanks

What are the colors on your resistor?

I see you also posted the message above to the sparkfun message board, along with: "Not sure if that has anything to do with this but the sensor that I am using has 3 pins and I connected the sensor directly on to the breadboard."

Or, try this other spark fun suggestion: Question: "I purchased a sensor that had 3 pins instead of 2. How do I connect this one to an Arduino UNO board ? The part # SEN-08685" Response: "Use aligator clips on the outside sensor leads to jumper wires (into the breadboard)."

LarryD, the resistor is 330 ohms. I know the resistor used in the diagram is 1 Mega ohms but since my resistor value is lower I would assume that my voltage output would be higher. But it seems like its the opposite.

CrossRoads: Yes I posted the same question on Sparkfun because I am addressing the circuit from Sparkfun. Nothing wrong with getting suggestions from various sources. What I have is the exact same thing as shown on the sparkfun website, just that I am using a 330 ohm resistor. Yet my voltage output is way lower than the circuit from the website.

Further, how would using alligator clips change anything? The center pin isn't connected to anything. It probably doesn't even make a difference.

the resistor is 330 ohms.

Has to be 1Meg.

LarryD, thank you for your input. Would you be kind enough to explain why the value of the resistance affects the voltage as seen on the serial monitor. I tried understanding the schematic of the arduino uno as shown here:

But it didn't make sense to me.

In the attached schematic current flows from +5V through the pressure sensor through the 1Meg resistor to ground.
When you press the sensor its resistance goes lower.
The resistance of the sensor is >5Meg.
Since the sensor is 5 times bigger than the 1Meg resistor there will be 5 times the voltage across it compared to the 1Meg.
The analog I/P is measuring the voltage at the top of the 1Meg resistor referenced to GND.
The analog I/P will see 5V/6(total of 5M + 1M) = .833Volts
The sensor will have 5 times that across it or 4.16Volts
When you push the sensor lets say its resistance goes to 1Meg
IF the sensor is 1Meg and the resistor is 1Meg the voltage across both will be 2.5Volts or 1/2 half the supply.
You had a 330 ohm resistor in the circuit.
If the sensor is >5Meg it is ~ 15,000 times bigger than the 330 ohm resistor.
It therefore had 15,000 times more voltage across it than the 300 ohm resistor had.
The analog I/P will therefore see a very very small amount of voltage.
If the Sensor was pushed and its resistance goes to 1Meg this would be still ~3,000 times bigger than the 330 ohm resistor.
The analog I/P was still be very very small therefore your reading on the serial monitor was near 0 whether the sensor was pushed or not.

LarryD, that clarifies a lot. Thank you so much. +1 for the simplified circuit diagram. Cheers.