Shop OBEX P1 Docs P2 Docs Learn Events
Persistence of Vision Robot, aka Mr. Spinny (now with pictures showing POV) — Parallax Forums

Persistence of Vision Robot, aka Mr. Spinny (now with pictures showing POV)

ZootZoot Posts: 2,227
edited 2010-02-28 15:04 in Robotics
attachment.php?attachmentid=68101

OK, here we go -- the concept is quite simple -- a small tabletop 'bot with a single QRD1114 IR/emitter sensor on the bottom runs around looking for a black tape line (same line that a line-follower might pick up). Upon finding the line, the 'bot spins *very* fast and uses the seven-LED bank to do persistence-of-vision text. As the sensor passes the line on each revolution (actually, twice each revolution), it uses the line as a "sync mark" to restart the first column of pixels of the text string.

Basically it sits around showing a dim pattern on the LEDs and plaintively beeping occasionally. When disturbed, it roams around and does it's POV thing when it finds a line. The same detector is used for a "cliff" detector as well (RC decay on the QRD1114). A cds cell with sigma-delta ADC is used for determining if it's too bright to make POV worthwhile.

A small calibration routine is run upon powerup/reset that lets the user hold the 'bot over the tabletop surface, the line, and the "cliff" edge so... the stored values are used for determining thresholds when reading grays through the QRD detector. I would have done just about *anything* to have even 6 bytes of EE on an SX for this -- there was no way I would be able to spare codespace for I2C or SPI routines for an external EEPROM -- unfortunately, the next 'bot like this may be on an AVR for just this reason -- but I digress smile.gif

It's highly effective, truly. I will try to get video up sometime in the next few weeks. With the cover on, the sound out of the piezo is much better, looks more finished, and the "cloudy" translucency of the case only adds to the POV effect.

In any case, the basic chassis is a CD spindle case. A thin bit of craft plywood was glued on the underside to stiffen it up. Minimal parts (see plans and cutting template PDF) -- a Pololu cheapo tiny caster, two Solarbotics GM8 gearmotors, an SX, misc parts.

One side note -- the GM8s were not quite fast enough for decent POV, so I purchased Solarbotics' faster motor-only upgrade for the GM8/2 gearboxes -- the pair was perhaps $3 or $4 and are 4x faster. Truly exceptionally cosmically fast. In the first test with the new motors, the thing flew off the table top a full five feet in into the air before crashing to ground. Generally the 'bot is throttled wayyyyyy back while roaming, it only goes full speed in a spin.

