0

I am using a dissolved oxygen circuit from Atlas Scientific. I connected the device to my Raspberry Pi 3 and ran the command to interact with the device.

Montage

The LED on my device is blue which means that it is in i2c mode and it is recognized by the Raspberry Pi.

My problem is that when I try to input a command, I always get the "Query failed" output.

try:
    print(device.query(input))
except IOError:
    print("Query failed")

def query(self, string):
        # write a command to the board, wait the correct timeout, and read the response
        self.write(string)

def write(self, cmd):
        # appends the null character and sends the string over I2C
        cmd += "\00"
        self.file_write.write(cmd)

This happens for any command (for example, if I enter "I" I should get the device information, but I end up with the "Quert Failed").

Also, when I try to execute the "Poll" command (which also calls the query method), the program exits on the line self.file_write.write(cmd) with the following error:

IOError: [Errno 5] Input/output error

Does this mean I can't read or write my i2c device?

  • 1
    Please insert the relevant code into your question not a link? Also we will need to see pics of all connections and the scan of the I2c bus to confirm the device is recognized. – Steve Robillard Oct 11 '16 at 9:37
  • The code also appears to be interactive so please also state what input you gave the script. A screen transcript might be useful. – joan Oct 11 '16 at 9:39
  • 1
    A code snippet is little use. How do we know you are talking to the correct I2C bus? For all we know you are talking to bus 30 which doesn't exist on the Pi. IOError 5 means you are using the wrong bus or you have a poor, loose, or missing connection or the GPIO are in the wrong mode, or you are talking to the wrong device address, etc. – joan Oct 11 '16 at 10:36
  • Have you tried i2cdetect to see if the device can be found on the bus ? – KennetRunner Oct 11 '16 at 14:24
  • Yes and it is actually detected. Strange thing is I just tried with a pH device and everything is working fine. – Antoine Delia Oct 11 '16 at 14:25
1

I found the solution to my problem. As @KennetRunner pointed out, the address used was for a pH sensor. I had to change the address to 97 (which is the correct one for the dissolved oxygen sensor) and everything worked!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.