Introduction: Light Flicker Detector
I have always been fascinated by the fact that electronics accompanies us. It is just everywhere. When we are talking about light sources (Not the natural ones like stars), we have to take in account several parameters: Brightness, color and, in the case it is the PC display we are talking about, picture quality.
The visual perception of light or brightness of electronic light source can be controlled in various ways when the most popular is via Pulse Width Modulation (PWM) - Simply turn device on and off very fast so the transients seem "invisible" for human eye. But, as it appears, it is not too good for human eyes for long term use.
When we take for instance, a laptop display and reduce its brightness - it may seem darker, but there is a lot of changes on the screen happening - flickering. (More examples on this can be found here)
I was greatly inspired by an Idea of this YouTube video, the explanation and simplicity of it are just terrific. By attaching simple off-shelf devices, there is a potential to build a totally portable flickering detection device.
The device we are about to build is a light source flickering detector, using small solar battery as a light source, and consist of following blocks:
- Small solar panel
- Integrated audio amplifier
- Jack for headphones connection, if we would like to test with greater sensitivity
- Rechargeable Li-Ion battery as power source
- USB Type-C connector for charging connection
- Power LED indicator
- Integrated Audio Power Amplifier
- 8 Ohm Speaker
- 3.7V 850mAh Li-Ion battery
- 3.5mm Audio Jack
- Mini Pollycrystalline Solar Battery
- TP4056 - Li-Ion Charging Board
- RGB LED (TH package)
2 x 330 Ohm Resistors (TH package)
- Potentiometer knob
- 3D-Printed enclosure (Optional, off-shelf project box may be used)
- 4 x 5mm diameter screws
- Soldering iron
- Hot glue gun
- Phillips screwdriver
- Single core wire
- 3D Printer (Optional)
Step 1: Theory of Operation
As it was mentioned in the introduction, the flickering caused by PWM. According to wikipedia, human eye can catch up to 12 frames per second. If frame rate exceeds that number, it is considered as motion for human vision. Hence, if there is a rapid change of object that is observed, we see its average intensity instead of sequence of separated frames. There is a core of the idea for PWM in brightness control circuits: Because we can see only average intensity of higher frame rate than 12fps (Again, according to wikipedia), we can easily adjust the brightness (Duty Cycle) of light source powering via changing periods of time, when light is on or off (More on PWM), where the frequency of switching is constant and is much greater than 12Hz.
This project describes a device, whose sound volume and frequency are proportional to flickering noise caused by PWM.
Mini Polycrystalline Panel
Main purpose of these devices is to transform power derived from the light source to electrical power, that can easily be harvested. One of the key properties of this battery, that if the light source is not providing stable constant intensity and changes over time, same changes will present on the output voltage of this panel. So, that is what we are going to detect - the changes of intensity over time
Output that is produced from the solar panel is proportional to the average intensity level (DC) with additional changes in intensity over time (AC). We are interested in detecting only alternating voltage, and the easiest way to achieve it - connect audio system. The audio amplifier that was used in this design is single-supply PCB, with DC-blocking capacitors on each side, both input and output. So, the solar panel output is connected directly to audio amplifier. Amp used in this design already has a potentiometer with a build-in ON/OFF switch, thus there is complete control over device power and volume of the speaker.
Li-Ion Battery Management
TP4056 Li-Ion battery charger circuit was added to this project in order to make device portable and rechargeable. USB-C connector acts as input for charger, and battery that was used is a 850mAh, 3.7V, that is sufficient for the purposes we need to pursue with this device. The battery voltage acts as a main power supply for the audio amplifier, thus for a whole device.
Speaker as System Output
Speaker plays main role in the device. I chose a relatively small-sized one, with firm attachment to the enclosure, so I would hear a lower frequencies as well. As it was mentioned before, the frequency and the volume of speaker can be defined as follows:
f(Speaker) = f(AC from Solar Panel) [Hz]
P(Speaker) = K*I(Intensity peak-to-peak of AC signal from Solar panel) [W]
K - Is a volume coefficient
3.5mm Jack is used in the case that we want to connect headphones. In this device, jack has a connect detection pin, which is disconnected from signal pin, when audio plug is plugged in. It was designed this way to provide output to a single path at the time - Speaker OR headphones.
Here LED is on a double duty - it lights up when device is being charged or device is powered on.
Step 2: Enclosure - Design and Printing
3D Printer is a great tool for customized enclosures and cases. Enclosure for this project has a very basic structure with some common features. Let's expand on it step-by-step:
Preparation and FreeCAD
Enclosure was designed in FreeCAD (The project file is available for download at the bottom of this step), where the body of device was constructed first, and a solid cover was constructed as a separate part relative to the body. After the device was designed, there is need to export it as separate body and cover.
The mini solar panel is mounted on the cover with fixed size area, where the cut-out region is dedicated for wires. User interface available on both sides: USB cutout and LED|Jack|Potentiometer holes. Speaker has its own dedicated area, which is array of holes on the bottom of the body. Battery is adjacent to speaker, there is a place for each one of the parts, thus we won't need to get frustrated while assembling the device altogether.
Slicing and Ultimaker Cura
Since we have STL files, we can proceed to G-Code conversion process. There is a lot of methods doing so, I will just leave here the main parameters for printing:
- Software: Ultimaker Cura 4.4
- Layer height: 0.18mm
- Wall thickness: 1.2mm
- No. of top/bottom layers: 3
- Infill: 20%
- Nozzle: 0.4mm, 215*C
- Bed: Glass, 60*C
- Support: Yes, 15%
Step 3: Soldering and Assembling
While 3D Printer is busy printing our enclosure, let's cover the soldering process. As you can see in the schematics, it is simplified to a bare minimum - that is for the reason that all the parts that we are going to attach altogether are available as independent integrated blocks. Well, the sequence is:
- Soldering Li-Ion battery terminals to TP4056 BAT+ and BAT- Pins
- Soldering VO+ and VO- of TP4056 to VCC and GND terminals of audio amplifier
- Soldering "+" terminal of small solar panel to VIN (either L or R) of audio amplifier, and "-" to audio amp's ground
- Attaching Bi-color or RGB LED to two 220R resistors with proper isolation
- Soldering first LED anode to the switch terminal of audio amplifier (The connection must be done on the terminal of switch). Checking which terminal of switch on the bottom side of PCB is connected to VCC is strongly recommended - The one that is not is our option
- The second LED anode should be soldered to anode of either two SMD LEDS - they have common anode connection
- Soldering LED cathodes to audio amplifier's GROUND
- Solder speaker terminals to audio amplifier's output (Make sure that you've chosen the same channel at input, LEFT or RIGHT)
- In order to force speaker to off state, solder 3.5mm stereo jack terminals that prevent the current flow through speaker.
- In order to make headphones produce sound on each side - L and R, short the terminals described in previous step together.
After enclosure is printed, it is recommended to assemble part-by-part with regard to part height:
- Making a frame from hot glue according to cover inner perimeter, and placing solar panel there
- Attaching potentiometer with a nut and a washer on the opposite side
- Gluing speaker with hot glue
- Gluing battery with hot glue
- Gluing 3.5mm jack with hot glue
- Gluing battery with... hot glue
- Gluing TP4056 with USB pointing outside its dedicated cutout region with hot glue
- Putting a knob on a potentiometer
- Fastening cover and body with four screws
Our device is set and ready to go! In order to check device properly, there is need to find light source that may provide alternate intensity. I recommend using IR remote control, since it provides alternating intensity whose frequency lays in the human hearing bandwidth region [20Hz:20KHz].
Do not forget to test all your light sources at home.
Thanks for reading! :)