Arduino POV


Arduino POV
Originally uploaded by bluesterror

Since everyone else is doing it, I decided to hack together my own persistence of vision thing this evening. This is a circuit where you have a single vertical line of LEDs, but if you turn the LEDs on and off fast enough and wave them around, your eyes are fooled into seeing complete letters. It only took about 20 minutes to write the C code to load up onto my trusty ATmega8, then I used a camera with a long shutter period to take the picture to the right.

I realize my blog has devolved into Bob’s Dumb Project Of The Week lately. I’ll have to work on that. Lots of travel is coming my way soon: Toronto this next weekend, Atlanta in three weeks, and Warrenton, VA somewhere in between. I shall report on them soon enough.

2 Replies to “Arduino POV”

  1. Re: Cool Project!

    Sure. There’s already a picture of the shield on the flickr page, but here’s the code. I left out font.[ch] as it’s just a big array with the font bitmap. In the font, each letter is represented by 6 bytes, with each byte representing a horizontal scanline – if a bit is 1 then the LED is turned on. I just manually constructed the array. I use space as the first letter and consecutive ascii values from there, so it starts like this:

    char font[] = {
        0, 0, 0, 0, 0, 0,   // SPACE
        0x18, 0x18, 0x18, 0x18, 0, 0x18, // !
        //...
    }
    


    Rest of the code:

    #define DELAY 4

    char s[] = “bob “;
    char pins[] = { 2, 4, 6, 8, 10, 12 };

    void setup()
    {
    int i;
    for (i=0; i
    pinMode(pins[i], OUTPUT);
    }

    void write_char(char ch)
    {
    int i,j;
    ch = toupper(ch);
    if (ch < ' ' || ch > ‘Z’)
    ch = ‘ ‘;

    ch -= ‘ ‘;

    for (i=7; i>=0; i–) {
    for (j=0; j<6; j++) {
    char b = font[ch * 6 + j];
    digitalWrite(pins[j], !!(b & (1 < < i)));
    }
    delay(DELAY);
    }
    for (j=0; j<6; j++)
    digitalWrite(pins[j], 0);
    delay(DELAY * 2);
    }

    void loop()
    {
    int i;
    for (i=0; i
    write_char(s[i]);
    }

Comments are closed.