I'm using a VEML7700 lux sensor board from adafruit and I am unable to get the correct readings printing to the serial monitor. The only thing that is being printed to the serial monitor is the first print statement as shown in the screenshot below.
The code provided below that I have used is an example from adafruit's library for the sensor. My problem is very similar to the one presented in this post Problem Getting Readings from VEML7700
The board I'm using is a Arduino Nano 33 BLE Sense Rev2.
I am also on Arduino IDE Version 2.0.3.
The Arduino is being powered through the USB cable and the sensor is powered through the Arduino's +3V3 OUT pin connected to the positive voltage rail on the breadboard. I've checked for continuity between pins with a multimeter and everything seems to be connected fine. The sensor board's VIN pin gets 3.27 volts
according to my multimeter. Here is a rough sketch of a schematic of my connections as well as the Arduino pinout.
Thanks for using code tags when you posted your code, not many newbies do that.
Also I approve of your breadboarding technique. That's how I use them too.
But please don't post screen shots of, for example, serial monitor, or other screens that could be copied and pasted as text into your post (again, between code tags).
Have you tried 2x 3K3 pull-up resistors between the SDA and SCL pins and 3.3V? To be honest, if i2c scanner sketch runs ok this is probably not the problem.
The serial monitor in your picture seems to show the text "VEML7700 Demo" but this message doesn't seem to appear anywhere in the sketch you posted?
Thank you for the feedback about my post. I'll keep in mind to avoid posting screenshots in the future.
As for the pull up resistors, they didn't work. I measured the resistance between the SDA & SCL pins to VIN and they both measure 10k so I should be fine in that aspect.
However, I also have a Metro Mini purchased from Adafruit and the sketch seems to work exactly as intended. Maybe there's some compatibility issue here? I'm not sure. https://learn.adafruit.com/adafruit-metro-mini/overview
Oh, and the "VEML7700 Demo" message was a screenshot from when I attempted uploading one of the other example sketches for an SSD1306 OLED that also didn't work. They replace the "Adafruit VEML7700 Test" print message to "VEML7700 Demo" in this one. VEML7700_oled.ino (1.0 KB)
The Metro Mini is a 5V board and the Nano 33 is 3.3V, but the Adafruit page for the VEML7700 seems to say it works with either, and to connect it's Vin pin to the supply voltage the Arduino board you are using. (Although I don't understand how the sensor board can output 3.3V if it is only given 3.3V input).
Another difference between the Metro Mini and the Nano 33 is that one is 8 bit and the other is 32 bit. But Adafruit sell plenty of 32 bit boards, they must have tested their sensor with those too.
Okay, thank you for taking your time to try and help me out.
I guess for now I'll just use Sparkfun's library for the VEML7700, although I am a bit disappointed. I would have preferred to use Adafruit's since theirs seems to have many more configuration settings & functions.
Sparkfun's library works but Adafruit's doesn't, with the same hardware setup? That would seem to prove there's nothing wrong with the hardware.
Please post the working sketch with the Sparkfun library. Maybe the forum can spot some difference that would explain why the Adafruit version is not working.
/*!
* @file Example1_getLux.ino
*
* This example was written by:
* Paul Clark
* SparkFun Electronics
* November 4th 2021
*
* This example demonstrates how to initialize the VEML7700 and then get the ambient light lux.
*
* Want to support open source hardware? Buy a board from SparkFun!
* <br>SparkX smôl Environmental Peripheral Board (SPX-18976): https://www.sparkfun.com/products/18976
*
* Please see LICENSE.md for the license information
*
*/
#include <SparkFun_VEML7700_Arduino_Library.h> // Click here to get the library: http://librarymanager/All#SparkFun_VEML7700
VEML7700 mySensor; // Create a VEML7700 object
void setup()
{
Serial.begin(115200);
Serial.println(F("SparkFun VEML7700 Example"));
Wire.begin();
//mySensor.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial
// Begin the VEML7700 using the Wire I2C port
// .begin will return true on success, or false on failure to communicate
if (mySensor.begin() == false)
{
Serial.println("Unable to communicate with the VEML7700. Please check the wiring. Freezing...");
while (1)
;
}
Serial.println(F("Lux:"));
}
void loop()
{
Serial.println(mySensor.getLux(), 4); // Read the lux from the sensor and print it
delay(250);
}