Lastly, I *did run lots of tests* with IR emitters inside the translucent CD case -- I can assure you that such plastics are translucent to IR as well -- the IR both reflects AND passes through the plastic. So detectors are no problem, but I had to drill small holes in the case for the IR emitters (press fit -- there are two-pin header connectors for both LEDs so the case top is easily removed for programming or battery changes.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST

1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php


Post Edited (Zoot) : 2/25/2010 10:55:34 PM GMT
1487 x 1109 - 376K
1470 x 891 - 319K
1393 x 979 - 299K
1695 x 1065 - 431K
1720 x 1152 - 519K

Comments

  • ZootZoot Posts: 2,227
    edited 2009-06-09 22:22
    Attached here is the:

    - schematic

    - full-size drilling/cutting templates (I usually print these on card stock, tape or glue them to raw pieces, then drill/cut right through the cardstock)

    - SX/B and .SRC code (most of my SX/B ends up as assembly, however)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php


    Post Edited (Zoot) : 11/3/2009 12:38:34 AM GMT
    2040 x 1540 - 32K
  • ZootZoot Posts: 2,227
    edited 2009-06-09 22:22
    Here are a few pix with the cover on and him "in action". Unfortunately, I'm not getting decent photos of the POV -- what seems to show up is only what is passing during the "shutter" release. Not my camera, though, just a quick borrow-and-shoot.

    The first two he is roaming, the third and fourth he is spinning on the line.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php


    Post Edited (Zoot) : 2/25/2010 10:54:54 PM GMT
    2816 x 2112 - 1M
    2816 x 2112 - 2M
    2816 x 2112 - 1M
    640 x 571 - 169K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-06-09 22:31
    That's an incredibly creative (and "green") reuse of a CDROM case! It makes for a really nice-looking bot.

    -Phil
  • SRLMSRLM Posts: 5,045
    edited 2009-06-09 23:35
    Nice project. Do you have a movie?
  • WhitWhit Posts: 4,191
    edited 2009-06-10 01:57
    Zoot,

    Fantastic robot. Very creative. Like Phil, I love the use of the CD case. Your workmanship is very nice as well. Thanks for posting this! I look forward to video...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Whit+


    "We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney

    Post Edited (Whit) : 6/10/2009 2:02:44 AM GMT
  • HumanoidoHumanoido Posts: 5,770
    edited 2009-06-10 05:49
    Spectacular robot Zoot! Good work!

    humanoido
  • mikedivmikediv Posts: 825
    edited 2009-11-01 21:12
    Zoot I am so impressed I am taking a shot at building this , can I ask you when I unzipped the code there are 2 programs I am very new to the SX do I load both programs at the same time? Or do you load one program and the other for something else?
    Thank you for sharing this project I would love to see your AVR one as well

    Post Edited (mikediv) : 11/1/2009 9:23:14 PM GMT
  • ZootZoot Posts: 2,227
    edited 2009-11-01 22:48
    The .src is the compiled version ready for loading. The .SXB is the actual code as written, but it may not assemble as I don't believe I included my libraries (wrapped functions for div/mult/modulo/etc). Sorry, it turns out my zip archive was corrupt, so I threw up the code last night, but need to get the libraries in there as well. I've got three other SX28 'bots on the bench right now that are much simpler (more "Bot-bot"-like) so I'll try to get those up as well.

    Much of my code starts as high-level SXB and eventually gets hand translated down to assembly to maximize code space, so it can be a bit dense. In block form, my basic SX-based 'bots follow a flow like this:


    
    ISR: ' interrupt at either ~77_000 or ~154_000 so that serial comms are doable as well as providing easy alternate bits for ~38khz IR emitters
    
       Increment basic timecounters (ms)
       Increment basic IR counters (ticks, state timer)
       Increment ISR counter (used as prescaler for pseudo-tasks in ISR
    
       Toggle IR Emitters based on state as set from mainline, e.g.
       IF irState.0 = 1 THEN ' on state
          IF irState.1 = 0 THEN ' left/right?
               irEmitterLeft = ~irEmitterLeft
          ELSE
                irEmitterRight = ~ irEmitterRight
          ENDIF
       ENDIF
     
    
       Alternate ISR runs: (i.e. using bit.0 of the ISR counter, these run every other time in the ISR so things don't bog down:
           Count sensor inputs (i.e. IR detector, sigma-delta ADC), e.g.
           IF irDetector = 0 THEN ' active low
               IF irHits < 255 THEN ' prevent rollover
                  irHits = irHits + 1
               ENDIF
           ENDIF
    
    
           Output motor PWM
      
           Isr Done
    
    '----------------------------------
    MainLine:
    
        Update actual timers and clock based on counters from ISR, e.g.
        IF msCntr > #77 THEN
             msCntr = msCntr - 77
             INC milliSeconds
             INC irTmr
            ' etc
        ENDIF
    
        Update sensors, usually some kind of simple state machine based on counts from ISR, e.g.
        IF irState.0 = 0 THEN ' set up to emit pulse
            IF irTmr >= 3 THEN  '3 ms off between pulses
                  irHits = 0 ' remember this counter is incremented in the ISR based on detector "hits"
                 irTmr = 0 ' this timer is a millisecond tmr handled by the mainline
                 INC irState ' when bit.0 of state is 1, you are emitting and reading detector, bit.1 determines left/right
            ENDIF
        ELSEIF irState.0 = 1 THEN
            IF irTmr >= 2 THEN ' 2 ms pulse
                IF irHits >= SomeThreshold THEN
                    flag = 1
                ELSE 
                    flag = 0 ' no hit
                ENDIF
                IF irState.1 = 0 THEN ' you are on left LED
                       irObstacleLeft = flag
                ELSE
                       irObstacleRight = flag
                ENDIF
                irTmr = 0
                INC state
                irState.2 = 0 ' rollover to zero
                IREmitterLeft = 0 ' turn off LEDs so ISR doesn't have to
                IREmitterRight = 0
            ENDIF
         ENDIF
    
    
         Update Motors: ' mainline sets values, but ISR handles moving this PWM (or servo) output
             IF irObstacleLeft = 1 THEN
                  motorLeft = 255
                  motorRight = 0
            ELSEIF irObstacleRight = 1 THEN
                 motorLeft = 0
                 motorRight = 255
             ELSE
                motorLeft = 200
                motorRight = 200
             ENDIF
    
        Go to top of main and do it again...
    
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php


    Post Edited (Zoot) : 11/3/2009 4:45:50 PM GMT
  • ZootZoot Posts: 2,227
    edited 2009-11-03 00:37
    Updated code .zip archive with current .SXB and .SRC (in directory "robotProgram") and my current libraries. Will try to get video, current pictures up sometime today or tomorrow (it really is pretty cool).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • PrettybirdPrettybird Posts: 269
    edited 2009-11-07 16:03
    Very creative. I like the body style. I may borrow it sometime. Recycling at it's best.
  • Spamity CalamitySpamity Calamity Posts: 5
    edited 2010-02-25 00:48
    I really like this as well. I have saved this to my favorites in order to build sometime in the future. Would like to see a video if you ever get the chance.
  • ZootZoot Posts: 2,227
    edited 2010-02-25 22:47
    I'll try. My initial two tests at video don't really show the POV very well.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • HumanoidoHumanoido Posts: 5,770
    edited 2010-02-26 07:04
    Zoot

    photographing POV is an art unto itself.
    To improve success, you can increase the odds of capturing the effect
    by using a longer exposure and a focus centered on where the
    image is formed. Usually cameras have settings to set EV (image
    brightness) and a menu with modes such as "Twilight, High
    Sensitivity, and Program." These settings are ideal for tweaking the
    POV image.

    humanoido
  • MacoreMacore Posts: 41
    edited 2010-02-26 18:32
    Hey what a cool robot, good job. I love seeing stuff like POV put to good use in bots. I have a clock calendar that uses POV for its display and send messages on appropriate days of the year. It uses a single wand of red leds that swipe back and forth. Always loved it cause is seems impossible that it would work. Your skill at building the bot looks really good from the snapshots too. Well done!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Often the joy is not so much in the having, its in the building...
  • mathcatsmathcats Posts: 1
    edited 2010-02-28 01:37
    What oscillators are you using with your circuit?· Thanks
  • ZootZoot Posts: 2,227
    edited 2010-02-28 15:04
    20MHZ resonator for the SX.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
Sign In or Register to comment.