SCP 1000 D11 Model not working

Hello how are you everyone ?

I am stuck in this code and still struggling to run it from last three days and night but i giving not resonable Raw data …

kindly help me if someone did work on SCP d11 pressure sensor which is using I2c protocol

what i tried is :

#include <Wire.h>

void setup()

{

Wire.begin(); // join i2c bus (address optional for master)

Serial.begin(9600); // start serial communication at 9600bps

}

int reading = 0;

void loop()

{

// step 1: instruct sensor to read echoes

Wire.beginTransmission(0x11); // transmit to device #112 (0x70)

// the address specified in the datasheet is 224 (0xE0)

// but i2c adressing uses the high 7 bits so it’s 112

Wire.write(byte(0x01)); // sets register pointer to the command register (0x00)

Wire.write(byte(0x55)); // command sensor to measure in “inches” (0x50)

// use 0x51 for centimeters

// use 0x52 for ping microseconds

Wire.endTransmission(); // stop transmitting

// step 2: wait for readings to happen

delay(70); // datasheet suggests at least 65 milliseconds

// step 3: instruct sensor to return a particular echo reading

Wire.beginTransmission(0x11); // transmit to device #112

Wire.write(byte(0x1F)); // sets register pointer to echo #1 register (0x02)

Wire.endTransmission(); // stop transmitting

// step 4: request reading from sensor

Wire.requestFrom(112, 1); // request 2 bytes from slave device #112

// step 5: receive reading from sensor

if(2 <= Wire.available()) // if two bytes were received

{

reading = Wire.read();

Serial.println(reading); // print the reading

}

delay(250); // wait a bit since people have to read the output :slight_smile:

}

After following all steps which is given in datasheet but it is giving the raw data on MSB byte of Pressure:

1111111

If i read 0x80

Lsb bit it gives the same data

1111111

1111111

if i read 0x81

it again give same 16 bit

1111111

1111111

I shall be highly thankful if someone help in this regards,

Code reformated for easier viewing. In future use the “Code” tag to attach code.

#include <Wire.h>

void setup()
{
  Wire.begin(); // join i2c bus (address optional for master)
  Serial.begin(9600); // start serial communication at 9600bps
}

int reading = 0;

void loop()
{
  // step 1: instruct sensor to read echoes
  Wire.beginTransmission(0x11); // transmit to device #112 (0x70)
  // the address specified in the datasheet is 224 (0xE0)
  // but i2c adressing uses the high 7 bits so it's 112
  Wire.write(byte(0x01)); // sets register pointer to the command register (0x00)
  Wire.write(byte(0x55)); // command sensor to measure in "inches" (0x50)
  // use 0x51 for centimeters
  // use 0x52 for ping microseconds
  Wire.endTransmission(); // stop transmitting

  // step 2: wait for readings to happen
  delay(70); // datasheet suggests at least 65 milliseconds

  // step 3: instruct sensor to return a particular echo reading
  Wire.beginTransmission(0x11); // transmit to device #112
  Wire.write(byte(0x1F)); // sets register pointer to echo #1 register (0x02)
  Wire.endTransmission(); // stop transmitting

  // step 4: request reading from sensor
  Wire.requestFrom(112, 1); // request 2 bytes from slave device #112
 
  // step 5: receive reading from sensor
  if(2 <= Wire.available()) // if two bytes were received
  {
    reading = Wire.read();
    Serial.println(reading); // print the reading
  }

  delay(250); // wait a bit since people have to read the output
}
  1. In step 4 you ask for 2 bytes but the argument is just 1. Is that right?

  2. endTransmission returns an error code that you are not checking.

  3. Does this device require a “Repeated Start” when switching the bus around from write to read or a full “stop”?

  4. What happens if you do get 2 bytes in Step 5. You only get one and print that out. What happens to the second byte?

PS: Love your step number comments. Makes it easy to refer to sections in the code.

Thank you

yes it was wrong i checked but raw data was not valid that why it is giving 1111111 for every byte …

Kindly check my code if it is wrong kindly make it right and give me code if someone have

Writing data:

  1. START BIT (to initiate a transmission, the master sends a start bit)

  2. SLAVE DEVICE ADDRESS (slave device address with WRITE access → LSB = ‘0’)

  3. SLAVE ACKNOWLEDGEMENT (having identified device address as its own, slave acknowledges by sending an acknowledge bit)

  4. REGISTER ADDRESS (the 8 bit address of the register to be written, MSB first)

  5. SLAVE ACKNOWLEDGEMENT (the slave sends an acknowledgement bit)

  6. REGISTER DATA (master sends the data to be written to the addressed register)

  7. SLAVE ACKNOWLEDGEMENT (after receiving the byte, the slave sends an acknowledgement bit)

  8. STOP BIT (master sets the bus free)

