radiosparks
Well-known member
This was a project to characterize ALS (Ambient Light Sensors). I couldāve used my trusty AVO meter and a resistor, but figured it was a good excuse to play with a PICAXE. I wasnāt chasing accuracy by using Vcc as a referenceājust a relative response from my stash of light sensors.I read @westaust55ās excellent PDF: āEverything you ever wanted to know about the MAX7219, but were afraid to askā
Link: Getting Started with the MAX7219
The sample code worked. I noticed it only used 4 digits, but my display had 8. A second read confirmed each digit can be set independentlyāinteresting! The TINKER coder in me woke up, and this is what I built.
Iāve stripped out extra code to simplify reuse. You can add your own command-based modes.
Modes 0ā5 cycle through different bargraph styles. Other modes that Iāve used in the matrix display version:

Mode 6: Peak-hold
Mode 7: Scrolling trace
Mode 8: Flash-on-change
Mode 9: Ambient histogram
Instead of using C.3 as a digital input (reserved for future IR control), I used a neat ADC trick. ALS devices are usually NPN transistors with a Vce(sat) around 0.7V, so they never reach full Vcc in the Emitter follower circuit. That means the ADC maxes out around 4.3V when using a 5 Volt supply.
The push-button shorts the ALS to Vcc, giving a full-scale ADC reading. Handy when you want a button
and analog input on the same pin. I use this trick often with pots too.

Ambient Light Sensors mimic the human eyeās response to brightness. This oneās a sensitive NPN photo Darlington in a 3mm T-1 packageāRoHS-friendly (no CdS). Its clear case makes it IR-sensitive, so it reacts to incandescent bulbs and sunlight. Even can detect pulses from IR remote controls.
Itās fast enough to detect AC LED lamp flicker. To smooth the output, I use a ring buffer: 10 samples are averaged and scaled to show a voltage across the resistor.
Component: Everlight ALS-PDT144-6C/L451
Technology: Photo-darlington transistor optimized for Human eye light response.
Datasheet Link: ALS-PDT144-6C-L451_datasheet_V4.pdf
Application Note: Analog ALS Application Note V2.0
Iāve included reference connection styles for ALS. Donāt take the values as gospelāyouāll need to tune them for your setup. For example, the resistor value sets the sensitivity of the ALS and should be adjusted based on your specific conditions.

Thereās some circuit loading due to the low input impedance of the ADC (around 10 kĪ©), so readings tend to be lower than those you'd get using a digital voltmeter (DVM) for measurement.
Glad you asked. In the next post, I use a MAX7219 with a 64-LED (8Ć8) matrix display to create a trend line based light meter.
"Show me the CODE!"
Please see the next following post for code and circuit layput.

Last edited:

