Raspberry Pi and Lux meters

For my raspberry pi controlled camera setup, I have an automated exposure routine that does a really good job for time-lapses at ‘guessing’ the exposure for the next frame.
It does day to night timelapses brilliantly, however night to day when looking into the sun, or day to night when looking at the sun where there are clouds, gets induced flicker.

The reason for this is that the software processes a histogram of the shot just taken, looking at the black and white bins, and tries to adjust the exposure when the the black bin or white bin are greater that 5% difference from each other.
When you are doing a time-lapse that is say 30 seconds between exposures, and the lighting conditions change within that 30 seconds, then the next exposure, based on the last, isnt going to be right.
That is usually OK as it will pick it up in the next exposure, however when clouds are scooting across the sky in front of the sun, it is always playing catchup and induces a lot of flicker in the time-lapse.

Due to a technical limitation I cannot read the light meter from the camera to the Pi, so I have been looking at an alternative solution using an external lux meter.
If I can get a lux meter behind a small lens, like a raspberry pi camera lens, and put it on the hotshoe of the camera so that it is generally looking the same direction as the DSLR, the idea was that I can log the lux meter readings and use them as a sanity check to see if the lighting conditions have changed since the last shot, and if they have, apply a multiplier to the exposure difference to get the exposure much closer to where it should be.

That is all good and fine, I dont have any issues with technically achieving that part, my question is asking if anyone has any experience with the add on SPI lux meters?
I am thinking that it will need to be super sensitive in order to have meaningful results.
I do have one here, some unknown branded one that I have working on an arduino nano, and it happily spits out lux values sitting on my desk.

Does anyone have any other ideas?
Should I be using a lux meter that splits the value of visible light and IR light?
Any ideas would be appreciated.

Edit for clarity, here are some time-lapses showing the issues.
Also, I know that I can apply deflicker routines afterwards, however these examples are literally right out of the camera, only wholistic colour grading applied, nothing on a per frame basis.


Hi Andrew,

Once again this is an absolutely amazing project! I’m keen to see how it turns out :smiley:

If you were looking to interface with your Pi could you write up a simple sketch to send through the Lux via UART every XXX seconds or upon request?

I dont have much experience with SPI myself, is there a reason why you’re going to SPI vs I2C or UART?
The VEML6030 boasts a 16-bit light reading with an adjustable gain so might be worth checking out?

Here’s the wavelength gain into the sensor for reference as well (Datasheet)

Interesting point with visible vs IR, I guess that is down to what the camera sensor is receiving, to emulate what the camera is seeing could you use another camera (like the Pi camera module)

PS: I picked up this lens pack a little while back - I’d also check that the filters on them aren’t too different.

1 Like

Thanks Liam.
So, when I said SPI, I meant i2C :slight_smile:
I dont have any spare GPIO if that is believable, however I saved I2C for sensors.

I am in the progress of documenting this project, but this is the custom board that I have made for motion control of 3 axis including encoder input, two switched outputs, buzzer, I2C, RTC, RF24 radio, direct power of the Pi as well as motor power.

Yeah I might give that light sensor a go.
Oh yes, I do have a similar set of lenses myself, that is a good idea.

With IR, I’ll just have to build the sensor and give it a go, but the idea was that maybe if I use IR I might be able to detect sunlight easier, maybe.


Hi Andrew,

Thats siiiiiiiiiiick!! I love the use of the RJ45 connectors!

Also worth noting for future readers - I2C relies on an address so many sensors can be used on the same bus.

I also just stumbled across this sensor that you might be able to use? SI1145 Digital UV Index / IR / Visible Light Sensor | Adafruit ADA1777 | Core Electronics Australia


1 Like

:slight_smile: thanks, I quite like it and it does the job swimmingly, the encoder ICs are hard to come by though, so thats a problem.
I want to replan it to be a SMD board, but cant convince myself to spend all that effort lol
The RJ45s are a very slick way of running low voltage DC motors. They carry the motor power, encoder power, encoder pulse return on two channels and there’s two limit switch channels, although we dont use them any more.

That light sensor looks good, I’ll check it out more, thanks