Forum Index > Projects > LED Pegboard and Matrix Projects
 Real time serial communication with Peggy 2?
 |  Printable Version
By: Anonymous: voxel () on Monday, May 26 2008 @ 03:08 PM PDT (Read 15255 times)  
Anonymous: voxel

Hello,
First off I'd like to say great work on the Peggy 1 & 2! I've been experimenting with the MAX7219 and an Arduino and have been looking at somehow designing a modular panel design similar to the Peggy with limited success as I am mostly a beginner in the hardware end of things. The Peggy has some really cool features and I'm seriously considering buying a couple! I had a few questions though...

Firstly, with the Arduino I have been able to implement a real-time serial communication with a MAX7219 and a 8x8 LED matrix to interact with mouse movement, audio levels, etc. What are the limitations, if any, on the animation capabilities of the Peggy2? Seeing as though the Peggy2 is running the same ATMega168, would it be possible to set up a serial connection to perform real-time animation?

Also, does the Peggy 2 feature per-LED brightness?

Thanks in advance!





       
   
By: Anonymous: voxel () on Monday, May 26 2008 @ 03:10 PM PDT  
Anonymous: voxel

One other thing I forgot to ask also is would it be possible to trim the top edge of the board to place multiple Peggy 2's side-by-side as well as top-to-top?





       
   
By: Windell (offline) on Monday, May 26 2008 @ 07:12 PM PDT  
Windell

with the Arduino I have been able to implement a real-time serial communication with a MAX7219 and a 8x8 LED matrix to interact with mouse movement, audio levels, etc. What are the limitations, if any, on the animation capabilities of the Peggy2? Seeing as though the Peggy2 is running the same ATMega168, would it be possible to set up a serial connection to perform real-time animation?

One of the things that you should keep in mind is that 25x25 is a lot bigger than 8x8-- almost ten times as many LEDs. The primarly limitation is on available RAM. Only a few frame buffers will fit in RAM at a time-- we haven't really explored enough yet to give hard numbers on that. (We can probably be much more efficient.) You can also leverage the available flash space to store a number of frames of animation and quickly switch between them.

