Build it step by step
0 of 8 doneInstall the libraries
VEML7700, SSD1306 and GFX.
Wire the sensor
VCC, GND, SDA to A4, SCL to A5.
Wire the display
Same four wires on the same pins.
Add the button
D2 to GND.
Upload the sketch
A lux value and a band appear.
Cover the sensor
The value falls toward zero.
Save a spot
Press the button on a bright windowsill.
Compare
Move to a shelf and read the difference.
How do you build a plant shelf light meter?
A digital light sensor reads lux on a plant shelf and shows whether the spot is dim, medium or bright for common houseplants. You need Arduino Nano, VEML7700 lux sensor, SSD1306 OLED Display, Tactile push button 6 mm and Breadboard 830 Tie Points. It takes 8 steps and about 60 minutes.
- Level
- Beginner
- Time
- About 60 min
- Parts
- 5
Parts list
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Sensor VCC | Nano 5V | Check your board accepts 3.3 V to 5 V |
| Sensor GND | Nano GND | Common ground |
| Sensor SDA | Nano A4 | I2C data |
| Sensor SCL | Nano A5 | I2C clock |
| OLED VCC and GND | Nano 5V and GND | Check the label on your module |
| OLED SDA and SCL | Nano A4 and A5 | Same bus as the sensor |
| Button | Nano D2 to GND | Saves a reading for comparing two spots |
Code
The VEML7700 is a digital ambient light sensor that reports illuminance in lux directly over I2C. Lux is the unit used for plant light advice: a bright sunny windowsill gives tens of thousands of lux, a bright room with no direct sun gives a few thousand, and a dim corner a few hundred. The sketch turns the reading into three bands, Dim, Medium and Bright, which is a rough guide only because every plant has its own needs, so check the label of your plants. The button saves the current reading so you can move the sensor to another spot and compare, which is the best use of the meter: you can find the brightest place on a shelf, or see how much light a curtain removes. Always point the sensor the same way as the leaves face, and shade it from the display light. At very high light the library may need its auto-ranging method to stay accurate, which newer versions provide. Remember that light changes through the day, so measure at noon and again in the evening.
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
#include <Wire.h>
#include <Adafruit_VEML7700.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_VEML7700 veml;
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
float saved = -1;
bool wasDown = false;
// Rough guide for houseplants: below 1,000 lux is dim, up to 10,000 is medium (bright indirect),
// above that is bright. Plants differ, so check the label of yours.
const char* band(float lux) {
if (lux < 1000) return "Dim";
if (lux < 10000) return "Medium";
return "Bright";
}
void setup() {
Serial.begin(9600);
pinMode(2, INPUT_PULLUP);
if (!veml.begin()) { Serial.println("VEML7700 not found"); while (1) { } }
if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { Serial.println("OLED not found"); while (1) { } }
oled.setTextColor(SSD1306_WHITE);
}
void loop() {
float lux = veml.readLux();
bool down = (digitalRead(2) == LOW);
if (down && !wasDown) saved = lux; // save this spot for comparison
wasDown = down;
oled.clearDisplay();
oled.setTextSize(2);
oled.setCursor(0, 0);
oled.print(lux, 0); oled.println(" lx");
oled.print(band(lux));
oled.setTextSize(1);
oled.setCursor(0, 44);
if (saved >= 0) { oled.print("Saved: "); oled.print(saved, 0); oled.print(" lx"); }
else oled.print("Press to save a spot");
oled.display();
Serial.println(lux);
delay(500);
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
VEML7700 not found
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Room light | A few hundred lux |
| Sensor near a window | Several thousand lux |
| Hand over the sensor | Falls close to zero |
| Press the button | Saved value appears |
| Torch pointed at the sensor | Large jump |
If it does not work
Sensor not found
Check SDA, SCL and power.
Values far too low
The sensor is facing away from the light.
Display blank
Try address 0x3D instead of 0x3C.
Readings flicker
Indoor LED lamps can flicker, average several readings.
Reads very high in sun
Use the library auto-ranging method.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the plant shelf light meter?
Arduino Nano, VEML7700 lux sensor, SSD1306 OLED Display, Tactile push button 6 mm and Breadboard 830 Tie Points.
How long does the plant shelf light meter take to build?
About 60 minutes for a beginner maker, in 8 steps.
How do I know the plant shelf light meter works?
Room light: A few hundred lux. Sensor near a window: Several thousand lux. Hand over the sensor: Falls close to zero.
Sensor not found: what should I check?
Check SDA, SCL and power.
Values far too low: what should I check?
The sensor is facing away from the light.
Display blank: what should I check?
Try address 0x3D instead of 0x3C.
Readings flicker: what should I check?
Indoor LED lamps can flicker, average several readings.
