Christmas Tree

AVR Project 조회 수 22870 추천 수 222 2004.10.14 13:10:49


http://www.grantronics.com.au

Christmas Tree

Here is a fun project to put on your Christmas Tree or in your front window to impress the neighbours.

Multi-Coloured Christmas Tree

Looking for something different to build this Christmas? Try our Multi-Coloured Christmas Tree. It will look great at the top of your Christmas tree or in the front window.

Last November, we published the very popular Christmas Star. This year, our "just for fun" project is in the shape of a tree but we have gone one step further by using bi-coloured LEDs. There are many different light patterns and each LED can produce 16 different colours.

Yes, you guessed it. The Tree is controlled by a microcontroller but this one is different. While it can be programmed by most "high-end" (expensive) chip programmers, it can also be programmed (and re-programmed) by a PC parallel port with minimal hardware. This makes it ideal for hobbyists. If you have been avoiding microcontrollers because of the cost of the programming hardware, now there is no excuse! And most of the development software can be downloaded free from the Internet – there goes another excuse!

Circuit description

The key to understanding any circuit is "divide and conquer" - break it down into functional blocks. There are 3 main blocks in the Tree. The first, the power supply, is very straight forward. 9Vdc should be applied to SK1. Reverse polarity protection is provided by D1. U2 then regulates down to 5V for the LEDs and the logic. Bypass capacitors C4 and C5 ensure the 7805 remains stable.

Next is the microcontroller or MCU. In previous projects, we used the Atmel AT89C2051. However, the I/O port structure is not quite suitable for this application so we have used the similar Atmel AT90S2313. The main feature influencing this decision is that the ‘2313 outputs can be "turned off" while the ‘2051 outputs always have pullups enabled. When I said the ‘2313 is similar to the ‘2051, I was referring to the arrangement of I/O pins and their functions. Inside, the two chips are quite different. See the sidebar "What’s in the AT90S2313" for a description of the microcontroller.

U3 (24C16) is a serial EEPROM where the pattern data is stored. While the ‘2313 has some EEPROM on chip (128 bytes), this was not enough for the number of patterns we wanted to provide.

The final block is, of course, the LEDs. At first glance, the PCB looks like it contains 32 LEDs. In reality, there are 64 LEDs as each is a bi-colour LED capable of glowing red or green. Two pin bi-colour LEDs were chosen to reduce the number of PCB tracks and MCU pins required – the three pin LEDs would have been easier to drive and would have required more MCU pins.

As expected, the LEDs are multiplexed. To control so many LEDs with so few MCU pins, we connect the LEDs in a matrix of 4 columns with 8 LEDs in each and use 12 pins. Multiplexing is where each column of LEDs is activated for a short time followed by the next column. If each time slot is short enough, our eyes don’t see any flicker.

While there are only 4 columns on the schematic, we have to drive each column twice in each multiplex cycle (once in each polarity) so we can activate the red and green LEDs. Consequently, each LED’s timeslot is 1/8 of the total. This is a practical minimum duty-cycle as the brightness reduces.

Resistors R6 to R13 set the peak LED current to about 25mA. Because there can only be 8 LEDs on at any time, the total maximum current drawn by the Tree is about 200mA. You can make the display slightly brighter by substituting 39 Ohm resistors (about 30mA per LED) but a small heatsink will be required on the regulator. Total current will then be about 250mA. Any 9Vdc plug pack rated at 250mA or more should be suitable. In practice, a 150mA 9V unregulated plug pack supply works with the 47R resistors as maximum current draw only occurs for "full brightness yellow" which does not occur very often. Note that the original Silicon Chip article had R6 to R13 as 100R. This value will work with a 12V supply but at reduced brightness.

Unfortunately, the microcontroller can’t drive the LEDs directly because maximum current ratings would be exceeded (risking loss of magic smoke!). So each pin is buffered by an emitter follower. Because each LED package has two LEDs connected in inverse parallel, the emitter followers have to be "bi-polar" so they can both source and sink current.

So, where a more conventional LED matrix would have 4 high current source drivers and 8 lower current sink drivers, this design has drivers that can source and sink.

Software

The software source code for the Tree is available for download from our web site at www.grantronics.com.au. The software was written in C and compiled by the Dunfield Micro/C compiler which, coincidentally(!), is available from Grantronics.