As far as streaming data over the serial port, I have done most of that already as a proof of principle-- if you actually had some determination to get it done, I'm sure that you wouldn't have any trouble. What you need to do is add a software serial port (i.e., a six pin header plus four little wires) in the prototyping area, and download a software serial library (AF_SoftSerial library from http://www.ladyada.net/make/eshield/download.html ). Then, you can use a USB-TTL cable to communicate with the Peggy2 in "real time," which actually can take a few seconds for a large amount of data. This is reasonably straightforward-- I was already able to take my picture on a webcam (in Processing) and display that to the Peggy.

You can actually see my "hacked in" extra serial port in the lower-left corner of this picture:
http://www.flickr.com/photos/oskay/2472727681/in/pool-evilmadscientist/

Also, does the Peggy 2 feature per-LED brightness?

You can use multiple frame buffers buffers (as we have in our example code) to either create sequential frames or to display multiple levels of grey by refreshing them quickly. We think that 8 levels of grey works pretty well with a decent refresh rate.

One other thing I forgot to ask also is would it be possible to trim the top edge of the board to place multiple Peggy 2's side-by-side as well as top-to-top?

Yes, you can do it on your own, if you are careful. There are no traces on the top past the reach of the LEDs-- just "empty" border with holes to mount and/or hang the display.


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

Forum Evil Scientist
Evil Scientist

Status: offline

Registered: 06/15/06
Posts: 1932
Sunnyvale, CA

Profile Email Website  
   
By: Anonymous: voxel () on Tuesday, May 27 2008 @ 05:11 PM PDT  
Anonymous: voxel

Thanks for the quick reply Windell!

One of the things that you should keep in mind is that 25x25 is a lot bigger than 8x8-- almost ten times as many LEDs. The primarly limitation is on available RAM. Only a few frame buffers will fit in RAM at a time


Yeah, I would have to send approximately 100 bytes / frame (plus a few bytes of overhead info) and to get ~30fps, a baud rate of about 28800bps (or higher) would have to be maintained. I know the hardware serial hardware of the Arduino can handle this baud rate, and it looks like the AF_SoftSerial library can handle up to 57600bps, but would that be too much overhead for the processor?

Would it be at all beneficial to somehow "hack in" the Arduino as the main CPU? Or would it be easier/less hassle to set up an extra serial port to use for software serial?

One other thing I forgot to ask also is would it be possible to trim the top edge of the board to place multiple Peggy 2's side-by-side as well as top-to-top?


Yes, you can do it on your own, if you are careful. There are no traces on the top past the reach of the LEDs-- just "empty" border with holes to mount and/or hang the display.


Is there room (would it be safe) to drill small mounting holes between the LED sockets? (I'll most likely be using 5mm LEDs)

Thanks!





       
   
By: Windell (offline) on Tuesday, May 27 2008 @ 05:22 PM PDT  
Windell

...but would that be too much overhead for the processor?

I really don't know. The software serial does have significant overhead that steals time away from the display. If you need that kind of data rate, there are probably better ways to do this. Feeding the data one byte at a time via TWI from a separate Arduino is probably a good solution, for example. Then again, the Peggy itself could be modded to free up the hardware serial port, which would also be fast enough without overhead.

Would it be at all beneficial to somehow "hack in" the Arduino as the main CPU?

This doesn't make much sense to me-- the CPU on the peggy is already the same as that on an Arduino; there will be challenges and no benefits.

Is there room (would it be safe) to drill small mounting holes between the LED sockets? (I'll most likely be using 5mm LEDs)

Nope. Can't do that. But you *can* mount the LEDs exactly between the holes instead of on the grid; see the instructions for how to do that.


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

Forum Evil Scientist
Evil Scientist

Status: offline

Registered: 06/15/06
Posts: 1932
Sunnyvale, CA

Profile Email Website  
   
By: Anonymous: yincrash () on Tuesday, May 27 2008 @ 08:49 PM PDT  
Anonymous: yincrash

I'm also interested in putting in the serial ttl port.

Looking at the flickr photo, you ground the top pin and the bottom pin (let's call them 1 and 6) then just hook pin 4 to PB4 and pin 5 to PB2.

In the AFSoftSerial library, you just tell it to use those pins as RX and TX respectively?





       
   
By: Windell (offline) on Tuesday, May 27 2008 @ 09:49 PM PDT  
Windell

Looking at the flickr photo, you ground the top pin and the bottom pin (let's call them 1 and 6) then just hook pin 4 to PB4 and pin 5 to PB2.

In the AFSoftSerial library, you just tell it to use those pins as RX and TX respectively?


Let's hear it for high-res photos! The command to use is this:

AFSoftSerial mySerial = AFSoftSerial(12, 10); //Rx pin (PB4), TX pin (PB2)


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

Forum Evil Scientist
Evil Scientist

Status: offline

Registered: 06/15/06
Posts: 1932
Sunnyvale, CA

Profile Email Website  
   
By: Anonymous: voxel () on Wednesday, May 28 2008 @ 05:56 AM PDT  
Anonymous: voxel

Nope. Can't do that. But you *can* mount the LEDs exactly between the holes instead of on the grid; see the instructions for how to do that.


I realized my original question was a little ambiguous. Just in case, I was asking about drilling small mounting holes between the LED sockets to be able to put screws through for mounting (if I removed the top portion to allow top-to-top (as well as side-by-side) placement of the Peggy panels.

Feeding the data one byte at a time via TWI from a separate Arduino is probably a good solution, for example. Then again, the Peggy itself could be modded to free up the hardware serial port, which would also be fast enough without overhead.


I'm not familiar with TWI (or I2C, which wikipedia says TWI is a derivative of) but I assume it would be similar to a 3-wire connection (which is what I've been using to experiment with my little MAX7219 setup). But I'll have to look into it if I decide to go that route.

This doesn't make much sense to me-- the CPU on the peggy is already the same as that on an Arduino; there will be challenges and no benefits.


I guess the 'benefit' that I was thinking of was having the hardware serial on the Arduino there to use. But if its not too complicated to add hardware serial to the ATMega168 on the Peggy (as mentioned above), then that would be a nice solution. Would that require that FTDI chip that is present on the Arduino?

I'm still pretty new to the 'hardware hacking' scene... But I'm very interested in learning and grateful for the help!
- John





       
   
By: Anonymous: voxel () on Wednesday, May 28 2008 @ 06:14 AM PDT  
Anonymous: voxel

Oh and I meant to mention an idea I had... (On a side note, I can't seem to find a registration for the forums anywhere??)
Probably too difficult/risky to do with Peggy 1 or 2, but possibly a v3 release or something. To make the display truly modular (for large displays) would it be possible to have the lower circuitry either on the back of the board (I realize this might get really cramped.. if not impossible) or maybe 'piggy-backing' (no pun intended) as a separate board behind the matrix panel?
Just a thought, as this was the approach I was trying for with my 8x8 LED panels, but in a way you've totally circumvented this by just making the panels 25x25 Smile





       
   
By: Windell (offline) on Wednesday, May 28 2008 @ 08:31 AM PDT  
Windell

I realized my original question was a little ambiguous. Just in case, I was asking about drilling small mounting holes between the LED sockets to be able to put screws through for mounting (if I removed the top portion to allow top-to-top (as well as side-by-side) placement of the Peggy panels.

If it's just a couple of holes, maybe. I'd look at the PCB files to see if there are any clear spaces that you might exploit.

I'm not familiar with TWI (or I2C, which wikipedia says TWI is a derivative of) but I assume it would be similar to a 3-wire connection (which is what I've been using to experiment with my little MAX7219 setup). But I'll have to look into it if I decide to go that route.

Yes, another simple serial protocol; happens to be on pins PC4 & PC5. The Arduino "Wire" library is for using TWI.


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

Forum Evil Scientist
Evil Scientist

Status: offline

Registered: 06/15/06
Posts: 1932
Sunnyvale, CA

Profile Email Website  
   



 All times are PDT. The time is now 01:25 PM.
Normal Topic Normal Topic
Locked Topic Locked Topic
Sticky Topic Sticky Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Able to Post 
Filtered HTML Allowed 
Censored Content 

Evil Mad Scientist Forum Archives — Read only!

Please visit our new forums for new discussions.


DIY Hardware for Electronic Art


The Original Egg-Bot Kit


Octolively
Interactive LED kits


Meggy Jr RGB
LED matrix game
development kit.


Business-card sized
AVR target boards


Peggy 2
LED Pegboard kits

My Account






Lost your password?