Wednesday, November 21, 2012

ADC and two (red/blue) 4-digit led displays on atmega8

The goal

Drive two different colors 4-digit led displays.




  • 1 x atmega8
  • 1 x 7447
  • 1 x 4-segment led display common anode, red KW4-311AVA
  • 1 x 4-segment led display common anode, blue KW4-311ABA
  • 8 x BC547 transistor
  • 9 x 4,7K resistor
  • 1 x 1K resistor
  • 7 x 680 resistors
  • prototype board or any other
  • 2 x 2 pin male connector
  • 1 x 4 pin male connector



CNY70 + ADC test

Electric diagram 

Led display driver



Displays are connected to DM7447 which is a BCD to 7-Segment Decoder/Driver.  From 7447 I use 4 input pins (BCD value from atmega8) and 7 outputs which are connected to a..g segments of led display. DM7447 is powered too, but you can't see this on electric diagram.

Atmega8 is sending BCD number to 7447 and at the same time is sending a logic 1 to one of the pins from PB0..PB7. At one time atmega8 and 7447 can drive only one led number, the illusion of working all 8 together is made by very fast switching BCD number and logic 1/0 on PB0..PB7 , eye can't follow that and you think, that is real.

Whole device

Board has 2 ADC inputs which are connected to 4 male pin header (2x ADC, +5V and GND), so you can attach some sensors to it. Those 2 pins are I2C port, so you can attach some I2C/TWI equipment to them.

Board and connections are ugly, but I'm to lazy to make PCB right now. Led Displays are very delicate, and maybe someday I would like to use them for another project, so I add a pin female connector in which led displays are docked.

Deatached led display.
Led display is mounted in female pin connector


This device was made for Water meter counter, so it has additional features, that aren't on the electric diagram. The ADC pins are pull up by two 47K resistors, this is necessary for CNY70, because sensor almost shorts to ground, when it's covered by white piece of paper (high reflection ratio).

Pictures below, show CNY70 connected to this device.

2 x CNY70
As you can see, CNY70 has 2 spots, one is IR sensor, second is IR led. Led must be powered, so there is additional 680ohm resistor put between anode and power source (+5V).

No comments:

Post a Comment