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:

'set crystal value : 4MHz = 4.000.000Hz
$crystal = 4000000
Dim A As Byte , B1 As Byte , C As Byte
Config Portd = Output
Config Portb = Output
Start:
Portb = 00

For C = 1 To 255
Restore Xxx
For A = 1 To 147
Read B1 : Portd = B1
Waitms 10
Next
Waitms 10
Next
Goto Start
End

Xxx:
Data &H7E , &H01 , &H01 , &H7E , &H01 , &H01 , &H7E         'W
Data &H7F , &H08 , &H08 , &H08 , &H7F , &H00 , &H00         'H
Data &H3F , &H48 , &H48 , &H48 , &H3F , &H00 , &H00         'A
Data &H40 , &H40 , &H7F , &H40 , &H40 , &H00 , &H00         'T
Data &H00 , &H00 , &H00 , &H00 , &H00 , &H00 , &H00         '
Data &H3F , &H48 , &H48 , &H48 , &H3F , &H00 , &H00         'A
Data &H00 , &H00 , &H00 , &H00 , &H00 , &H00 , &H00         '
Data &H3E , &H41 , &H49 , &H49 , &H2E , &H00 , &H00         'G
Data &H7F , &H48 , &H4C , &H4A , &H31 , &H00 , &H00         'R
Data &H7F , &H49 , &H49 , &H41 , &H00 , &H00 , &H00         'E
Data &H3F , &H48 , &H48 , &H48 , &H3F , &H00 , &H00         'A
Data &H40 , &H40 , &H7F , &H40 , &H40 , &H00 , &H00         'T
Data &H00 , &H00 , &H00 , &H00 , &H00 , &H00 , &H00         '
Data &H3E , &H41 , &H41 , &H41 , &H22 , &H00 , &H00         'C
Data &H00 , &H00 , &H7F , &H00 , &H00 , &H00 , &H00         'I
Data &H7F , &H48 , &H4C , &H4A , &H31 , &H00 , &H00         'R
Data &H3E , &H41 , &H41 , &H41 , &H22 , &H00 , &H00         'C
Data &H3E , &H01 , &H01 , &H01 , &H3E , &H00 , &H00         'U
Data &H00 , &H00 , &H7F , &H00 , &H00 , &H00 , &H00         'I
Data &H40 , &H40 , &H7F , &H40 , &H40 , &H00 , &H00         'T

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

'Title : LED mover
'Author : Trimbitas Sorin
'Webpage : http://stuff.nekhbet.ro
'Date : 24/September/2006

'set crystal value : 4MHz = 4.000.000Hz
$crystal = 4000000
'declare variables
Dim X As Byte , Y As Byte , Z As Byte
'configure the PORTD and PORTB for output
Config Portb = Output
Config Portd = Output
'set PORTB to 0 (GND)
Portb = 0
For X = 1 To 255
For Y = 0 To 6
'set all LEDs to OFF
Portd = 0
Waitms 20
'set all LEDs from 0 to current position to ON
For Z = 0 To Y
Portd.z = 1
Next Z
Waitms 20
Next Y
Next X
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 😛 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).

'Title : LED mover
'Author : Trimbitas Sorin
'Webpage : http://stuff.nekhbet.ro
'Date : 24/September/2006
'set crystal value : 4MHz = 4.000.000Hz
$crystal = 4000000
'declare variables
Dim X As Byte , Y As Byte , Z As Byte
'configure the PORTD and PORTB for output
Config Portb = Output
Config Portd = Output
'set PORTB to 0 (GND)
Portb = 0
For X = 1 To 255
'left to right
For Y = 0 To 6
Portd = 0
Portd.y = 1
Waitms 40
Next Y
'right to left
For Y = 5 To 1 Step -1
Portd = 0
Portd.y = 1
Waitms 40
Next Y
'i wrote this to keep it running smoothly 😉
Portd.0 = 1
Next X
End


References :

36 comments on “POV(Persistence of vision) kit using AVR

  1. Pingback: MAKE: Blog

  2. Pingback: Technology Insight » Blog Archive » POV (Persistence of vision) using AVR

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

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

  5. 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.

  6. 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. hi
    it seems u just updated the article its nice.
    if u have any more avr projects pls do post.
    thanks

  8. 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

  9. 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

  10. 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.

  11. 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! 😀 seeya!

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

  12. 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.

  13. 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

  14. 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…

  15. 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

  16. 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!

  17. 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

  18. 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

  19. 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.

  20. 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?

  21. :), 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

  22. I love this project I wish I could make it with UsbtinyIsp but I cant compile with Bascom. If anyone knows how please let me know ..

  23. poti sa imi dai un simplu .hex gata de programat pentru tiny2313 cu cuvantul “Hesit8″… mersi… il folosesc cu setarile initiale de 8mhz cu 14 cicluri si 65 ms de startup ;;) 😀 ple help 😀

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.