Hi, I'm trying to get the Grove Sunlight Sensor working with the manufacturer's example code...
With the Arduino UNO, I can make it work by connecting the SDA and SCL to the respective inputs on the UNO, in addition to the 5v and GND. But the same not with the Arduino MKR 1010 WIFI, neither connecting pins 11 and 12 (SDA and SCL) and 5v and GND on the board (without the carrier), nor connecting it by Glove cable to the TWI (Two-Wire Interface) connector of the MKR Connector Carrier.
Is it that to run on the Arduino MKR 1010 WIFI? Do I need to change the code or add something? Or maybe I'm connecting it wrong?
It's extremely hard to tell, from my side, as you didn't provide any photos or diagrams of your wiring. Or, any code. Did you read the forum instructions when you posted?
So what voltage do you supply to that sensor board?
It could be that it is a 5V board, in which case connecting it to a 3V3 MKR 1010 Board will damage the MKR unless you have an I2C level shifter between the two boards.
The sunlight sensor page you provided a link to says that it will operate from 3.0-5.5V at around 3.5mA. Supply it with 3.3V from your MKR1010 and your logic levels will be correct.
I'm not a MKR user so don't know if the I2C device scanner code works for your board. If it does, I'd start by seeing if your sensor can be detected.
I've started with the manufacturer's example code, it's in the attached link, but I'll repeat it here too:
#include "Si115X.h"
Si115X si1151;
void setup() {
uint8_t conf[4];
Wire.begin();
Serial.begin(115200);
if (!si1151.Begin())
Serial.println("Si1151 is not ready!");
else
Serial.println("Si1151 is ready!");
}
void loop()
{
Serial.println(si1151.ReadHalfWord());
Serial.println(si1151.ReadHalfWord_VISIBLE());
Serial.println(si1151.ReadHalfWord_UV());
delay(100);
}
With this code, with the Arduino UNO, connected to the Grove Sunlight Sensor at the SDA, SCL, 5v and GND inputs (I also tried it with 3.3v), everything goes well.
The same code, with the Arduino MKR 1010 WIFI, connecting to connectors 11 and 12 (which are supposed to be the SDA and SCL inputs of the MKR 1010) and also to 3.3v and GND... it doesn't work anymore, I get this error:
Arduino:1.8.19 (Linux), Board:"Arduino MKR WiFi 1010"
sketch/testes.ino.cpp.o: In function `loop':
/home/pi/Documents/Arduino projects/testes/testes.ino:27: undefined reference to `Si115X::ReadHalfWord()'
/home/pi/Documents/Arduino projects/testes/testes.ino:29: undefined reference to `Si115X::ReadHalfWord_VISIBLE()'
/home/pi/Documents/Arduino projects/testes/testes.ino:31: undefined reference to `Si115X::ReadHalfWord_UV()'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino MKR WiFi 1010.
I hope that with that you have more information and can help me.
Thank you very much!
I don't think you understand what I am saying. Why post a question if you are going to dismiss an answer without even trying it. OK your loss.
Best of luck with your project, I will not reply again in this thread.
Goodbye.
I don't think it's a 3.3 or 5v problem. Maybe, I don't know how to connect an I2C sensor, not directly through the pin connectors or the carrier...
It could also be that I need a lib for the Arduino MKR WiFi 1010 that the UNO already has on one's chip AVR board, and the other is SAMD)...
I'll keep trying; thanks!
Interesting, I unplugged my new i2c sensor of the MKR WiFi 1010, and now the scanner returns two devices... So, I understand that the i2c address of my new Grove Sunlight Sensor is 0x53!
The 2 other I2C devices are likely on-board your MKR1010 board. I don't have the details to hand at the moment so I can't enlighten you as to what they are.
EDIT: They are the crypto unit and the radio module.