Skip to content


POV(Persistence of vision) kit using AVR

This is my first serious(the first one was a one LED blinker) AVR project :)
I searched the Internet for a cool looking and easy to build project with ATTiny2313 and I end up on this page,it was a really nice project to start with so I made a list and I went to the local electronics shop to buy them, all the components + board cost me about 4$.
The schematic for it is :

CIRCUIT.GIF

and the components :

  • IC1 => ATTiny2313 (or AT90S2313)
  • C1,C2 => 30 pF
  • QTAL1 => 4 MHz quartz
  • D1-D7 => LEDs
  • R1-R7 => 100 Ohms

The construction is very simple.Below are some pictures :

IM001001.JPG
After soldering the socket
IM001005.JPG
Soldering the resistors and quartz
IM001020.JPG
Preparing to solder the LEDs
IM000197.JPG
The first version of the circuit (it is working on a 9V battery, I used a 78L05 regulator for this)

After building the circuit you can take the original source code that you can find on this article.
I wrote a small Visual Basic piece of software that let’s you build up your own messages that you can wave left and right to see what this project is about :P , it uses the so called persistence of vision effect (the illusion of floating letters in the air).
The current software let you generate codes for SPACE, A-Z and 0-9.

soft.GIF

so just download it, write your text and copy & paste it to replace the existing text.

You can download the software + the source code (in VB6) here.

Here is my modified code based on the original one:

Visual Basic [Show Plain Code]:
  1. ’set crystal value : 4MHz = 4.000.000Hz
  2. $crystal = 4000000
  3. Dim A As Byte , B1 As Byte , C As Byte
  4. Config Portd = Output
  5. Config Portb = Output
  6. Start:
  7. Portb = 00
  8.  
  9. For C = 1 To 255
  10. Restore Xxx
  11. For A = 1 To 147
  12. Read B1 : Portd = B1
  13. Waitms 10
  14. Next
  15. Waitms 10
  16. Next
  17. Goto Start
  18. End
  19.  
  20. Xxx:
  21. Data &H7E , &H01 , &H01 , &H7E , &H01 , &H01 , &H7E         ‘W
  22. Data &H7F , &H08 , &H08 , &H08 , &H7F , &H00 , &H00         ‘H
  23. Data &H3F , &H48 , &H48 , &H48 , &H3F , &H00 , &H00         ‘A
  24. Data &H40 , &H40 , &H7F , &H40 , &H40 , &H00 , &H00         ‘T
  25. Data &H00 , &H00 , &H00 , &H00 , &H00 , &H00 , &H00         
  26. Data &H3F , &H48 , &H48 , &H48 , &H3F , &H00 , &H00         ‘A
  27. Data &H00 , &H00 , &H00 , &H00 , &H00 , &H00 , &H00         
  28. Data &H3E , &H41 , &H49 , &H49 , &H2E , &H00 , &H00         ‘G
  29. Data &H7F , &H48 , &H4C , &H4A , &H31 , &H00 , &H00         ‘R
  30. Data &H7F , &H49 , &H49 , &H41 , &H00 , &H00 , &H00         ‘E
  31. Data &H3F , &H48 , &H48 , &H48 , &H3F , &H00 , &H00         ‘A
  32. Data &H40 , &H40 , &H7F , &H40 , &H40 , &H00 , &H00         ‘T
  33. Data &H00 , &H00 , &H00 , &H00 , &H00 , &H00 , &H00         
  34. Data &H3E , &H41 , &H41 , &H41 , &H22 , &H00 , &H00         ‘C
  35. Data &H00 , &H00 , &H7F , &H00 , &H00 , &H00 , &H00         ‘I
  36. Data &H7F , &H48 , &H4C , &H4A , &H31 , &H00 , &H00         ‘R
  37. Data &H3E , &H41 , &H41 , &H41 , &H22 , &H00 , &H00         ‘C
  38. Data &H3E , &H01 , &H01 , &H01 , &H3E , &H00 , &H00         ‘U
  39. Data &H00 , &H00 , &H7F , &H00 , &H00 , &H00 , &H00         ‘I
  40. Data &H40 , &H40 , &H7F , &H40 , &H40 , &H00 , &H00         ‘T

Also here is a test program to see if the LEDs are working fine :

Visual Basic [Show Plain Code]:
  1. ‘Title : LED mover
  2. ‘Author : Trimbitas Sorin
  3. ‘Webpage : http://stuff.nekhbet.ro
  4. ‘Date : 24/September/2006
  5.  
  6. ’set crystal value : 4MHz = 4.000.000Hz
  7. $crystal = 4000000
  8. ‘declare variables
  9. Dim X As Byte , Y As Byte , Z As Byte
  10. ‘configure the PORTD and PORTB for output
  11. Config Portb = Output
  12. Config Portd = Output
  13. ’set PORTB to 0 (GND)
  14. Portb = 0
  15. For X = 1 To 255
  16. For Y = 0 To 6
  17. ’set all LEDs to OFF
  18. Portd = 0
  19. Waitms 20
  20. ’set all LEDs from 0 to current position to ON
  21. For Z = 0 To Y
  22. Portd.z = 1
  23. Next Z
  24. Waitms 20
  25. Next Y
  26. Next X
  27. End

