Cantor - beamshot octave scripts and bike light driver

abvgdee [on] mail [period] ru

[I tried to structure everything to separate high-level overview/digest (this page), middle-level info (most linked pages) and low-level/unnecessary details (few pages, and some marked content) for easier reading.]

Beamshot octave scripts

Light intensity distribution (LID) of a lamp can be measured by taking wall/ceiling beamshots with a digital camera. The scripts process jpgs images (that have to be processed from raw data) and visualize the LID nicely. See example gallery.

Taking "Cantor" beamshots is a how-to get beamshots simulation images fast. Not quite "for dummies", but I tried to make it.

Comparison with real goniometer measurements (Olaf Schultz database) - pretty good match.

Simulation comments describes some more technical aspects, like need for HDR, camera calibration. Some formulas also given. The section Raw vs. Blackbox there shows (also visually) why you should not trust your camera and use raw files, at least for measurements.


Linear, using AMC7135 and Atmel AVR ATtiny45, Li-Ion battery powered. The firmware provides convenient control - bikelight-specific.


Two external buttons - "left" and "right" (one is clearly not enough, and more buttons would make control difficult when groping for buttons, especially in mittens in winter). One low-power info-LED. Each driver drives (only) one power LED. There are three flavors of the firmware, for Far-beam, Near-beam, and High-beam lights.
Example photo where I placed buttons and info-LEDs on my handle bar.

Convenient, bike-light-specific (not a tactical-light) control.

More on the functionality: User guide. Also includes brake light.

Driver board

Drivers for Far/Near/High are identical, just some differences in firmware. The printed circuit board (PCB) can house up to 8 AMC7135 (~2.8А), they are all located on one side for efficient cooling. Micro-controller is on the other side - to measure temperature of the power LED. Board diameter is 24mm. Power is 1S Li-Ion (2.7-4.2V). Boards were factory-fabricated and are available for sale.
More on PCB. There's also the (simple) circuit diagram there.

Firmware source code - for avr-gcc is opened. Almost all functionality was planned right from the start, so there are few "outlandish" pieces there. I tried to design everything clearly and naturally. There are many (very) lines of code, but I doubt that it all can be implemented with shorter or simpler code - in this sense the firmware is simplest. 2000+ lines is a payment for rich functionality and the "proper" implementation. Heavily commented.
More on firmware - miscellaneous comments, from general design notes, to low-level details of power reduction benchmarks. For programmers mainly, unnecessary for most.

How I use it

All (four) lights below use the above driver. LIDs of (all three) headlights were measured using the above method.

I currently have 3 headlights: (1) Far-beam, reflector-based, a modified Philips Saferide 80, (2) Near-beam to remedy dark stripe artifact of the Saferide, and (3) High-beam (the last two are lens-based). They are all idependent, and can be used without any other (I often use Saferide as stand-alone tactical light).

Far: Philips Saferide 80 modification

Powered by three 18650 Li-Ion cells inside the stock body (instead of 4 AA NiMH). LEDs are stock Rebels. To remove blinding artifacts, I installed a wall between the reflector halves.
More on optics: the wall and misc related notes.
More on housing: driver and battery cells.

Lens-based Near + High lights

UPD, Nov 2016: Photo is old. "Far" here is from older setup, when it was used as Far light. Now it is used upside-down as High-beam light.

I shifted lenses relative to LEDs to improve a bit the light distribution. For housings, I modified common "Magic-shine"-type headlight (Xeccon-S14T), and also М25-housing from Each button is connected to both headlights (or to all three, if Saferide is connected). Info-LED - one for each headlight.
More detailed overview - optics and housing (LED+lens, PCB, external) of the lens-based lights.

Brake light

Mounted on the luggage carrier:

Red LED - Cree XPE on a star, lens - oval Carclo 10003/l25. Housing - plastic container for medical pills.

Previous setup: High as Far

I very much liked it. When accompanied by Near - gives very smooth illumination, from the wheel to 10m ahead. For slow speeds (commuting through a park, or on sidewalks among people), stand-alone Philips Saferide 80 is no competitor - because of the really annoying dark stripe in the near. For slow speeds Saferide _has_ to be accompanied by an additional Near.

However, after I started to use Saferide, the old lensed Far was sitting in a drawer without any use, so I made it High-beam. Still without use - frankly speaking, but always ready for.


Sept 2014: Initial release
Jan 2015: Simulations: Philips Saferide 80 added, other images re-generated.
Dec 2015: SR80: wall removing upper artifacts, new driver. Main page re-structured.
Nov 2016: High-beam made from old Far.
June 2017: Some unnecessary stuff trimmed from docs.

SourceForge - Download, Develop and Publish Free Open Source Software.