As each byte of pattern data is read in, it is processed by a simple interpreter. So each byte is an instruction such as "set colour to red" or "set Led 22 to the current colour" or "pause for 500ms". All the complex light patterns are built from these and similar simple instructions. If you want to know more about the instruction codes, download the software.

Assembly

Whew! With all the technical stuff out of the way, lets get the soldering iron going and start building. Your soldering iron should be temperature controlled (about 600F, 320C) with a fine tip.

Visually check the PCB for shorts between tracks and broken tracks. As usual, start with the lowest items such as wire links and resistors. Next, fit the IC sockets, crystal, small capacitors, regulator and input diode. The regulator should be bolted to the PCB to provide some heatsinking.

The transistors should be fitted next. All the BC547’s face one way and all the BC557’s face the other way. Now you can fit the LEDs. Be careful to insert them the right way and don’t apply too much heat as the leads are very short when the LED is pushed down against the board. Finally, C3 and the DC power connector should be fitted.

Testing

Carefully check your soldering – use a magnifying glass and a good light. Mistakes found now are less embarrassing than damaged components later! Don’t plug in the two DIL ICs yet.

Do a quick continuity check using your multimeter’s diode check range between U1 pin 10 (-) and every other pin of U1. There should be no shorts or diode junctions. Reverse the probes and you should see diodes (base-collector junctions) on the 12 pins that connect to the LED matrix. A similar test should be performed with U1 pin 20 (+) as the common pin. This may seem like a lot of work but a solder blob shorting a U1 I/O pin to 0V or +5 may damage U1 and spoil your Christmas!

When you are satisfied with your workmanship, connect 9Vdc. No LEDs should light. Measure U1 pin 10 (-) to pin 20 (+). You should have 4.8V to 5.2V. If all is well, remove power and plug in U1 and U3. Make sure they are correctly oriented and be careful not to bend any pins as you plug them into the sockets.

Turn your Tree on and the display sequence should start within a few seconds.

If it doesn’t work…

Modern electronic components are very reliable and faulty new components are very rare. All microcontrollers and EEPROMs programmed by Grantronics are individually tested so problems with these parts are unlikely. The reality is that the most common causes of problems are soldering, wrong component or wrong component orientation. So the first step in sorting out problems is to thoroughly check your workmanship (or should that be workpersonship…?).

After that, we need to get more logical. If a few LEDs don’t work, are they all in a single column or row? Maybe they only glow red and not green? The column drivers go high and the rows go low for red and vice versa for green. To help with fault finding, the first few patterns are simple "all one colour" displays. The patterns get more interesting after that…

I hope you have as much fun building and watching the Christmas Tree as we did designing it. Finally, thankyou to the people at BEC Manufacturing (Brisbane) for making the PCBs in time for this issue.

We hope you have as much fun building the Tree and playing with the software as we did creating it. Enjoy!

Modifications

If you must run the Tree from a 12V supply, mount the regulator on the back of the PCB (plastic body to PCB, bend the legs up instead of down) with a small heatsink. You will need a longer screw with a couple of nuts as a spacer.

 

Parts List
Quantity Description
Hardware
1 PC board type TREE
1 "DC" connector, 2.1mm (SK1)
1 4MHz crystal or ceramic resonator (X1)
1 8 pin IC socket
1 20 pin IC socket
1 9Vdc 150mA plug pack power supply (eg, Jaycar MP-3003)
1 M3 x 6mm screw and nut
Semiconductors
1 AT90S2313 (programmed) (U1)
1 7805 (or LM340T-5) regulator (U2)
1 24C16 EEPROM (programmed) (U3)
32 Bi-Colour LEDs (LD1-LD32)
12 BC547 or similar NPN transistor (Q1-Q23, odd numbers)
12 BC557 or similar PNP transistor (Q2-Q24, even numbers)
1 1N4002 power diode (D1)
1 1N4148 or 1N914 diode (D2)
Resistors (0.25W, 5% tolerance)
8 47R (R6-R13)
Capacitors
2 27p ceramic (C1-C2)
3 100n monolithic (C4-C6)
1 1uF 16VW+ RB electrolytic (C3)

Note: The LEDs used in the prototype were Jaycar ZD-1734 rated at 30mA.


What’s in the AT90S2313?

