Apr-25-2018, 09:24 AM
(This post was last modified: Apr-25-2018, 09:24 AM by hhanswurster.)
Hey Guys,
i new to programing and have my first project in mind :)
Rasberry pi with light sensor, that automaticly changes my camera settings to a optimal exposure, captures a image and saves it at a hard drive connected to the pi.
First of all, is there something like that allready ? i dont want to reinvent the weel.
my setup hardware setup so far:
Rasberry Pi 3
ADAFRUIT TSL2561 connected via i2c https://www.adafruit.com/product/439
Sony A5100 connected via USB
3 TB USB harddrive for storing the images.
Software:
Rasbian light
gphoto2
hahaha)
Make a "list" of all camera settings possible from dark to bright.
Measure several brightness levels and manualy adjust the camera settings to that brightness.
Extrapolate the rest?
than write a script:
every 30 minutes:
read lux measurement
look up the correct setting in the list
set the camera to that settings
(wait: needs some time)
capture image, rename it, save it on the harddrive
write a logfile that it worked
start again :D
im a total noob, do you think its possible like that?
what would you do differently ?
any thoughts appreciated :)
Hans
i new to programing and have my first project in mind :)
Rasberry pi with light sensor, that automaticly changes my camera settings to a optimal exposure, captures a image and saves it at a hard drive connected to the pi.
First of all, is there something like that allready ? i dont want to reinvent the weel.
my setup hardware setup so far:
Rasberry Pi 3
ADAFRUIT TSL2561 connected via i2c https://www.adafruit.com/product/439
Sony A5100 connected via USB
3 TB USB harddrive for storing the images.
Software:
Rasbian light
gphoto2
gphoto2 --capture-image-and-download --filename "images/%Y_%m_%d_%H_%M_%S.arw" # capture image rename it and store it... # these 3 settings can be used to change the exposure :) gphoto2 --set-config iso=X #values Choice: 2 100 to Choice: 14 1600 gphoto2 --set-config f-Number=X #values 2.8 to 22 gphoto2 --set-config shutterspeed=X #values 30s: 300/10 25s: 250/10 1/200s: 1/200 and so onPyhton script (thanks ryker1990) that i modified to output the mesured lux:
import smbus import time # Get I2C bus bus = smbus.SMBus(1) # TSL2561 address, 0x39(57) # Select control register, 0x00(00) with command register, 0x80(128) # 0x03(03) Power ON mode bus.write_byte_data(0x39, 0x00 | 0x80, 0x03) # TSL2561 address, 0x39(57) # Select timing register, 0x01(01) with command register, 0x80(128) # 0x02(02) Nominal integration time = 402ms bus.write_byte_data(0x39, 0x01 | 0x80, 0x02) time.sleep(0.5) # Read data back from 0x0C(12) with command register, 0x80(128), 2 bytes # ch0 LSB, ch0 MSB data = bus.read_i2c_block_data(0x39, 0x0C | 0x80, 2) # Read data back from 0x0E(14) with command register, 0x80(128), 2 bytes # ch1 LSB, ch1 MSB data1 = bus.read_i2c_block_data(0x39, 0x0E | 0x80, 2) # Convert the data ch0 = data[1] * 256 + data[0] ch1 = data1[1] * 256 + data1[0] # Output data to screen print "%d lux" %(ch0 - ch1)To do (what i think

Make a "list" of all camera settings possible from dark to bright.
Measure several brightness levels and manualy adjust the camera settings to that brightness.
Extrapolate the rest?
than write a script:
every 30 minutes:
read lux measurement
look up the correct setting in the list
set the camera to that settings
(wait: needs some time)
capture image, rename it, save it on the harddrive
write a logfile that it worked
start again :D
im a total noob, do you think its possible like that?
what would you do differently ?
any thoughts appreciated :)
Hans
