Light Flicker Detector




Introduction: Light Flicker Detector

About: Hi, I have a hobby to build some DIY Audio stuff, simple gadgets, etc. Hope you will find my instructables useful! :)

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:

  1. Small solar panel
  2. Integrated audio amplifier
  3. Speaker
  4. Jack for headphones connection, if we would like to test with greater sensitivity
  5. Rechargeable Li-Ion battery as power source
  6. USB Type-C connector for charging connection
  7. Power LED indicator


Electronic Components

Mechanical Components

  • 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)
  • Plier
  • Tweezers
  • Cutter

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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

Audio Amplifier

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

Audio Jack

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:

  1. Soldering Li-Ion battery terminals to TP4056 BAT+ and BAT- Pins
  2. Soldering VO+ and VO- of TP4056 to VCC and GND terminals of audio amplifier
  3. Soldering "+" terminal of small solar panel to VIN (either L or R) of audio amplifier, and "-" to audio amp's ground
  4. Attaching Bi-color or RGB LED to two 220R resistors with proper isolation
  5. 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
  6. The second LED anode should be soldered to anode of either two SMD LEDS - they have common anode connection
  7. Soldering LED cathodes to audio amplifier's GROUND
  8. Solder speaker terminals to audio amplifier's output (Make sure that you've chosen the same channel at input, LEFT or RIGHT)
  9. In order to force speaker to off state, solder 3.5mm stereo jack terminals that prevent the current flow through speaker.
  10. 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:

  1. Making a frame from hot glue according to cover inner perimeter, and placing solar panel there
  2. Attaching potentiometer with a nut and a washer on the opposite side
  3. Gluing speaker with hot glue
  4. Gluing battery with hot glue
  5. Gluing 3.5mm jack with hot glue
  6. Gluing battery with... hot glue
  7. Gluing TP4056 with USB pointing outside its dedicated cutout region with hot glue
  8. Putting a knob on a potentiometer
  9. 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! :)

