So I got an UV radiation sensor (UV sensor) and a humidity sensor (Humidity sensor) which both work well with my arduino uno but when I try them with a different board they simple don't work (I'm using the libraries included in the links). All I get is a message saying the sensors weren't detected.
The board I'm using is based on the Atmega 2560 micro controller and everything else about it works well except for those sensors. I couldn't find any reference to the board it self online but it is basically an arduino mega 2560.
I cant use any other board as this is for a competition where we are restricted to the one they give us.
Thanks in advance and sorry if this isn't the correct section couldn't find one that fitted the problem.
I'm guessing that the board you got the sensors working on was an UNO and the one that "fails" is a mega. This will be due to the pins for I2C being different. I'd also hazard a guess that the humidity sensor you're using is one of those I2C variants so you have the same problem here too.
Doubt we'll ever get to the bottom of this unless you furnish details, but I suspect that you've already realised your mistake so we're unlikely to hear any more about it.
It uses I2C and there is nothing strange in the source code. I think it will work on a ATmega2560.
Did you try the example with that library ? I mean: just the example, no other code.
It is possible that the i2c_scanner detects a I2C device, but due to bad power supply of the sensor it does not work when used in a normal way. That situation is very exceptional, maybe if you have a bad breadboard, or very long wires.
Thats very strange, I can not see something in the code that would not work on the Mega.
The UV sensor GND is connected to the Mega GND ?
And the UV sensor Vin to the Mega 5V ?
And you use Arduino IDE 1.6.0 ?
And you don't use a flat ribbon cable for I2C ? because the I2C bus doesn't like that.
I have no more ideas. Sorry.
It is almost impossible that it is something in the bootloader.
What did the example say ? I guess "Adafruit SI1145 test", and after that ? "Didn't find Si1145" or "OK!" ?
You could make a photo of it, perhaps we can see something that is odd.
I cant imagine whats going wrong either! I have been playing with arduinos for about 3 to 4 years and have never experienced nothing like this.
Here are some photos of the wiring and the serial output:
thanks any way for your time. If I find any solution I will give news.
I had already measured the 5V and just measured now to confirm got 4.97v.
Changed the bread board location still "no sensor found".
So I changed the library to output the id and it printed 64, so changed:
uint8_t id = read8(SI1145_REG_PARTID);
if (id != 0x45) return false; // look for SI1145
uint8_t id = read8(SI1145_REG_PARTID);
if (id != 64) return false; // look for SI1145
And it started to print values but they weren't making much sense so I tried it with the uno and the values didnt match up so it wasnt solved. While using the uno the sensor id outputed by the library mod I did was 69 but why does it changes?? Is the tminus board requesting a different byte??
No. The I2C is always the same.
0x45 = 69 and 64 = 40.
That is missing two bits of the SDA. The SDA is kept too low for too long ? Or there are wrong spikes on the SCL line.
Is one of the wires broken or half-broken ?
Or the SI1145 is damaged ?
SI1145 cant be damaged as it works with the uno right?? I also used the same wires with the uno so they aren't the problem.
So how do I know if the SDA is kept too low for too long ? Or there are wrong spikes on the SCL line?
The Adafruit board has pullup resistors on both sides of the onboard level shifter. Two times 10k, that is about 5k for each. There could be a fault with those pullup resistors, so you can try extra 4k7 or 10k pullup resistors.
Finally I have a good idea: I think 10% chance that there is not enough decoupling of the 5V of the ATmega2560 and 20% chance the ATmega2560 has damaged I2C pins. Perhaps you have to give up on this board.
Could you add capacitors to the 5V and GND pins. Small ones 100nF but also larger ones, 22uF to 1000uF.
You also need another board to test the I2C, that is the only way to determine if the I2C pins are damaged.
It is not enough to test the output and input function of the I2C pins, because there is also I2C hardware inside the ATmega2560 chip.