To load it on the chip you need 3 things : the hardware programmer, the compiler (you need to compile the code to HEX format) and a software programmer (to burn the HEX file to your chip).
—For the first issue : I have build an extremly simple AVR programmer.To access it click here.
—For the second issue : go to www.mcselec.com and download the trial for Bascom AVR (it is limited to 4kb of code so it is PERFECT :P for our purpose), install it, create a new file (it will have .BAS extension) and compile the code (press F7 in the program window).
—And now the last issue : if you build the hardware I presented above them please go to AVReal homepage and download that software (don’t forget to install also the Win32 driver).

Win32 driver download here

The AVReal command line parameters should be something like :
“avreal32.exe +TINY2313 -p1 -ap -o0 -e -w -v -c YOUR_FILENAME.HEX”
If you have any problems on this just drop me few lines on the comments section.


Here is another cool looking testing program along with a small video of it (sadly my camera can’t capture the POV effect so that’s why I didn’t put any pictures/videos with it).

Visual Basic [Show Plain Code]:
  1. ‘Title : LED mover
  2. ‘Author : Trimbitas Sorin
  3. ‘Webpage : http://stuff.nekhbet.ro
  4. ‘Date : 24/September/2006
  5. ’set crystal value : 4MHz = 4.000.000Hz
  6. $crystal = 4000000
  7. ‘declare variables
  8. Dim X As Byte , Y As Byte , Z As Byte
  9. ‘configure the PORTD and PORTB for output
  10. Config Portb = Output
  11. Config Portd = Output
  12. ’set PORTB to 0 (GND)
  13. Portb = 0
  14. For X = 1 To 255
  15. ‘left to right
  16. For Y = 0 To 6
  17. Portd = 0
  18. Portd.y = 1
  19. Waitms 40
  20. Next Y
  21. ‘right to left
  22. For Y = 5 To 1 Step -1
  23. Portd = 0
  24. Portd.y = 1
  25. Waitms 40
  26. Next Y
  27. ‘i wrote this to keep it running smoothly ;)
  28. Portd.0 = 1
  29. Next X
  30. End


References :

Posted in AVR projects.


