Driving 24 LEDS with a attiny 44

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,

I'm trying to build a LED bargraph with 24 LEDs and an Attiny44.

I was thinking to multiplex the display as every 10ms, a group of 6 LED is selected with PORTB, and LED to be displayed are selected with PORTA (a kind of 4 colums x 6 lines matrix).

I used a BS170 to select 1 6 LED group among 4, as attiny cannot drive 6 LEDS with 1 PIN.

The issue is that all works well in simulation, but IRL only first 3 LEDS are set.

If I try with only 2 groups (so 12 LEDS), it works fine, I am thinking of an HW issue, but cannot figure out where I shall start to work.

Any idea guys?

For better understanding, schematic is attached.

Attachment(s): 

Last Edited: Thu. Jun 10, 2010 - 06:56 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

schematic would help. Do you have current limit resistors in the LEDs? Also the On Semi NUD3112 is like your FET but fully ready to drive from your AVR i/o pin.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My guess without adding up the loads is that you might double R2-R8 from 100 ohms to 220 and see if they all light.

EDIT: STK500 has 150 ohms in the LEDs. I would try bumping those resistors up as above.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A quick try with R2-R8 set to 200 ohms has the exact same result.

A new thing I see during this test, when I put LED_COL_0 signal to zero, first 3 LEDS light! Really strange.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

By the way, if you have any other idea to drive around 20 leds with my AVR, I will be glad to hear it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Based on your schematic it seems OK so look to the code now. When you say you set LED_COL_0 to zero are you turning on the FET? If you are turning off the FET then the flow path must be the other LEDs and maybe they are mounted reversed? or the board layout has errors?

Set PORTA 0-5 outputs and then set those values to ones. Turn on the FET and all 6 LEDs should light. Have you tried just doing that?

EDIT: Code maybe like this

// Input/Output Ports initialization
// Port A initialization
// Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out 
// State7=1 State6=1 State5=1 State4=1 State3=1 State2=1 State1=1 State0=1 
PORTA=0xFF;
DDRA=0xFF;

// Port B initialization
// Func3=In Func2=Out Func1=Out Func0=Out 
// State3=T State2=0 State1=0 State0=0 
PORTB=0x00;
DDRB=0x07;
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yes i tried this at first and itworks well
it is starting to be the mess when I try to multiplex more than 2 columns
I am thinking of building a dotmatrix, without FET at all...it may be simpler board, but a little bit more tricky software

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The 100 ohm resistors in series between the MCU & the gates of the FETS are superfluous. As no current flows in the gate of the FET there is no voltage drop across them.
A 10K between the gates & ground would be a better idea.

Charles Darwin, Lord Kelvin & Murphy are always lurking about!
Lee -.-
Riddle me this...How did the serpent move around before the fall?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would try this test:
Set all of the LED Line, (Port C) pins to output, and set them all High.
One at a time try connecting the resistor to the FETs to V+, (disconnect them from the AVR pins).
With the Col line high, (tied to V+), the 6 LEDs should come on.
Try this with each set of LEDs, but only one set at a time.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The lazy-arse solution: order a 24 channel led driver sample from ti.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

tiyakusa wrote:
By the way, if you have any other idea to drive around 20 leds with my AVR, I will be glad to hear it.

Well, here is another way to drive a bunch of leds from an AVR. Don't know if it's any simpler, but it does use less pins.
click for link

-carl

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

LDEVRIES,

The gates will have capacitance, so there will be some current on pin changes. I do agree regarding some sort of gate-gnd protection.

oddbudman