Be the First to Share


    • Trash to Treasure Contest

      Trash to Treasure Contest
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest

    15 Discussions


    5 days ago

    I do not understand why the author used a voltage regulator when the audio amplifier could have been connected directly to battery. Most audio amplifier ICs need at least 5 V and can work at maximum voltages of no less than about 15 V. Switching voltage regulators do not drain power from inputs when the output voltage is set to low value. I seen other regulators draining power from regulated transformer outputs when the load resistance was low because the load current was below maximum value and there was high power dissipated inside the regulator. I am not sure if the author used such a regulator. A Zener diode regulator can be also used but it will not limit the maximum load current. Also, some zener diodes have low power rating and are not made for heat sink attachments.


    5 days ago

    The author used a plastic box. You can use a cardboard box. Also, the box is very small. There might be no space for the heat sink. The magnetic fields from the speaker might affect the operation and life time of the electronic components.


    5 days ago

    I never heard of the amplifier that the author used. There are USB powered Class D Amplifiers on eBay, Aliexpress and Amazon websites. They are very efficient and low cost. Also, there is no output capacitor shown in the circuit to prevent amplifier failure or reduce chances of amplifier failure due to grounding issues.


    5 days ago

    You can use a photodiode or probably even LDR (light dependent resistor) instead of a solar cell. I know that photodiode will work for sure. Solar cells are used for power generation and are expensive. I tried using a small calculator solar for a similar project and it did not work. However, my solar cell was about 100 times smaller than the one shown in this project.


    5 days ago

    I read somewhere that those flickering nightlight 'candles' simply re-used the tunes chip from a cheap electronic birthday card - have you tried pointing your detector at one to see if it plays a tune?


    Reply 5 days ago

    My back ground is electronics engineering. I have several of those flickering LEDs and opened a few and all it had was the battery a switch and the LED, yet it flickered. Recently I saw a video on YT that showed LEDs changing color... RGB.. That is when I realized that the circuitry is contained in the LED capsule. In my case the surface of the LEDs is not transparent but mottled so looking inside with a magnifying glass will not help.


    5 days ago

    Did you already try to "hear" car headlights, daytime running lights, or rear lights? Especially passing a traffic jam at night in opposite direction gives really interesting sounds.
    Some time ago I made a comparable detector (published a small article about it in german), and I was astonished how different various light sources sound.


    Question 13 days ago

    What is the reasoning for using a solar cell and not a phototransistor? I'd like to make it as small as possible..


    Answer 13 days ago

    The thing is, the phototransistor has a relatively slow response time from switching on and off - around 250uS for each edge. Hence the frequency spectrum diminishes greatly, when desired testing is above 2KHz. Another disadvantage of PT is the sensitivity to spectrum provided by a light source. Solar panels are much more sensitive whose bandwidth covers all types of light sources. Since there are no energy harvesting circuits, the output voltage of the panel provides rapid changes... Which are converted to the human hearing spectrum :)


    Reply 8 days ago

    Awesome instructable, very practical and might even be a fun communications device receiver! Thanks for sharing.

    Wondering if you found what the fastest response time is easily noticeable?


    Reply 8 days ago

    It is not challenging at all. Since solar panels of this particular size react only to surrounding light, there is a simple way of testing it: You can construct a simple LED connected to a variable frequency/pulse width waveform and connect solar panel output terminals to the oscilloscope with AC coupling option. The transients will be visible as far as the minimum response time values are achieved :). Just remember to cover the system in the dark enclosure to avoid unwanted light source interfering the experiment.


    Reply 13 days ago

    Thanks Faransky! We were supposing it was because of the wider spectrum but that’s all very elucidating. Thanks again


    19 days ago

    Well executed and documented. :)
    As a possible V2.0: Have 2 passive filter for < 100Hz and >100Hz (as an example) and light a red or Green LED if you are below or over 100 Hz or whatever you think is high enough to not tire your eyes. If PWM is made sufficiantly high (like in the kHz), our eyes dont percieve it at all and dont get tired...

    Hendry Kaak
    Hendry Kaak

    Reply 13 days ago

    This would be a nice addition to quickly verify the amount of flickering indeed. The first think that comes to mind (since this is already audio), is to make use of a led bar graph with something like the LM3915 bargraph driver (which can also be used in cascade setup to add more LEDs). This way you might be able to display a small range of OK/doable/definitely not OK. Although I'm not sure if it's doable to setup the bandwidth of hearable audio spectrum to those ranges accurately enough using the LM3915 or other IC. This might need (as you said in your comment) some additional resistors/RC-filters :-)

    Hendry Kaak
    Hendry Kaak

    13 days ago

    Hello Faransky, this project looks very well designed, great job!

    The next part is basically a recollection of thoughts, correct me if I'm wrong of course, so... :-)
    Furthermore, looking at your schematic I think that there's a small mistake in the schematic. Mainly with the way that the audio connector is wired. The way it is wired right now, when the audio plug is jacked in, there wouldn't be any sound hearable when connecting a headset since pin 1 gets disconnected from pin 2 and pin 3 disconnected from pin 4 in order to switch to a different audio device (NC switches). Because pins 1 and 4 are marked as "not connected, they do not redirect the audio to the jack at all. The way I would expect it to be is that pin 1 and 4 are connected to the audio source so that the headset gets the stereo output at channel L + R, and the speaker output connected to pin 2 and/or 3 (AFAIK this would be OK as long as the speaker outputs L+R are not connected together to the same speaker). A more detailed picture can be found over here:

    Taking a second look at the schematic, it might be a good idea to use a separate opamp for the audio level convertion since the audio amplifier is placed before the headphone jack and the speaker as well, which drives the whole speaker current through the audio jack connector pins. That might be doable for small speakers, but would soon be out of spec for bigger speakers (when drawing bigger currents). When using a first stage opamp, you can place the amplifier just before the speaker (and after audio jack pin 2 and/or 3) which can drive as much current from the boost converter to the speaker as needed without drawing that current through the connector pins.