34 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Huh? says

    Why do you need to occupy both ports? In other words, why can’t you just ground the resistor end of each LED leg?

  2. Trimbitas Sorin says

    You are right, using simple LEDs there is no need to use both ports. :D
    If you do the schematic above you can use also Bicolor LEDs and change between their colors by software.
    Regards
    Sorin

  3. firoz says

    nice very nice.
    u did very well in making the article.its quite understanding.and the code generator is pretty amazing.
    before building this ckt most of us built(pov guys)ladyada’s minipov (http://www.ladyada.net/make/minipov2/index.html).the main problem we are facing is with generating code.there is no particular tool for that.i’ll be thankful if u could make a tool for the minipov too.

  4. Trimbitas Sorin says

    I can try :) , let me take a look over it and in maximum 24h i’ll give you a reply.
    Regards
    Sorin

  5. firoz says

    ohh that will be great.
    i’ll be waiting for ur reply.

  6. Trimbitas Sorin says

    I took a look at their schematic and they use 8 LEDS instead of 7 so the problem is that I will need to rewrite the characters code (it is easy but will require a lot of time). I’ll try to make some time next week to build it :)

  7. firoz says

    hi
    it seems u just updated the article its nice.
    if u have any more avr projects pls do post.
    thanks

  8. firoz says

    ooops sorry my mistake..
    iam still waiting for the minipov tool.
    thanks

  9. Trimbitas Sorin says

    I’m a little busy now for the next 2 weeks(school, work …) but after this period i will surely do another AVR project as I really enjoy doing this.
    When you get your minipov tool let me know so I can write a small message test program so you can test it and then I’ll release the 8LEDs software(I don’t own a minipov kit).
    Take care
    Sorin

  10. firoz says

    thanks i’ll.
    and at the same time we can build a fixture for this pov.imean like in a tube so that we can carry it easily.one guy did this very well in ladyada’s site.but he did’t mentioned any design details(http://www.ladyada.net/forums/viewtopic.php?t=813)
    if u have any idea let me know.we can build one.

  11. Trimbitas Sorin says

    Hi,
    What do you mean with “he did’t mentioned any design details”? You mean the design of the board? If yes then it is easy to modify it to fit in such a tube + you can add a small connector so the device can support on-board programming ;)
    Enjoy the Sunday
    Sorin

  12. firoz says

    imean what type od batteries he used,is it consist of in circuit programmer or not.and that tube look like made of aluminium so how he managed to place the LED’s etc.

  13. zubiaur says

    hi there, i’v been following your tutorial wich I think is fnatastic! (better the the one from ladyada cuz she uses an ATtiny)

    the only problem is that while burning to eeprom I get a error message: Verifiyng CODE memory: Failed, 181 errors, (sometimes more some less)

    well I’m very worried, I even started to think that the 2313 is failing… and that is scary, one of those here in Peru are about $15!!! I’m currently using an at90s2313 – 10pi

    please please help me!!

    thanks in advance! :D seeya!

    ps:any english wrting related problem is done intentionally, dont think it was my fault :P :P :p

  14. Trimbitas Sorin says

    Hi Zubiaur,
    Sorry for the delay but I was really busy lately.
    About your chip … before pogramming you need to erase chip, have you done this?
    Please read http://www.serasidis.gr/forums/forum_posts.asp?TID=157 as there are many answers (I had the same problems as you at first).
    Did it helped?
    Regards
    Sorin

  15. ph0rkeh says

    Im kinda new at this avr programming, but what program do you use to program your avr’s in visual basic?

  16. ph0rkeh says

    sorry missed the bascom part

  17. Trimbitas Sorin says

    No problem :D , if you have any other problems don’t be afraid to ask :)
    Regards
    Sorin

  18. Vash says

    Could you code this in C or c++?

  19. Trimbitas Sorin says

    Actually it would be kinda easy to convert it to Visual C++ but sadly I’m a little too busy to do this now and I don’t see the point of the conversion. If you need help with the code then please ask and I’ll try to find the VB sources and send you the array needed to convert the characters.

  20. arash says

    hello
    can you send source file texgen for me???
    thanks

  21. arash says

    hello
    can you send source file texgen for me???
    thanks
    arash.micro@gmail.com

  22. Trimbitas Sorin says

    I can’t find the sources for it. You can build it from 0 if you really need a clone, it is just a great switch (select case) structure…
    Regards
    Sorin

  23. tyler says

    i get a problem with avreal, i get the cant resync error then it stops, ive tried searcching google but all the pages are in russian, any ideas? ive typed and retyped the code a thousand imes… but no luck…

  24. Trimbitas Sorin says

    Hi Tyler,
    It is hard to debug remote a circuit and I hadn’t played with avreal in the past few months.
    You can translate those Russian pages using http://www.google.com/language_tools , look at the bottom of the page and you’ll see “Translate a web page:”, insert there your URL, choose “Russian to English BETA” and press “Translate” :)
    Sorin

  25. Silas says

    Hey,

    I’ve just bought the stuff to build this..
    I was wandering how you would make a heart? Like for instance “I (heart) New York”
    What is the code for a filled out heart? Maybe
    theres is some easy way to figgure out myself? Help please! Thank you!

  26. McGiver30 says

    Just wondering if i could get the textgen program? I just built the circuit and would like to edit the code.The software is no longer available .thanks

  27. Trimbitas Sorin says

    Hi McGiver30 .. ohh, just now I saw that the links were gone.

    I just fixed them + added the source code in Visual Basic 6. Maybe someone will use it :)

    Regards

    Sorin

  28. McGiver30 says

    thanks buddy

  29. Tony says

    This seems like the perfect tutorial for me right now ,I spent hours looking for something like this. I am really hoping someone could explain briefly how to hex the files to get them on my chip. I have winavr installed but I cannot really figure out how to hex a file.If its too hard to explain maybe you could point me towards a tutorial. Thank you for posting.

  30. Trimbitas Sorin says

    Hi Tony,

    If you want to use this code, don’t use WinAVR but the BascomAVR (for which the code is written).

    Regards

    Sorin

  31. Tony says

    Thanks a million Trimbitas , I downloaded BascomAVR but I am still not too familiar with all the procedures or steps involved in using these programs, could you recommend a good tutorial for BascomAVR?

  32. Trimbitas Sorin says

    :) , you can take a look over their official help page : http://avrhelp.mcselec.com/

    If you only want to create the hex file (which you’ll load to the chip using AVRReal) .. open Bascom AVR anc copy & paste the code above, save the file, press F7 (Compile) and wait few seconds. Then at the same location as the newly saved .bas file you’ll see the hex file too.

    Hope this helps

    Sorin

Continuing the Discussion

  1. MAKE: Blog linked to this post on September 26, 2006

    POV (Persistence of vision) using AVR…

    Trimbitas writes – “This is my first serious (the first one was a one LED blinker) AVR project :) I searched the Internet for a cool looking and easy to build project with ATTiny2313 and I end up on……

  2. Technology Insight » Blog Archive » POV (Persistence of vision) using AVR linked to this post on September 26, 2006

    [...] Trimbitas writes – “This is my first serious (the first one was a one LED bOriginal Linker) AVR project I searched the Internet for a cool looking and easy to build project with ATTiny2313 and I end up on this page, it was a really nice project to start with so I made a list and I went to the local electronics shop to buy them, all the components + board cost me about 4$.” – Original Link. [...]



Some HTML is OK

or, reply to this post via trackback.


Get Adobe Flash playerPlugin by wpburn.com wordpress themes