Reading from Atlas Scientific Dissolved Oxygen sensor

Hi Everybody,

Can you please help me in acquiring measurement from Atlas scientific dissolved oxygen kit. data sheet for sensor is:

code is as follows:

#include <Wire.h>

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

char myChar = 'R';
int reading=0;
void loop() {
// step 1: instruct sensor to read echoes
Wire.beginTransmission(97); // transmit to device #97(0x70)
// the address specified in the datasheet is 224 (0xE0)
// but i2c adressing uses the high 7 bits so it's 97

Wire.write(myChar); // command sensor to measure in "inches" (0x50)

Wire.endTransmission(); // stop transmitting
delay(600);
// step 4: request reading from sensor
Wire.requestFrom(97, 6); // request 2 bytes from slave device #97

// step 5: receive reading from sensor
if (6 <= 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
}

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

The sensor does not come out of standby mode(blue led remains ON). and i get the error as:

requestFrom: readed=0, quantity=6 : ERROR
requestFrom: readed=0, quantity=6 : ERROR

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom. :slight_smile:

and i get the error as:

requestFrom: readed=0, quantity=6 : ERROR
requestFrom: readed=0, quantity=6 : ERROR

Not from the code you improperly posted. Read the stickies at the top of this forum BEFORE you post again.

The first thing that I do when using a new I2C device is to run an I2C scanner to confirm that I am using the right address and that the device is communicating over the bus.

// I2C scanner by Nick Gammon.  Thanks Nick.

#include <Wire.h>

void setup() {
  Serial.begin (115200); //*****  make sure serial monitor baud matches *****

  // Leonardo: wait for serial port to connect
  while (!Serial) 
    {
    }

  Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
  
  Wire.begin();
  for (byte i = 1; i < 120; i++)
  {
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      count++;
      delay (1);  // maybe unneeded?
      } // end of good response
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup

void loop() {}

My apologies for posting code incorrectly.

  1. Using Ameba RTL8195A board
  2. I2C communication with do sensor.
  3. Circuit: I2C_SCL connected to RX pin of sensor, I2C_SDA connected to TX. both through 4.7k resistor.
  4. Supplying 5v to Vcc from ameba board . common ground of sensor and board.
  5. I have run the code I2C_scanner code by ground fungus. and the result is as under:

Find the avaiable window

Baud:3; auto_length:0; Delay start:0; Delay end:63

[SPIF Err]SpicNVMCalStore: The flash memory(@0x9080 = 0x0) is not able to be write, Erase it first!!
===== Enter Image 1 ====

SPI calibration

Find the avaiable window

Baud:2; auto_length:21; Delay start:0; Delay end:63

[SPIF Err]SpicNVMCalStore: The flash memory(@0x90b0 = 0x0) is not able to be write, Erase it first!!

SDR Controller Init

Test 0: No match addr 0xc9d38 => 0xf != 0xc

Test 0: No match addr 0x1f7c10 => 0x5 != 0x2d6a0aaa

OTA addr 0x0 INVALID

load NEW fw 0

Flash Image2:Addr 0xb000, Len 27860, Load to SRAM 0x10006000

Image3 length: 0x2130, Image3 Addr: 0x30000000

Img2 Sign: RTKWin, InfaStart @ 0x10006049

===== Enter Image 2 ====

addr:1001D348 size:00052CB8

addr:30002130 size:001FDED0

I2C scanner. Scanning ...
Found address: 1 (0x1)
Found address: 2 (0x2)
Found address: 3 (0x3)
Found address: 4 (0x4)
Found address: 5 (0x5)
Found address: 6 (0x6)
Found address: 7 (0x7)
Found address: 8 (0x8)
Found address: 9 (0x9)
Found address: 10 (0xA)
Found address: 11 (0xB)
Found address: 12 (0xC)
Found address: 13 (0xD)
Found address: 14 (0xE)
Found address: 15 (0xF)
Found address: 16 (0x10)
Found address: 17 (0x11)
Found address: 18 (0x12)
Found address: 19 (0x13)
Found address: 20 (0x14)
Found address: 21 (0x15)
Found address: 22 (0x16)
Found address: 23 (0x17)
Found address: 24 (0x18)
Found address: 25 (0x19)
Found address: 26 (0x1A)
Found address: 27 (0x1B)
Found address: 28 (0x1C)
Found address: 29 (0x1D)
Found address: 30 (0x1E)
Found address: 31 (0x1F)
Found address: 32 (0x20)
Found address: 33 (0x21)
Found address: 34 (0x22)
Found address: 35 (0x23)
Found address: 36 (0x24)
Found address: 37 (0x25)
Found address: 38 (0x26)
Found address: 39 (0x27)
Found address: 40 (0x28)
Found address: 41 (0x29)
Found address: 42 (0x2A)
Found address: 43 (0x2B)
Found address: 44 (0x2C)
Found address: 45 (0x2D)
Found address: 46 (0x2E)
Found address: 47 (0x2F)
Found address: 48 (0x30)
Found address: 49 (0x31)
Found address: 50 (0x32)
Found address: 51 (0x33)
Found address: 52 (0x34)
Found address: 53 (0x35)
Found address: 54 (0x36)
Found address: 55 (0x37)
Found address: 56 (0x38)
Found address: 57 (0x39)
Found address: 58 (0x3A)
Found address: 59 (0x3B)
Found address: 60 (0x3C)
Found address: 61 (0x3D)
Found address: 62 (0x3E)
Found address: 63 (0x3F)
Found address: 64 (0x40)
Found address: 65 (0x41)
Found address: 66 (0x42)
Found address: 67 (0x43)
Found address: 68 (0x44)
Found address: 69 (0x45)
Found address: 70 (0x46)
Found address: 71 (0x47)
Found address: 72 (0x48)
Found address: 73 (0x49)
Found address: 74 (0x4A)
Found address: 75 (0x4B)
Found address: 76 (0x4C)
Found address: 77 (0x4D)
Found address: 78 (0x4E)
Found address: 79 (0x4F)
Found address: 80 (0x50)
Found address: 81 (0x51)
Found address: 82 (0x52)
Found address: 83 (0x53)
Found address: 84 (0x54)
Found address: 85 (0x55)
Found address: 86 (0x56)
Found address: 87 (0x57)
Found address: 88 (0x58)
Found address: 89 (0x59)
Found address: 90 (0x5A)
Found address: 91 (0x5B)
Found address: 92 (0x5C)
Found address: 93 (0x5D)
Found address: 94 (0x5E)
Found address: 95 (0x5F)
Found address: 96 (0x60)
Found address: 97 (0x61)
Found address: 98 (0x62)
Found address: 99 (0x63)
Found address: 100 (0x64)
Found address: 101 (0x65)
Found address: 102 (0x66)
Found address: 103 (0x67)
Found address: 104 (0x68)
Found address: 105 (0x69)
Found address: 106 (0x6A)
Found address: 107 (0x6B)
Found address: 108 (0x6C)
Found address: 109 (0x6D)
Found address: 110 (0x6E)
Found address: 111 (0x6F)
Found address: 112 (0x70)
Found address: 113 (0x71)
Found address: 114 (0x72)
Found address: 115 (0x73)
Found address: 116 (0x74)
Found address: 117 (0x75)
Found address: 118 (0x76)
Found address: 119 (0x77)
Done.
Found 119 device(s).

My code for reading dissolved oxygen is as under:

#include <Wire.h>


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

char myChar = 'R';
int reading=0;
void loop() {
  // step 1: instruct sensor to read echoes
  Wire.beginTransmission(97); // transmit to device #97(0x70)
  // the address specified in the datasheet is 224 (0xE0)
  // but i2c adressing uses the high 7 bits so it's 97

Wire.write(myChar);   // command sensor to measure in "inches" (0x50)

  Wire.endTransmission();      // stop transmitting
delay(600);
  // step 4: request reading from sensor
  Wire.requestFrom(97, 6);    // request 2 bytes from slave device #97

  // step 5: receive reading from sensor
  if (6 <= 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
  }

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

I am getting error as:

requestFrom: readed=0, quantity=6 : ERROR
requestFrom: readed=0, quantity=6 : ERROR

A very humble request to please help me on this.

thanks a lot.

Hi,

Circuit: I2C_SCL connected to RX pin of sensor, I2C_SDA connected to TX. both through 4.7k resistor.

I think your 4k7 resistor should not be in the SCL and SDA lines but each resisitor is FROM the SDA and SCL lines to 5V.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Tom... :slight_smile:

Quote:

"I think your 4k7 resistor should not be in the SCL and SDA lines but each resisitor is FROM the SDA and SCL lines to 5V."

Yes it is as you have mentioned. My circuit diagram is attached.

Hi,
Why are you using a Ameba RTL8195A board, when the Dissolved Oxygen Circuit unit has I2C?

There is even sample code and circuit fritzy on how to connect and get readings directly from it.

All from the link you provided.!!!

[http://www.atlas-scientific.com/product_pages/circuits/ezo_do.html](http://"http://" http://www.atlas-scientific.com/product_pages/circuits/ezo_do.html"")

Tom... :o :o :o

Hi

The reason is i have to get the sensor out in the field and get the readings with wireless. ameba has wifi capability and also I2C protocol to communicate with this sensor.

Would you please tell me what is the other option instead of ameba?

The I2C scanner does not work because the module starts in UART mode by default. Page 38 of this data sheet shows how to put it into I2C mode and set the address. Note the LED color change on successful mode switch.

It may be simpler to set up a software serial port (if you don't have a spare hardware port) and communicate through the UART.

groundFungus:
The I2C scanner does not work because the module starts in UART mode by default. Page 38 of this data sheet shows how to put it into I2C mode and set the address. Note the LED color change on successful mode switch.

It may be simpler to set up a software serial port (if you don't have a spare hardware port) and communicate through the UART.

The color of the sensor is already blue on startup. It remains blue regardless which probably means its in I2C already.

Also, can you please guide me how do I set up software serial port and communicate through UART? is there any code available for communicating through UART ?

Thanks

From the link that YOU posted under Downloads, Arduino Uno Sample Code.

Wiring and a link to download sample code . Uses software serial.

groundFungus:
From the link that YOU posted under Downloads, Arduino Uno Sample Code.

Wiring and a link to download sample code . Uses software serial.

Thank you. I will try this, hope not much different for Ameba RTL8195A that I am using.

sal_murd:
Thank you. I will try this, hope not much different for Ameba RTL8195A that I am using.

Read ALL of post #7.....
Tom... :slight_smile:

TomGeorge:
Read ALL of post #7.....
Tom... :slight_smile:

I did reply on post#8 for post#7. What is that I am missing ?

Hi,
even using software serial as mentioned in post#7, there is no communication occurring between ameba and dissolved oxygen sensor. please check the screen shot. i am using pin 0 as Rx and pin 1 as Tx, and used the sample code with the pin numbers changed accordingly.

thankyou for your help

This post appeared on the Sparkfun forum as well, and the OP clearly has not bothered to read the data sheet for the sensor. Which, incidentally, has very detailed operating instructions.

The code posted was obviously intended for a ping sensor.

Wire.write(myChar);   // command sensor to measure in "inches" (0x50)

What a waste of everyone's time!

jremington:
This post appeared on the Sparkfun forum as well, and the OP clearly has not bothered to read the data sheet for the sensor. Which, incidentally, has very detailed operating instructions.

The code posted was obviously intended for a ping sensor.

Wire.write(myChar);   // command sensor to measure in "inches" (0x50)

What a waste of everyone's time!

MyChar was declared in the code as 'R' to read from sensor as I understood from the datasheet (forget about the comments) .
I have used other codes after that and lastly used software serial code, but it still did not work. can you please suggest the way forward since you seem to understand the problem well enough. Would be very thankful to you.

Hi

Based on the code (I2C communication) provided in the datasheet, it seems the code is working, however, i have to "send" the letter R (which takes the procedure into pending) and then "send" ("success") again, then I get one read. any method where I can get these measurements automatically without having to "send" manually?
snapshot attached

Please support

can you please suggest the way forward

Post the code you are currently attempting to use, in code tags, and explain the problem.

Read the "How to use this forum" post for detailed instructions.