
VEML7700 Light Sensor Library for Proteus Simulation

Hello friends, I hope you all are doing great. Today, I am going to share the new VEML7700 Light Sensor Library for Proteus Simulation. The VEML7700 is a tiny ambient light sensor that measures light the way the human eye sees it, from a moonless night at 0.0042 lux to full sunlight at 140,000 lux, and hands the result to your Arduino over I2C. Covering that huge range takes a little skill - the right gain and the right integration time for each light level - and with this library you can run a full Proteus simulation of the VEML7700 breakout and watch exactly how that works.
VEML7700 Light Sensor Library for Proteus
Latest version: V1.0 (December 2026, this tutorial)
Helping Tools
- Serial Monitor Advance: a serial terminal window for the UART of your board
- Serial Monitor Expert: the serial monitor with extra debugging tools
- LCD Library for Proteus V3.0: 16x2, 20x4 and I2C LCDs to show your readings
The demo is an automatic street light: the sensor measures the light through a whole day in fast time, the sketch changes the gain and the integration time as the light changes, a 16x2 LCD shows the lux, and a white LED - the street lamp - dims up at dusk and switches off in the morning.
NOTICE: Our team has put a lot of effort into these small parts: the bodies, the animation and the pop-ups are all our own design, and you get them free. Your feedback is the fuel that keeps us going, so please tell us what you think in the comments below or in the light sensor board of our forum. And if our free libraries help you, you can buy us a coffee. So, let's get started with the VEML7700 Light Sensor Library for Proteus Simulation:
What Is the VEML7700 Light Sensor?
The VEML7700 is a high-accuracy ambient light sensor in a clear 6.8 x 2.35 mm package. Its photodiode has a spectral response close to the human eye, so it reports illuminance in lux rather than raw "brightness", and a second channel - WHITE - sees a broader part of the spectrum. A 16-bit ADC with a selectable gain and integration time does the rest. On a breakout board it gets a 3.3 V regulator and I2C pull-ups, so it runs from a 5 V Arduino directly.
| VEML7700 | |
|---|---|
| Range | 0 to about 140,000 lx |
| Best resolution | 0.0042 lx per count (gain x2, 800 ms) |
| Interface | I2C at 0x10, 16-bit registers, LSB first |
| Gain | x2, x1, x1/4, x1/8 |
| Integration time | 25, 50, 100, 200, 400, 800 ms |
| Supply current | 45 uA measuring, 0.5 uA shut down |
| Pins (module) | VIN GND SCL SDA |
Sixteen-Bit Registers, Low Byte First
The VEML7700 has eight "command codes", each a 16-bit register. Register 0x00, ALS_CONF_0, holds the whole setup: the gain in bits 12 and 11, the integration time in bits 9 to 6, the persistence, the interrupt enable and, in bit 0, the shutdown. 0x04 holds the light reading (ALS) and 0x05 the WHITE channel; 0x01 and 0x02 are the threshold window, 0x03 the power saving modes, 0x06 the interrupt status and 0x07 the ID, 0xC481. Every register travels low byte first - the opposite of most I2C sensors, and a classic source of scrambled readings.
It Starts Asleep
At power-on ALS_CONF_0 is 0x0001: the shutdown bit is set and the sensor does nothing. The first thing any sketch must do is write the configuration with bit 0 cleared. The maker's application note then asks for 2.5 ms of wake-up time, and the first result appears only after one whole integration time - 100 ms at the usual setting. The simulation keeps exactly these rules, so a sketch that forgets to wake the sensor reads zero forever.
Gain, Integration Time and Resolution
The reading is a count from 0 to 65,535, and the lux is the count times the resolution. The resolution depends on the setting: 0.0042 lx per count at gain x2 and 800 ms, twice as much for every halving of the time, and 2, 8 or 16 times as much at gain x1, x1/4 and x1/8. So the most sensitive setting is full at 275 lx, while x1/8 with 25 ms reaches about 140,000 lx. No single setting covers both a dark street and a sunny afternoon - which is why the maker recommends auto-ranging: start at gain x1/8 and 100 ms; if the count is 100 or less, raise the gain, then the time; if it is above 10,000, go the other way.
The Non-Linearity Above 1,000 lux
Up to about 1,000 lx the counts are strictly proportional to the light. Above that the sensor compresses a little, and the maker gives a correction for gain x1/4 and x1/8: lux = 6.0135E-13 x^4 - 9.3924E-09 x^3 + 8.1488E-05 x^2 + 1.0023 x, where x is the uncorrected value. The simulation produces counts with the same compression, so a sketch that applies the correction reads the true light, and one that forgets it reads too low in sunlight - exactly like the real part.
Features of the VEML7700 Light Sensor Library for Proteus Simulation
- A real-looking breakout: the 20 x 15 mm board at its real size, the clear VEML7700 package with its die and photodiode, the regulator, the pull-ups and the PWR LED that lights at Run.
- All the registers: ALS_CONF_0 with every gain, time, persistence and the shutdown, the thresholds and interrupt flags, the power saving modes, ALS, WHITE and the ID.
- A real measurement: the light averaged over each integration time, the maker's resolutions, saturation at 65,535 counts and the non-linearity above 1,000 lx.
- A real start-up: shut down at power-on, 2.5 ms of wake-up, one integration before the first result.
- Light to test with: PROFILE DEMO is a day in fast time - night, dawn, the sun, a passing cloud, dusk; PROFILE STEADY holds a level that the pop-up's chips change.
- A pop-up: the light on a log scale with your last reading, the counts, the maker's resolution table with the setting in use, the last commands - graphs, an event log and a check page.
- A complete package: about 2.4 MB with the library, our I2C LCD, LED and resistor, our Arduino UNO V4.0 and the demo, without the source code of the model.
The VEML7700 in Proteus
The device is VEML7700TEP in TEPVEML7700.LIB, under Modules > Sensors, with the prefix U and the model TEPVEML7700.DLL. Search VEML7700 or light in Pick Devices. Its four pins are on the left: VIN, GND, SCL and SDA. Two properties set the light: PROFILE (DEMO or STEADY) and LUX (the level for STEADY).
Download VEML7700 Light Sensor Library for Proteus Simulation
Click the button below to download VEML7700-Light-Sensor-Library-for-Proteus-v1.0.zip (about 2.4 MB, without the source code of the models):
VEML7700 Light Sensor Library for Proteus V1.0- README.txt: installation, the demo, the wiring, troubleshooting and the limits of the simulation.
- Proteus Library Files:
TEPVEML7700.LIB,TEPI2CLCD16X2.LIB,TEPLED5MM.LIB,TEPRESISTOR.LIBandArduinoV4TEP.LIB. - Proteus Model Files:
TEPVEML7700.DLL,TEPLCD.DLL,TEPLED5MM.DLL,TEPRESISTOR.DLLandTEPARDUINO.DLL. - Arduino Code: the demo sketch (Wire only).
- Proteus Simulation: the demo project, its HEX file and copies of the DLLs.
No Proteus yet? Read How to Download and Install Proteus 7 and 8. New to libraries? Follow How to Install a New Library in Proteus.
How to Install VEML7700 Light Sensor Library for Proteus Simulation
- Close Proteus and extract the whole zip file, for example to your Desktop.
- Copy the files from Proteus Library Files into the LIBRARY folder of Proteus.
- Copy the files from Proteus Model Files into the MODELS folder.
- Delete
TEPVEML7700.IDXfrom the LIBRARY folder if it is there. - Start Proteus, press P and search for VEML7700.
Proteus Simulation of an Automatic Street Light
The demo uses an A4 sheet with our Arduino UNO Library for Proteus V4.0. The VEML7700 (U1, at 0x10) and a 16x2 LCD on its I2C backpack from our I2C LCD 16x2 Library for Proteus (LCD1, at 0x27) share the I2C bus on A4 and A5. The street lamp is a white LED from our 5mm LED Library for Proteus (D1) with a 220 ohm resistor on D9, dimmed with PWM. The sensor runs on its DEMO day. The Arduino's monitor is built in, the same window as our TEP Serial Monitor Advance for Proteus. Open VEML7700-Light-Meter-Street-Lamp-ArduinoUnoV4.pdsprj.
The Sketch
The sketch needs only the Wire library. Writing a register means the register number, then the low byte, then the high byte:
void vemlWrite(byte reg, word v) {
Wire.beginTransmission(VEML); Wire.write(reg); Wire.write(lowByte(v)); Wire.write(highByte(v)); Wire.endTransmission();
}
The heart of the sketch is the auto-ranging, written as two lines: too few counts - more sensitivity (a higher gain first, then a longer time); too many - less (a shorter time first, then a lower gain). Each change needs a new integration, so the sketch reconfigures and waits for the next one:
if (counts <= 100 && (g < 3 || it < 5)) { if (g < 3) g++; else it++; configure(); return; }
if (counts > 10000 && (g > 0 || it > 0)) { if (it > 2) it--; else if (g > 0) g--; else it--; configure(); return; }
At gain x1/8 and x1/4 it applies the maker's correction, written in Horner form so it costs only a few multiplications:
float correct(float x) { return ((6.0135e-13 * x - 9.3924e-9) * x + 8.1488e-5) * x * x + 1.0023 * x; }
The lamp follows the light: off above 60 lx, full below 10 lx and dimmed in between, so it fades up at dusk rather than snapping on.
VEML7700 Simulation Results
Open the project and press Run. The demo runs 6.0 simulated seconds and took about 2 minutes 22 seconds on our PC with the pop-up open and the pictures being taken. Click U1 for its pop-up. Every number below comes from one simulation run, the demo exactly as it ships.
Night: the Highest Gain
The run starts in the dark, at 0.4 lx - a street under the moon. The sketch reads the ID (0xC481), wakes the sensor at gain x1/8 and 100 ms - the maker's starting point - and finds a count or two. So it climbs, one integration per step: x1/4, x1, then x2, then longer times. Each step takes a whole integration, so the climb is not instant, and in the DEMO day the dawn begins while it is still under way. The end of the run shows the night properly: at 6.0 s the sensor is at gain x2 and 400 ms, the counts are 64, the reading is 1.08 lx - the average over that last integration, while the light fell to 0.4 lx - and the lamp burns at 100 %. The LCD shows "7.12 lx" and "x2 50ms L100%" a moment earlier, on the way down.
Dawn: Down to the Lowest Gain
Dawn in the DEMO day comes fast, from 1 lx to 1,000 lx in little more than a second and to 40,000 lx by 2.8 s - faster than the sketch steps down. The pop-up at 2.38 s catches it: the light is 5,826 lx, the setting still x2 and 100 ms, where full scale is 2,202 lx, so the counts sit at 65,535 and the banner turns orange - "SATURATED". The sketch's last reading, 1,101 lx, came from x2 and 200 ms, also full. The rule handles it: over 10,000 counts, a shorter time, then a lower gain, one integration at a time, down to x1/8 and 25 ms, where full scale is about 140,000 lx. Three integrations saturate on the way, and the Check page counts them. That is the price of a sensitive night setting when the sun comes up quickly.
A Cloud Passes
At 3.25 s a cloud covers the sun and the light falls from 40,000 to 8,000 lx. At x1/8 and 25 ms that is 2,890 counts, well inside the range, so the sketch keeps its setting. Multiplied by the resolution of 2.1504 lx, those counts give only 6,215 lx; with the maker's correction the sketch reads 8,009.1 lx - within 0.1 % of the true 8,000 lx. The pop-up at 3.39 s shows the same reading, the light bar at 8,000 lx and the setting x1/8, 25 ms lit in the resolution table.
Dusk: the Lamp Comes On
From 4.2 s the sun goes down. The monitor shows the light falling at the same setting - 33,172 lx at 7,068 counts, 22,123, 14,782, 8,061, and 1,068 lx at 4.7 s - until at 4.8 s only 119 counts are left. Then the sketch climbs again: x1/4 at 4.9 s (127 counts, 138 lx), x1 at 5.0 s (252 counts, 67.7 lx). Below 60 lx the lamp starts to fade up: 29 % at 45.2 lx, 58 % at 30.6 lx, 87 % at 16.1 lx with the gain now at x2, and full brightness at 7.1 lx with x2 and 50 ms. The pop-up at 5.09 s shows that moment - x1, 25 ms, 168 counts, 45.2 lx read while the light has already dropped to 35.7 lx.
The Graphs, the Event Log and the Check Page
The Graphs page plots the light on a log scale, the counts, the resolution of the setting in use and the lux the host read - the resolution trace steps down and up as the sketch auto-ranges. The Event log lists the configuration writes and the first integrations. The Check page sums up the run: Supply green (VIN 5.00 V, 0x10, ID 0xC481), Start green (awake, ALS_CONF_0 = 0x0880), Integrations green - 112 integrations, 20 configuration writes, 65 reads - and Range amber: 3 saturated integrations, all at dawn. The last reading, 64 counts = 1.0752 lx, matches the 1.083 lx the light averaged over that integration.
The Arduino's built-in serial monitor prints every reading with the counts, the setting, the lux and the lamp. Scrolling through it shows the whole day: the setting walks from x2 at night to x1/8 and 25 ms at noon, and back again at dusk.
Why Auto-Ranging Matters
Light levels span more than seven orders of magnitude, but the ADC has only 16 bits. With a fixed setting you must choose: high sensitivity, and the sensor saturates as soon as the sun comes out; or a wide range, and a dark street reads as zero. Auto-ranging gives you both, at the cost of a little time: each step needs one integration. In the demo you can see it on the Graphs page as a staircase of resolutions every morning and evening, and on the monitor as readings that skip while the sketch hunts for the right setting.
VEML7700, BH1750 or an LDR?
An LDR from our LDR Sensor Library for Proteus is cheap and simple, but it is slow, its resistance depends on temperature and every one is different - fine for "is it dark?", not for lux. The BH1750 from our BH1750 Light Sensor Library for Proteus is an I2C lux sensor with a fixed range up to about 65,000 lx and very easy code. The VEML7700 goes further in both directions - down to 0.0042 lx and up to 140,000 lx - and its power saving modes let it run for years from a coin cell. For a street light or a plant monitor that has to work from moonlight to midday sun, it is the better choice.
Try It Yourself
- Click U1 while the simulation runs and use the chips: Light x 10, Light / 10, Sunlight 50 klx and Dark 0 lx - the sketch re-ranges every time.
- Remove the correction: the readings in sunlight come out far too low.
- Fix the setting at gain x2 and 800 ms: the night reads beautifully, the day saturates at 65,535 counts.
- Forget to clear the shutdown bit: the ALS register stays at zero, and the Check page tells you why.
- Turn on power saving mode 4 in register 0x03: the readings come every 4.1 s instead of every integration.
Ideas to Extend the Demo
- A display that dims its backlight with the room light.
- A plant monitor that adds up the daily light dose.
- A camera trigger that fires when the light changes quickly.
Your Own Sketches
The demo sketch is in the zip file, and you can change it in the Arduino IDE. New to Arduino? Start with our Arduino Tutorial for Beginners. Export the compiled binary, and set the UNO's PROGRAM property to the new file. Our guide on How to get the HEX file from Arduino shows you where the file ends up.
Things to Know Before Using a Real VEML7700
- Start-up: it starts shut down; clear bit 0 of register 0x00, wait 2.5 ms and one integration time.
- Byte order: every register is low byte first.
- Range: start at gain x1/8; strong light can saturate x2 in one integration.
- Window: calibrate behind the final cover - tinted plastic changes the reading.
- Address: fixed at 0x10; two sensors on one bus need a multiplexer.
Troubleshooting
- The reading stays at zero: the sensor is still shut down - clear bit 0 of ALS_CONF_0.
- The reading is 65,535: saturated - lower the gain or shorten the time.
- The lux is wrong by a factor of 2, 8 or 16: the resolution in the sketch does not match the gain written to the sensor.
- The values jump wildly: the two bytes are read in the wrong order - the low byte comes first.
- The part is not simulated:
TEPVEML7700.DLLis missing from MODELS and from the project folder.
Limitations of the Simulation
- The registers, the start-up, the resolutions, the saturation and the non-linearity follow the VEML7700 datasheet and the maker's application note; the board is our own drawing.
- Our own figures: WHITE = 1.12 x ALS (daylight); a dark offset of 0.0126 lx and a small noise; the DEMO day runs in fast time.
- Not modelled: the spectral response to different light sources and the temperature drift.
- Arduino is a name of Arduino; this library is not made or endorsed by Arduino, Labcenter or the chip's maker.
- Tested in Proteus 8.5 in November 2026 (the demo as shipped). Proteus 7 is not supported.
So, that was all about the VEML7700 Light Sensor Library for Proteus Simulation. I hope it helps you build projects that see light the way we do, from moonlight to midday. If you have any questions, ask in the comments and I will help you out. Till the next tutorial, take care and have fun!






















Comments
0