Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Last active February 5, 2026 15:32
Show Gist options
  • Select an option

  • Save kenwebb/4324da66bdca7153be3d2a82e1ef436f to your computer and use it in GitHub Desktop.

Select an option

Save kenwebb/4324da66bdca7153be3d2a82e1ef436f to your computer and use it in GitHub Desktop.
Microcontroller-based DIY light meter
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Thu Feb 05 2026 10:31:41 GMT-0500 (Eastern Standard Time)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: Microcontroller-based DIY light meter
Description:
Url: http://www.primordion.com/Xholon/gwt/
InternalName: 4324da66bdca7153be3d2a82e1ef436f
Keywords:
My Notes
--------
2026 Dec 5
### References
(1) search: diy pico light meter
- there are lots of projects, many are for photography but not all
- pico, arduino
(2) https://github.com/veebch/photon
Photon: an open-source incident light meter
Components:
Raspberry Pi Pico (or Pico Lipo, so you don't need to add the separate power shim)
OLED Screen (Waveshare 128x128 full colour)
LiPo Power shim (Pimoroni LiPo Pico shim - only if you a using a Pi Pico)
Rotary encoder (adjust settings and change priority mode) (example)
Two momentary switches (1x keyboard switch and 1x 6x6mm microswitch to measure light and set iso adjust mode respectively)
Light Sensor (Pimoroni BH1745)
LiPo/LiIon battery
(3) https://www.diyphotography.net/the-photon-is-a-tiny-open-source-handheld-light-meter-powered-by-a-raspberry-pi-pico/
(4) https://www.veeb.ch/projects/light-meter-on-a-shoestring
- intended as a photography light meter
(5) search: diy microcontroller light meter
(6) https://www.pishop.ca/search.php?search_query=bh1750&section=product
Arduino Compatible Digital Light Sensor (BH1750FVI)
$4.95 in stock
This is a digital light sensor that can be used to precisely measure the ambient light level.
The sensor has a 16 Bit AD converter so it outputs a digital signal that can be read using the Arduino's serial connections.
It measures light to a similar level as the human eye so is great for home automation projects.
It is very easy to implement into your project as an Arduino library for this sensor already exists.
If you are looking for a way to make this sensor work then we have found this very good instructacble here that includes a link to a Library file.
Key Features:
Based on the BH1750FVI light intensity Sensor
16 bit AD converter takes an analog signal and turns it into a digital signal
Output is in LUX (a measure of light intensity)
Input voltage 3.3 to 6 volts
I2C bus Interface with 2 alternative address (f/s Mode Support)
The sensor is very robust to interference from different light source types and infra-red light
Sensor range: 0.11 Lux to 100,000 Lux
(7) https://www.instructables.com/BH1750-Digital-Light-Sensor/
- recommended in ref[6]
- uses Arduino
(8) https://www.elechouse.com/elechouse/images/product/Digital%20light%20Sensor/bh1750fvi-e.pdf
datasheet recommended in ref[7]
(9) https://www.pishop.ca/product/arduino-compatible-analog-light-sensor/
Arduino Compatible Analog Light Sensor, $2.95
- uses an LDR ?
() https://shop.pimoroni.com/products/bh1745-luminance-and-colour-sensor-breakout?variant=12767599755347
BH1745 Luminance and Colour Sensor Breakout by Pimoroni
$16.28 CDN, out of stock
() https://www.pishop.ca/product/bh1745-luminance-and-colour-sensor-breakout/?searchid=0&search_query=BH1745
BH1745 $15.95, in stock, Pimoroni
]]></Notes>
<_-.XholonClass>
<!-- domain objects -->
<PhysicalSystem/>
<Block/>
<Brick/>
<!-- quantities -->
<Height superClass="Quantity"/>
</_-.XholonClass>
<xholonClassDetails>
<Block>
<port name="height" connector="Height"/>
</Block>
</xholonClassDetails>
<PhysicalSystem>
<Block>
<Height>0.1 m</Height>
</Block>
<Brick multiplicity="2"/>
</PhysicalSystem>
<Blockbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var a = 123;
var b = 456;
var c = a * b;
if (console) {
console.log(c);
}
//# sourceURL=Blockbehavior.js
]]></Blockbehavior>
<Heightbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var myHeight, testing;
var beh = {
postConfigure: function() {
testing = Math.floor(Math.random() * 10);
myHeight = this.cnode.parent();
},
act: function() {
myHeight.println(this.toString());
},
toString: function() {
return "testing:" + testing;
}
}
//# sourceURL=Heightbehavior.js
]]></Heightbehavior>
<Brickbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
$wnd.xh.Brickbehavior = function Brickbehavior() {}
$wnd.xh.Brickbehavior.prototype.postConfigure = function() {
this.brick = this.cnode.parent();
this.iam = " red brick";
};
$wnd.xh.Brickbehavior.prototype.act = function() {
this.brick.println("I am a" + this.iam);
};
//# sourceURL=Brickbehavior.js
]]></Brickbehavior>
<Brickbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
console.log("I'm another brick behavior");
]]></Brickbehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg">
<g>
<title>Block</title>
<rect id="PhysicalSystem/Block" fill="#98FB98" height="50" width="50" x="25" y="0"/>
<g>
<title>Height</title>
<rect id="PhysicalSystem/Block/Height" fill="#6AB06A" height="50" width="10" x="80" y="0"/>
</g>
</g>
</svg>
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient>
</XholonWorkbook>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment