Hello,
I have a problem with my project. I have capture the pressure difference is the DATA my sensor and I have not managed to find Arduino library for programming.
If you could tell me which library to use for my project.
Thanks you for your help,
Datasheet : http://www.farnell.com/datasheets/1720196.pdf
Sorry if i'm not very understanding but i'm not english and i have not a good english.
In french :
Bonjour,
J'ai un problème avec mon projet. Je dois pouvoir relever la différence de pression soit le DATA de mon capteur et je n'ai pas réussi à trouver de librairie ARDUINO pour programmer.
Si vous pourriez m'indiquer quel librairie utiliser pour réaliser mon projet.
Merci de votre aide,
Yes, i understand, 0x40. and command byte hF1 (trigger measurement) to the sensor, what is that? I must find the formul to convert in Pa?
Thanks for the answer Rob
#include <Wire.h>
#include <Sensirion.h>
void setup()
{
Wire.begin();
Serial.begin(9600);
Serial.println("\nI2C Scanner");
const int analog_pins[2] = {4, 5}; //Sensor_count = 2
//Pins 4 and 5
}
void loop()
{
byte error, address, sensorValue, result;
int nDevices;
int analogOutPin;
//int result
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++ )
{
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0)
{
Serial.print("I2C device found at address 0x");
if (address<16)
Serial.print("0");
Serial.print(address,HEX);
Serial.println(" !");
nDevices++;
}
else if (error==4)
{
Serial.print("Unknow error at address 0x");
if (address<16)
Serial.print("0");
Serial.println(address,HEX);
}
}
if (nDevices == 0)
Serial.println("No I2C devices found\n");
else
Serial.println("done\n");
delay(500); // wait 5 seconds for next scan
///////////////NEW////////////////////////
int MEASUREMENT_PA_HM = 0xF1; // update for pressure measurement, hold master
int USER_REG_W = 0xE6; // write user register
int USER_REG_R = 0xE7; // read user register
0xFE; } // soft reset
float readPA(0xF1);
And i make test late.. : I have Scanning...
No I2C devices found
SDA>Pin2 et SDL>Pin3
Code for the test :
#include <Wire.h>
void setup()
{
Wire.begin();
Serial.begin(9600);
Serial.println("\nI2C Scanner");
}
void loop()
{
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++ )
{
//address = 0x40;
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0)
{
Serial.print("I2C device found at address 0x");
if (address<16)
Serial.print("0");
Serial.print(address,HEX);
Serial.println(" !");
nDevices++;
}
else if (error==4)
{
Serial.print("Unknow error at address 0x");
if (address<16)
Serial.print("0");
Serial.println(address,HEX);
}
}
if (nDevices == 0)
Serial.println("No I2C devices found\n");
else
Serial.println("done\n");
delay(5000); // wait 5 seconds for next scan
}
I have connect Sda to A4 and SDL to A5, and for one connection, i have pull up resistor for Sda and Sdl. When i test with i2c scanning, if i have sda and sdl on analog pin, the test block when it arrive to
error = Wire.endTransmission(); I have test with serial.print to see that. And i have i2c device not found if i test with the sda/sdl on pin 2 and 3.
R = 4.7k
I modify the code and i have now after write the result with (pressure = sensor output / 1200) after see datasheet.
I have : Screenshot by Lightshot
It's the possibl result? Correct?
I modify the code and i have now after write the result with (pressure = sensor output / 1200) after see datasheet.
I have : Screenshot by Lightshot
It's the possibl result? Correct?
The Arduino uses the ANALOG PINS 4 and 5 also as I2C bus. I2C is a digital protocol.
You can use other pins for I2C if you use a software I2C library. As that would make your code more complex I would not do that unless there is no other option.