The AT90S2313 is a member of the Atmel AVR family of microcontrollers that range from tiny 8 pin packages to a 64 pin feature-packed "monster". Here is a short summary of the features of the ‘2313:

  • 118 instructions, most single clock cycle execution
  • 32 x 8 bit general purpose working registers
  • Up to 10 MIPS throughput at 10MHz
  • 2k bytes (1k words) of In-System-Programmable Flash for program storage (endurance 1,000 erase/write cycles)
  • 128 bytes of SRAM
  • 128 bytes EEPROM (endurance 100,000 erase/write cycles)
  • May be locked for program and EEPROM data security
  • One 8-bit timer/counter with separate prescaler
  • One 16-bit timer/counter with separate prescaler, compare and capture modes and 8, 9 or 10-bit PWM
  • On-chip analogue comparator (rail to rail inputs)
  • Programmable watchdog timer with separate on-chip oscillator
  • SPI serial interface (for In-System programming only)
  • Full duplex UART
  • Low power idle and power down modes
  • External and internal interrupt sources
  • 15 programmable I/O lines in a 20 pin package
  • I/O pins can sink up to 20mA for direct driving LEDs
  • 2.7 – 6.0V (4MHz parts) or 4.0 – 6.0V (10MHz parts)

AVR Resources on the Internet

Manufacturer’s data sheets, application notes, free development software and sample source code are available at: http://www.atmel.com

Sample startup code written by Dave Van Horn for the Atmel STK200 Starter Kit is available on Dave's web site (see our resources page) or at Dontronics.

More sample code and an FAQ at the AVR-forum.

There is an email list with an active group of AVR enthusiasts. Subscription details can be found on our resources page.


Download the Tree software source code (12k ZIP).
Download the
Tree schematic (29k PDF).

To compile the software, you will need a C compiler such as Dunfield Micro/C.

To program the AT90S2313 microcontroller and the 24C16 EEPROM, you will need a suitable programmer such as our GP-AT.

A kit of parts for the Tree is available from Jaycar Electronics stores for $49.95.
Grantronics can supply the programmed AT90S2313 + EEPROM for AUS$15 + postage.


Home Grantronics Home Page



List of Articles
번호 제목 글쓴이 날짜 조회 수

H/W 아이폰 충전 회로 file

  • eastsky
  • 2010-10-29
  • 조회 수 26405

iPhone Connector Info (Pin 27) USB Data (+) Pins 25 and 27 may be used in different manner. To force the iPod 5G to charge in any case, when USB Power 5 VDC (pin 23) is fed, 25 must ...

AVR Project UHF FSK PLL RF Module (NR-FPCX) file

  • eastsky
  • 2010-10-20
  • 조회 수 39195

UHF FSK PLL방식 무선 데이터 송/수신 모듈을 이용한 AVR 회로도 및 HEX 파일입니다. 기본적으로 CodeVision 에서 컴파일 한 HEX 이며, 2세트간에 10~20 Byte 이내에 데이터 송수신을 위한 회로 입니다. RF-Module ...

AVR Project Keypad & Encoder file

  • eastsky
  • 2010-10-15
  • 조회 수 30336

74HC138 을 이용한 10 * 8 Keypad 회로 입니다.. Encoder 을 사용할 때 시계방향과 반시계방향을 체크하는 방법입니다.. 여러가지가 있겠지만, 일정 시간 샘플링을 통한 방법이 가장 쉬우면서도 유효하다고 봅니다.

AVR Project JTAGICE mkII 상세 설명서 file [3]

안녕하세요 ⚑ 제가 JTAGICE mkII 상세 설명서를 얻었는데요 이 자료를 함동호님과 회원님들에게 드리려고해요. ★ 앞으로 많은 협조를 ★

H/W 스텝모터회로 - 테스트용 file

전에 스텝모터 테스트용으로 만든 회로 입니다.. 실제로 테스트 해보니 잘 돌기는 하는데... 좀 그러네요 ^^; 학교에서 테스트용으로 사용하면 좋을 듯 합니다.. 덤으로 196 모터 회로... 추가

AVR Project ATtiny26L의 AD 변환과 PWM 출력제어 file

