A photoresistor is used to detect the light when shutter open, and hence changing the values read by ADC pin P9_40. The push button is used to trigger the Python script to start reading the ADC input.
Testing on breadboard and the final build on through-hole board:
Note that this is by no mean an accurate measure of absolute shutter speed. The response time (rise/fall) of photoresistor will affect the result (see the graph below). Nevertheless, it is useful to compare different shutter speeds.
Source code is available on Github.
git clone https://github.com/kitsook/bbb-adc-measure cd bbb-adc-measure python3 -m venv venv . venv/bin/activate pip install -r requirements.txt python adc-measure.py -t 10 > result.csv
Plot the output using gnuplot:
gnuplot set mxtics 10 set grid plot 'result.csv' with lines
Here is an example output of measuring 1/15 and 1/8 shutter speeds of my Pentax MX.