Arduino Uno + AS7262 SparkFun Spectral Sensor I2C Error


#1

I recently bought the SparkFun AS7262 Spectral Sensor for visible light.


I’m not using the Qwiic cabling as detailed in SparkFun’s hookup guide(https://learn.sparkfun.com/tutorials/as726x-nirvi?_ga=2.46616111.944092787.1515347549-1106913075.1512055668), I’m using jumper cables through a breadboard.

It’s a 3v3 board that uses the I2C protocol (by default). I’m attempting to use it with the Arduino Uno (which uses 5v logic) so I’ve wired it through the Adafruit I2C friendly logic level converter.

The only response I can get from the sensor is an I2C error (using the SparkFun library (link is on the hookup guide page) and SparkFun’s minimal code example (also on the hookup guide page)).

I have tripled checked the wiring and used a multimeter to check continuity. I’ve also tried replacing the spectral sensor with an Adafruit humidity sensor (also 3v3 and I2C), and the humidity sensor works perfectly. I’ve tried using a simple script to detect attached I2C devices, but it fails to find anything when the spectral sensor is attached.

Can anyone help me diagnose what is going on with this sensor?

Thank you!


#2

The AS7262’s datasheet says that the maximum tolerated voltage is 5V, and when I got mine I initially ran it directly from the Uno without a level shifter (I’m 95% sure I was powering it from the 3v3 pin but had nothing between the breakout and the Uno’s I2C pins). I’d guess that this isn’t really recommended (the I2C interface vmax is 3.6V…) but I had no problems with it.

Does the I2C detection script pick up any other I2C device? It sounds to me like an issue with the logic converter.

EDIT: Now that I think about it I may have run it on an Adafruit Feather, which generally run at 3.3V. That would make more sense. Any odds you have one of those lying around? Alternatively if you’ve got a Pi I’ve put together a bunch of functions for talking to the AS7262 if you think it would be worth trying that, even just to confirm that the breakout works.


#3

Thanks Shoe!

I was tempted to try 5V as I saw on the datasheet that this should be tolerated (though if I remember correctly it strongly suggests you don’t operate it using 5V), but this might be worth a try just to check it isn’t a power problem.

I’ve tried two other boards through the logic converter, and they both work fine, so it shouldn’t be a problem there.

Great idea with the Pi! I’ve got one around, so I’ll enable the I2C and see if it can detect the AS7262. As you say, I should at least be able to confirm that the problem is the board (or not).

Thanks again!


#4

If you’ve got a Pi maybe don’t go down the 5V route then, although it’s odd that other boards have been working through the logic converter OK.

I guess someone with a greater knowledge of logic converters is needed here.

EDIT: just saw this on the shifter product page:

The 10K’s do make the interface a little more sluggish than using a TXB0108 or 74LVC245 so we suggest checking those out if you need high-speed transfer.

Not sure if this could be responsible?


#5

My brains a little frazzled to be diving into this, but are there any i2c pullups on the SparkFun sensor?

And, for that matter, are there any pull-ups on the Arduino Uno? It’s been so long since I’ve used one, I can’t recall.

Depending on what the Arduino recognises as “on”, and whether pull-ups are built in, it might be possible to run the sensor without a level shifter, using only pull-ups to 3.3v. Since the Arduino is only supposed to pull those pins LOW and never drive them HIGH then +5v should never be present on the i2c bus.


#6

The default baud rate for the AS7262 is 115200, I’m not sure if that counts as ‘high-speed transfer’. In any case, I did try changing the baud rate to 9600 (both in the SparkFun library and on the open serial window). That’s the same baud rate as I ran the other sensors through the logic converter without a problem, but I still got the I2C error from the AS7262.

@Gadgetoid I’m not sure about the pullup situation, I don’t think they’re in the spec for the AS7262, and all the other sensors I have to hand happen to be Adafruit sensors with built in 3v3/5v logic conversion. Given the other sensors work through the logic level converter, it seems unlikely it is to blame.

I’ve just tried the AS7262 with the Pi, same problem. No recognised devices over I2C… tried a different sensor, and that was fine. So it seems either the AS7262 was dead on arrival, or perhaps the board is fine and there is some problem with the firmware in the flash memory that (if I understand correctly) implements the I2C protocol…


#7

The default baud rate for the AS7262 is 115200

Doesn’t that just apply to the UART interface though? You’re not plugging the UART pins into the I2C pins are you? What’s your soldering like on the headers?


#8

All I meant is that the library itself starts the serial interface at 115200bps (which is what I thought I was doing wrong initially, as I was opening the monitor at 9600).

I’ve wired the I2C pins, not the serial pins on the opposite side of the board. I have gone over the soldering and rechecked with the multimeter, everything is connected but still no response from the chip. I also tried connecting the reset pin in case a spurious voltage was causing the board to continuously reset. That can make the on board LED to light up, but still no connection over I2C!