Driving multiplexed 7 segment display

Hi I am a newbie to Arduino but have had an interest in electronics since a kid and am an ex-C programmer, still involved in IT so I find the Arduino platform fascinating and have been playing with one for the past week.

I have been playing with 4 x 7 segment LED displays (common cathode) and driving them via a switching transistor on each cathode and performing the multiplexing in software.

This has proven OK but has several issues such as slight flicker, dimmer digits, timing issues when performing other tasks and other problems I'm sure people have run across.

My question is whats the best way to multiplex whilst still having the ability to control each segment? What multiplex IC do people recommend if I need extra hardware?

I would like to have full control of the LEDs, not jus sending numbers, but controlling the decimal point, and creating letters such as C and F for temperature readings.

Any suggestions would be greatly appreciated.

In terms of the flickering, I assume you are using digitalwrite? If you are I would switch to port manipulation, it is many, many, many times faster

For the timing issues while doing other tasks I suggest looking at using the timers, quite tricky actually, although mstimer2 is pretty beginner friendly.
http://www.arduino.cc/playground/Main/MsTimer2

As for extra hardware I suggest the trusty old 595, it has 8 outputs so it can drive every segment, and can be daisy chained. It is also dirt cheap.

Thanks so much Merve for your quick response. I didnt know about direct port access, I have modified my code (and its made it a lot simpler) and as a result it eliminated all flickering and the display is brigher and more solid.

I will investigate timers later, for my current use I will just be sampling an LM335 and trying to implement a clock of some type.

Would you suggest I go hardware multiplexing with the IC's you specified?

Also if I wanted to dim the display (say at night) what would be the best method? I was thinking a transistor in between ground and the emitters of the driver transistors with its base fed via a PWM output?

Thanks again for your quick response :slight_smile:

You don't have to use the hardware, but they are cheap, and you can multiplex a whole display off 3 pins. Also if you use the hardware SPI bus you can shift out a byte in 16 cycles,which is just ridiculous.

An easy way to do it is simply implement an empty frame after you have updated the whole display. Then you can just adjust the number of times the code loops through the empty frame to dim/brighten it.

I prefer to do it through code, but probably your way would work too. Just check that the display update frequency is slower than the PWM frequency, otherwise the PWM might just dim certain segments instead of the whole display.

I might look at the 595 IC's. I have vastly improved my display in software but I still havent got it quite right (im pretty picky)

I'm getting a little bit of bleed from the 'ones' digit in the 'thousands' digit (very faint but its there) - also the thousands digit is slightly brighter than the others. I assume becuase code is executing after thousands digit is being written, and the loop restarting causing it to be on slightly longer than the others.

I dont suppose you know where I could get some sample code to compare what I have to the methods others are using?

Cheers

For the bleed just make sure you disable all the transistors before you change the segment pins.

Using a timer will help you smooth out the display.

In terms of sample code, nothing on hand I'm afraid