Reading of bits procedure

  1. START BIT (to initiate a transmission, the master sends a start bit)

  2. SLAVE DEVICE ADDRESS (slave device address with WRITE access → LSB = ‘0’)

  3. SLAVE ACKNOWLEDGEMENT (having identified device address as its own, slave acknowledges by sending an acknowledge bit)

  4. REGISTER ADDRESS (the 8 bit address of the register to be read, MSB first)

  5. SLAVE ACKNOWLEDGEMENT (the slave sends an acknowledgement bit)

  6. REPEATED START (from master)

  7. SLAVE DEVICE ADDRESS (slave device address with READ access → LSB = ‘1’)

  8. SLAVE ACKNOWLEDGEMENT (the slave acknowledges)

  9. REGISTER DATA (the master continues sending the SCK pulses as slave sends the defined register content to SDA line)

  10. MASTER NOT ACKNOWLEDGE (master terminates the data transfer by sending not acknowledge bit)

  11. STOP BIT (master sets the bus free)

In step 3 in your code you are not doing what step 14 in your outline says. You need to provide the optional argument in the endTransmission call to get a repeated start.

Here is a link to some Arduino code for the SCP1000 pressure sensor. It doesn’t look at all similar to what you have. What device are you actually trying to interface?

http://arduino.cc/en/Tutorial/BarometricPressureSensor

SCP 1000 have two versions Scp1000 Do1 and Scp1000 D11 . 11 is work on I2c and o1 work on spi the code you send to me is about o1. but i required for i2c . step are written here i am trying on it but i cannt able to complete due to little understanding kindly tell me who i can do and someone have code or did work on it kindly let me know.

14 number is repetition … as i start address of slave its means it is repetition am i right ?

True, but there are comments in the code that were intended for a different device completely; apparently an ultrasonic distance sensor. The SCP1000 measures pressure, but does not read “echos” or “measure in cm”. Do you even have the correct register addresses for the SCP1000? Where is the multistep SCP1000 initialization code?

If you don’t have the SCP1000 programming guide (which is for both interface versions) here is a copy: http://www.uoxray.uoregon.edu/SCP1000_programming.pdf

#include <Wire.h>
byte reading;
void setup()
{
  Wire.begin();                
  Serial.begin(9600);          
  Wire.beginTransmission(0x11); 
  Wire.write(byte(0x03));      
  Wire.write(byte(0x09));      
  Wire.endTransmission(); 
  Wire.beginTransmission(0x11); 
  Wire.write(byte(0x01));      
  Wire.write(byte(0x55));      
  Wire.endTransmission();       
}



void loop()
{
  Wire.beginTransmission(0x11); 
  Wire.write(byte(0x81));            
  Wire.endTransmission();       
  Wire.requestFrom(0x11, 2);    // request 2 bytes from slave device #112

  // step 5: receive reading from sensor
  if(2 <= Wire.available())    // if two bytes were received
  {
    reading = Wire.read();  // receive high byte (overwrites previous reading)
    reading = reading << 8;    // shift high byte to be high 8 bits
    reading |= Wire.read(); // receive low byte as lower 8 bits
    Serial.println(reading);   // print the reading
  }

  Wire.beginTransmission(0x11); 
  Wire.write(byte(0x7F));            
  Wire.endTransmission();       
  Wire.requestFrom(0x11, 2);    // request 2 bytes from slave device #112

  // step 5: receive reading from sensor
  if(2 <= Wire.available())    // if two bytes were received
  {
    reading = Wire.read();  // receive high byte (overwrites previous reading)
    Serial.println(reading);   // print the reading

  delay(250);                  // wait a bit since people have to read the output :) */

}

thanks

yes i have repitition code and address for slave is: 0x11 for pressure is 0x7F and ox80. for temperature is 0x81.

kindly check it and guide me ]…

It does not appear that you are following the recommended procedure for initializing and reading the SCP1000.

What mode do you think the device is in and how do you know when data actually become available?

thanks can you help me in proper initializing according to recommended procedure. in my sense according to continuous measurement mode i chose for it thats why assigning the 0x03=0x09

Wire.beginTransmission(0x11);

Wire.write(byte(0x81));

Wire.endTransmission();

Wire.requestFrom(0x11, 2); // request 2 bytes from slave device #112

// step 5: receive reading from sensor

if(2 <= Wire.available()) // if two bytes were received

{

reading = Wire.read(); // receive high byte (overwrites previous reading)

reading = reading << 8; // shift high byte to be high 8 bits

reading |= Wire.read(); // receive low byte as lower 8 bits

Serial.println(reading); // print the reading

}

after this it should have to available.

From the programming guide:

Reading the pressure and temperature

After the DRDY pin has signaled the availability of new measurement data, it is recommended that the output data is read immediately in the following order:

o read the TEMPOUT register (temperature data in bits [13:0])

o read the DATARD8 register (bits [2:0] contain the MSB of the pressure data)

o read the DATARD16 register (contains the 16 LSB of the pressure data)

As a starter, where do you ready the DRDY pin?

I2c donot having DRDY pin its just for SPI protocol in i2c we have SDA and SCK pins.

DRDY is pin #3 on both the D-01 (SPI interface) and D-11 (I2C interface). You can interrogate the status of DRDY by reading the status register (4), so you don’t need to read the pin directly. However, expect nonsense if you try to read data when the device is not finished with a conversion.

I wonder if your problem be solved? Now, i am also trying to get the code for D11/RCP1000. It would be very appreciated that you paste the final correct code here, or you can email me:zintiger@gmail.com. thank you all.