http://www.geocities.jp/kuman2600/k2adc.html출처 : www.ipstack.co.kr 손잡이를 돌리면 모타의 회전이 바뀐다. 커다란 가변권선 저항을 직렬로 넣어 콘트롤하는 일이 있습니다. Tiny26L은 AD변환과 PWM기능이 있으므로, 가변저항으로...

AVR 강좌 AVR 관련 자료 file

http://cafe.daum.net/avrworld압축을 푸시면 아래의 자료가 있습니다.. 1. Atmega128 비트설정.pdf 2. ATMEGA 시리즈 클럭 Securit bits 설정방법.pdf 3. 코드비젼_한글메뉴얼.PDF

AVR Project Atmega16을 이용 74HC595 사용 file

http://scipia.co.kr/index.php?i_div=Its_tech_note&i_no=9이츠임베디드Atmega16을 이용 74HC595(8bit serial-in, serial or parallel-out shift register with output latches; 3-state) 사용기 입니다.. 이 자료는 이츠임베디드에...

AVR Project KLM-162CAN 을 이용한 전광판 file

http://myhome.naver.com/dolmangi/ 다른님이 만드신 전광판인데, 오래되어서 자료링크가 안되네요 ^^:   전광판 Electronic Signboard   많은 분들께서 전광판에 관심을 보여주고 계셔서 게시판을 만들었습니다. 많이 이용해...

AVR Project LED 전광판 file

http://home.wanadoo.nl/electro1/avr/dotmatrix.htm 개발자 사이트 : http://home.wanadoo.nl/electro1/avr/dotmatrix.htm 관련 사이트 : http://www.edaboard.com/ftopic58756-30.html 74H595 Shift Register App : http://www.kronosr...

AVR Project Stepper Motor Controller file

http://www.doc.ic.ac.uk/~ih/doc/stepper/control2/connect.html 새 페이지 2   Stepper Motor Controller Connection Diagrams The wires from the Logic PCB connector to the stepper motor in a TM100 Di...

AVR Project Christmas Tree file

http://www.grantronics.com.au Christmas Tree Here is a fun project to put on your Christmas Tree or in your front window to impress the neighbours. Multi-Coloured Christmas...

AVR Project Mega8 Door Bell file

http://www.microsyl.com 초인종 -줄거리 초인종은 간단해 보이나 그렇지 않다! 펄스폭변조로 정현파를 발생시키는 것은 매우 까다롭다, ATMega8의 발진으로 부터 OC1A를 출력하고 정현파 참조표로 부터 펄스폭이 정의된다. 1.8khz의...

AVR 강좌 Codevision C언어 Manual file

코드비젼 c언어 메뉴얼입니다

AVR 강좌 스텝모터 구동 및 구동회로도 file

전자부품연구원(KETI)에서 만든 기술 자료입니다 .

AVR Tool AVR OrCad9.1 Capture library file

http://www.dr-jekyll.pe.kr라이브러리 파일을 다운로드 받아서 압축을 푼후 capture\library\atmel 폴더에 넣으세요. 그리고 회로를 그릴때 add library해서 그리시면 됩니다. 라이브러리에 포함된 cpu리스트입니다. ATTINY12 ATTI...

AVR Project 12C508 IR Proximity Detector file

http://users.frii.com/dlc/robotics/projects/botproj.htm 적외선 LED와 적외선 리모콘용 수신센서를 이용한 근접센서 프로젝트입니다. 포토센서를 사용하는 방법보다 비교적 먼거리의 물체를 한개의 IR수신 IC로 감지합니다. 첨부된 ...

AVR 강좌 일반, 모터,센스, 전원회로 링크 file

** 예전 땜쟁이가 사는 곳의 링크 입니다 ** 일반회로 http://www.6k2avl.com/k_logic1.htm 모터회로 http://www.6k2avl.com/k_logic2.htm 센스회로 http://www.6k2avl.com/k_logic3.htm 전원회로 http://www.6k2avl.com/k_logic4.htm

AVR Project Led Sign with MMC Memory file

http://www.microsyl.com/     Led Sign with MMC Memory Card   History At the beginning this project was to buy a led sign to interface with my home automatisation network. This automatisation network ...

AVR Project MP3 Player file

http://www.microsyl.com/     MP3 Player History I decided to do this project for several reasons: first I like music, second I have a ton of MP3 and third I wanted to be able to listen those ...