Pressure sensor controlling pumps

1 Using Arduino / Sensors / BMP085 NEed help with pressure on: February 20, 2014, 07:34:01 pm
I have a code for pumps being ran by a pressure being read from a BMP085 sensor but i dont know how to make the long code that everyone seems to have go together with this one. I want to enter a depth or pressure that i want the pumps to take an ROV down to and i need some help doing that. Any help would be appreciated. This is what i have so far

#include <Wire.h>
#define BMP085_ADDRESS 0x77 // I2C address of BMP085

int pwmPin_A = 3; // output pin supporting PWM
int pwmPin_B = 11; // output pin supporting PWM
int inPin = 5; // pressure sensor voltage connected to analog pin 4
int val = 4; // variable to store the read value
float volt = 0; // variable to hold the voltage read
void setup()
{
Serial.begin(9600);
Serial.println(“Both pumps tested”);

pinMode(pwmPin_A, OUTPUT); // sets the pin as output
analogWrite(pwmPin_A, 128); // primes the pump at half power
delay(2000); // pump runs for 1/2 second
analogWrite(pwmPin_A, 0); // shuts off the pump
pinMode(pwmPin_B, OUTPUT); // sets the pin as output
analogWrite(pwmPin_B, 128); // primes the pump at half power
delay(2000); // pump runs for 1/2 second
analogWrite(pwmPin_B, 0); // shuts off the pump
}
void loop()
{
int valMap;
val = analogRead(inPin); // read the input pin
Serial.begin(9600);
Serial.println(“BnalogRead(inPin)”);
valMap = map(val, 0, 1023, 255, 0);
if (val <= 700)
{
analogWrite(pwmPin_A, valMap);
analogWrite(pwmPin_B, valMap);// runs pump until set pressure reached
}
//analogWrite(pwmPin_A, 0);
//analogWrite(pwmPin_B, 0);// shuts pump off
if (val > 700) // 700 is about 40 PSI
{
analogWrite(pwmPin_A, 0); // shuts pump off
analogWrite(pwmPin_B, 0); // shuts pump off
}
}

Do not ask the same question twice. The BMP085 is an atmospheric pressure sensor, it works over a range of about 0.1 to 1.05 atmosphere, it is unsuitable for measuring pressure under water.

It is also a sensor which communicates by I2C protocol, it doesn't have an analog voltage at all, did you even look at the datasheet for this device ?