The Peggy Strikes Back

Automatically generated Peggy Code

Today we have an update on our Peggy 2.0 Light Emitting Pegboard project, with (1) a new and improved version of the Peggy2 Arduino library, (2) links to several awesome examples of Peggy hacks– including a full-motion video hack, and (3) a new GUI application example that lets you display an image on the Peggy without writing a single line of code.

Let’s start with the hacks!


  1. Art Dahm has written a digital clock application, an animated “Invader” sign, and an interrupt-driven Arduino display library for Peggy 2.0, all with posted code. These are definitely worth a look! [LINK]
  2. Geoff Harrison has turned Peggy into an animated analog clock, that keeps time even when the power is off. And, Honest Abe shows up in Peggy form too. Nice! [LINK]
  3. Aubilenon, zsazs, and leviathan wrote a neat demo called “Ledtro” on their Peggy– Whoa! (Updated: New link with code posted!) [LINK]
  4. Taking this to the next level, Julien Gachadoat and Michaël Zancan of 2Roqs sent in this awesome video of animations on their Peggy. They were also kind enough to let us incorporate some of their code into the new version of the Peggy2 Arduino Library. The 3d rotating wireframe cube in the video is one of our new code examples! [LINK]
  5. And, taking the cake, Jay Clegg hacked a hardware serial port onto his Peggy, mashed it up with Quartz Composer (!) and managed to get scrolling text and is the first person to get real-time live-motion grayscale video running on his Peggy– direct from a webcam(!!). He’s posted a complete how-to, including videos– go take a look: [LINK]

And now the Arduino Library update:

Today we’re releasing a new version (0.30b) of the Peggy2 Arduino library, which now includes 12 example sketches. The biggest change from the last version of the library is that we have incorporated a line drawing routine contributed by Julien Gachadoat and Michaël Zancan. This lets you draw a line on the Peggy by using commands of the form Line(x1,y1,x2,y2), or by commands like MoveTo(x,y) and LineTo(x,y). We’ve also included example code for the new functions, including (as we mentioned) a version of the 3d rotating wireframe cube that’s in his video.

You can download the latest version of the Peggy2 Arduino Libary on this page, and the gory details about what the functions are and how to use them are spelled out here. This is an open source project. Your code contributions, hacks, and suggestions are welcome indeed.


Lastly, we have a new GUI application example to show off.

One of the outstanding issues with microprocessor-based systems like the Arduino and the Peggy 2 (which shares the same AVR-based architecture) is that they require at least a little bit of programming to do much of anything. While the programming for these systems is about as easy as it gets (for C-like systems) it’s still quite a barrier for some people to get past. For example, to turn on a specific set of LEDs on the Peggy 2.0, you might run an Arduino program that has a bunch of commands like this:

frame1.SetPoint(5,8);


frame1.SetPoint(14,8);


frame1.SetPoint(10,10);

which would turn on the LEDs at (x,y) locations of (5,8), (14,8), and (10,10), assuming that you set up the program correctly– don’t forget your semicolons, initialize the frame buffer, clear the screen when you are supposed to and refresh the display. To those of us who program things, that’s nothing out of the ordinary or remotely intimidating. However, for everyone else, it’s almost too much to ask.

We would like to reduce the barriers to entry so that more people can enjoy playing with microcontrollers and LEDs, so here’s another approach. We have written a graphical application in the Processing environment that generates a complete Arduino sketch as its output. The program is called PeggyDraw, and the output is a complete Arduino program that you can use to put a simple picture on the Peggy 2. You can download PeggyDraw.zip from the Peggy page on Google Code.

PeggyDraw

To use PeggyDraw, you’ll need both the Processing.org and Arduino software packages installed. These are free cross-platform development environments. (I have Processing 0135 and Arduino version 11.) When you open PeggyDraw from within Processing and run it, you’ll see a window like this one. It looks like the Peggy display, and you can click to draw or erase the dots on the screen. (This is a bit like the Peggy Planner except that it’s oriented towards figuring out which LEDs you want to light up, rather than where you want to put which LEDs of different colors.)

PeggyDraw has only one other I/O method– a button marked “Save.” When you click it, it generates a subdirectory called “PeggyProgram” within the directory where PeggyDraw is located. Inside this folder is the PeggyProgram.pde file, which you can open from within the Arduino environment and directly install onto your Peggy.

Automatically generated Peggy Code

Doing this, you can program an image onto Peggy– like so– without ever touching code.

As implemented thus far, it’s a very simplistic program. However, we think that simple programs like this one that automatically generate useable Arduino code may be an interesting approach to further reducing the barriers to entry– And it certainly leaves plenty of room for improvement!

Update: We’ve released PeggyDraw 2!

EmailFacebookTwitterGoogle+tumblrPinterestRedditStumbleUpon

5 thoughts on “The Peggy Strikes Back

  1. Oops, I didn’t get around to putting the source up (or sending it to you guys) until now.

    Here it is. The Peggy in that youtube video is running at 20mhz instead of the standard 16.

  2. Wow, this is all great, great stuff.

    I have three questions, though:

    1. Are there any less-invasive options for receiving a feed of external data than the whole ‘daughter board’ method described here?
    2. You mention in the main Peggy article that it could be used as a ’14×14 RGB display, clumping three LED locations to form an RGB pixel’. Are there any implementations of this in the wild yet?
    3. I noticed this page that mentions using an array of LEDs as a multitouch sensor. Could this work with the Peggy hardware? If it could, I’d like to either create a standalone ‘shadow recorder’ where you could make hand or other object shapes over the LEDs and then have it hold that pattern until reset, or to feed the data out to another application – effectively using the Peggy as an input instead of output device.
    • >Are there any less-invasive options for receiving a feed of external data than the whole ‘daughter board’ method described here?

      Yes. You can add a "software" serial port as we’ve described elsewhere. It’s suitable for sending data but not fast enough for real-time video. Also, you can probably do the same thing through the I2C (TWI) interface– I haven’t tried this yet; I don’t know if it’s fast enough for real-time video.

      >You mention in the main Peggy article that it could be used as a ’14×14 RGB display, clumping three LED locations to form an RGB pixel’. Are there any implementations of this in the wild yet?

      I have not seen anyone do it yet. Most people seem to be interested in just the grayscale right now. (I wish someone would– it would be pretty damned awesome.)

      >I noticed this page that mentions using an array of LEDs as a multitouch sensor. Could this work with the Peggy hardware?

      Not really, no. If a few LEDs are connected directly to microcontroller pins, that can work, but we’re already stretching our pins thin to drive so many LEDs at once through a bunch of driver chips. Think of it this way: You can drive LEDs easily. You can also, if you work at it, drive a lot more LEDs than there are pins OR you can use the LEDs as sensors as well. We are considering a future version of our interactive panels that add a *few* sensors to a peggy-like display. We will probably not go towards an array of 625 sensors.


      Windell H. Oskay
      drwho(at)evilmadscientist.com
      http://www.evilmadscientist.com/

  3. OH NO! 1/0 is the first term of a non-convergent series! You really are evil mad scientists here!

Comments are closed.