I'm trying to troubleshoot an I2C issue between an arduino nano and an ir camera.
I keep getting 'no devices found' using an I2C scanner.
Here is what I've done or tried so far :
I plugged the camera to +5V, GND, SDA to A4 and VCL to A5.
I checked with a multimeter for possible shorts from above inputs. No beeps.
I checked the voltage at +5V when the camera is connected (read 4.7V)
I tried with/without 4.7kohm resistors between SDA/SCL and +5V.
I tried without plugging the camera, same 'no devices found' message.
The camera LED is on. (Operating voltage: 3.3-5v from datasheet)
I'm using a second hand nano board, not sure if it is a copy.
I'm using a portable version of arduino rev 1.8.8.
I tested sucessfully the blinking led program on my nano board.
Thank in advance is someone can help.
I'm still working on it, I'll update this thread if I found something else.
Actually, I wouldn't even look at my code if an I2C scanner (I use Nick Gammons) doesn't Report the device. If the scanner doesn't see the device, my code probably wouldn't either.
The SCL and SDA lines are usually pulled high so they should read near 5 Volts all the time. While running the I2C Scanner, they will be constantly yanked between ground and 5V at a high Speed, so you should be reading some voltage Level around for example 2.5 Volts while the I2C scanner is active (probably a Little higher).
JaBa:
Actually, I wouldn't even look at my code if an I2C scanner (I use Nick Gammons) doesn't Report the device. If the scanner doesn't see the device, my code probably wouldn't either.
The SCL and SDA lines are usually pulled high so they should read near 5 Volts all the time. While running the I2C Scanner, they will be constantly yanked between ground and 5V at a high Speed, so you should be reading some voltage Level around for example 2.5 Volts while the I2C scanner is active (probably a Little higher).
Test AT THE CAMERA, not on the Arduino. That will help detect cabling Problems. Also make sure that you didn't cross SCL/SDA which is also a common mistake.
you might try using 0x58 for the address instead of 0xb0.
0xb0 (0b10110000) is 0x58 (0b01011000) << 1. In looking at the twi.cpp code, when the address is set the parameter is <<1:
void twi_setAddress(uint8_t address)
{
// set twi slave address (skip over TWGCE bit)
TWAR = address << 1;
}
When you send 0xb0 (i.e. 0x58 << 1), it could be that there's a 2nd <<1 performed in the library. You can try it and/or check over the lib source.
Thank you, will try.
But I guess I have to fix the i2c scaning issue first ?
JaBa:
Test AT THE CAMERA, not on the Arduino. That will help detect cabling Problems. Also make sure that you didn't cross SCL/SDA which is also a common mistake.
You mean unplugged ?
I don't get it.
Edit: I see. Here is a pic of the camera:
It won't be easy to test it. I'll try to measure the metal tip at the connectors end.
JaBa:
Test AT THE CAMERA, not on the Arduino. That will help detect cabling Problems. Also make sure that you didn't cross SCL/SDA which is also a common mistake.
I dit a test with a multimeter. SCL & SDA are steady at 4.7v.
No variation while scaning with i2c test code.
I also tried the visible conductive part of the ir camera, same result.
Ok, that is strange. Let's do a sanity check here. Run the I2C scanner WITHOUT plugging the camera in. Obviously, the camera can't be found but in order to find the Problem we Need to divide and conquer. If the voltage acts as expected WITHOUT the camera plugged in, then the Problem is something at the camera end. If the voltages act as suspicously WITHOUT the camera, then something is wrong on the Arduino end.
JaBa:
Ok, that is strange. Let's do a sanity check here. Run the I2C scanner WITHOUT plugging the camera in. Obviously, the camera can't be found but in order to find the Problem we Need to divide and conquer. If the voltage acts as expected WITHOUT the camera plugged in, then the Problem is something at the camera end. If the voltages act as suspicously WITHOUT the camera, then something is wrong on the Arduino end.
Hello,
I did a gentle scratch with a knife around pin A4, and there was like a dirty layer of burnt plastic.
This was the problem, there was no conductivity with the external pin.
It's all working fine now.
Thank you sir for your help.
Hope it might help someone else one day.