I am attempting to build a PIC16F676 based voltmeter using 3 multiplexed common-anode seven segment displays. Is it possible to add a light activated dimmer to control brightness of the displays through the PIC or control the current externally against the displays them selves? It would result in a bright display in bright conditions and dimmer in dark conditions to not be blindingly bright or distracting. Most standard seven segment displays are not usually that bright but this is a large display using bright leds.

Edit: I am adding the schematic that I'm working off of. Guess I should have added in the beginning. Sorry folks.

Original site: http://www.circuitvalley.com/2012/02/30-volts-panel-volt-meter-pic.html

enter image description here

In the display, each segment contains 5x leds in parallel. As a result, the BC557's will need to be changed to something larger as 5x parallel leds may draw >100ma. The problem of the leds is that I'm using 01005 SMD leds in a small form factor but I am only finding them in stoopid bright instead of standard bright. :( When I thought of posing this question, I had difficulty figuring how to title it and I'm trying not to draw the question in that direction.

  • \$\begingroup\$ You just need to reduce the current flowing through the LED's somehow. There are many ways to do this. If you can show a schematic of your current setup and describe what components are available (is there a microprocessor involved? does it have a spare PWM output?). Also, do you just need a couple of discrete settings, or do you want to continually adjust over some range of ambient light? \$\endgroup\$ – mkeith May 13 '15 at 18:38
  • \$\begingroup\$ I added the schematic as requested. I was trying to examine the PIC16F676 datasheet for a spare PWM but am finding it difficult as so much data is conveyed in the datasheet or I'm not exactly sure what to look for as this is the first time using a programmable micro controller of any type. I had intended to attempt a dimmer that would vary the brightness over a range of ambient light. \$\endgroup\$ – Remembermyname May 14 '15 at 2:09
  • \$\begingroup\$ Don't exceed the PIC's maximum current per port, 100 mA sounds quite high. \$\endgroup\$ – tomnexus May 14 '15 at 14:55
  • \$\begingroup\$ I believe that buffering the PIC output against the leds would be suitable as 100ma IS too much. \$\endgroup\$ – Remembermyname May 14 '15 at 17:32

You need to do two separate things:

  1. Measure the light level. This should be done with a light dependent resistor and an analog input of the PIC.

  2. Adjust the brightness of the display. The simplest way I can think of is to reduce the duty cycle, the fraction of the time that the LEDs are on.
    You are already be switching quickly between the separate digits, so it should be a simple matter to turn them each on for an even shorter period of time. This will make them appear less bright.

Then you can link the two with a formula or algorithm, which you can develop by experiment.

A note on multiplexing:
You can generally get away with flickering an LED at perhaps 50 or 100 Hz, if it's for a normal range of brightness. But for very short duty cycles (and you will need to go very short to get a dim display, perhaps 1/256), even 100 Hz starts to look strange, the lights leave dotted streaks as you look around the room. So aim for something more like 1 kHz, to be sure it looks smooth even at low brightness.


You should read the resistor connected to RA4 with an ADC. With the voltage value you set the duty cycle to PWMs created on RA0/1/2. If you have hardware PWMs on those pins, you may use them and disable when the multiplex shouldn't be enabled on each digit.

Remember that when multiplexing your digits will already lose around 2/3 of their brighness since it will be around 2/3 of the time disabled. If you need to dim more, you should disable the common anode for a longer period in each multiplex cycle.


You have two approaches to controlling the brightness of the LED's: 1) Control the current through the common anode of the displays, perhaps using transistors to select various resistor values (or digtal switchable resistor device)

2) Pulse width modulate the LED segments. Use an interrupt routine, timers, and flash the LED segments on and off and control the ratio of on to off time of the LEDs.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.