|
|||||||
![]() |
Forum Index > Projects > LED Pegboard and Matrix Projects | ||
Real time serial communication with Peggy 2? |
|||
| | | Printable Version |
|
Anonymous: voxel | ||||||||
|
Hello, |
|
||||||||
|
|||||||||
|
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? |
|
||||||||
|
|||||||||
|
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. 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/ |
![]() Evil Scientist ![]() Status: offline
Registered: 06/15/06 |
||||||||
|
|||||||||
|
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
![]() 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?
|
|
||||||||
|
|||||||||
|
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/ |
![]() Evil Scientist ![]() Status: offline
Registered: 06/15/06 |
||||||||
|
|||||||||
|
Anonymous: yincrash | ||||||||
|
I'm also interested in putting in the serial ttl port. |
|
||||||||
|
|||||||||
|
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? Windell H. Oskay drwho(at)evilmadscientist.com http://www.evilmadscientist.com/ |
![]() Evil Scientist ![]() Status: offline
Registered: 06/15/06 |
||||||||
|
|||||||||
|
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.
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.
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.
|
|
||||||||
|
|||||||||
|
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??) |
|
||||||||
|
|||||||||
|
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/ |
![]() Evil Scientist ![]() Status: offline
Registered: 06/15/06 |
||||||||
|
|||||||||
|
Windell | ||||||||
|
Okay, my turn to do a multi-post post. 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?Okay... The ATMega168 on board *already* has a hardware serial port. When you hook up the USB-TTL cable, you are using this for input. However, we are reusing those two pins as part of the set of output pins that controls the LED matrix. So those two pins cannot be (normally) be used for serial communication at the same time that we're driving the LED array. (If and when there is a new version of the Peggy, this would be one of the things that I'd change. That could still be quite a while off.) You *could* rewire the lines that go to the two demultiplexer chips to work around this (and make corresponding software changes) but I suspect that this is not a very practical workaround for most people. So, the software serial works okay for low data rate communication (not 30 FPS, I'm thinking!), and TWI might work okay for faster communication. It's also possible that the SPI could be used as an input, but I'm not quite sure if or how that would work. Would that require that FTDI chip that is present on the Arduino?We are using the FTDI USB-TTL cable, which has the chip built in. This is an alternative to building in a chip on the board that lets you reuse the cable (and chip) in other places. On a side note, I can't seem to find a registration for the forums anywhere??Left-hand column, where it says "User Functions." 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? Yes, we've thought of that as well. The Modern Device 8x8 uses through hole from both sides in their display and... we would rather not play that exact game. We could also add a piggyback board, but it adds more cost than you might think. (And it has the usual "mod problem": adds significant cost but does not add significant value for most users.)
The other thing is this: I assert that nobody needs Peggy to tile better. 625 LEDs is already a lot to solder. (I *do* speak from experience!) Do you really want to solder two sets of 625 LEDs and put them side by side? If so, great! Peggy 2.0 tiles left-right just fine. But you want to do FOUR sets of 625 LEDs and put them edge by edge? Okay, you can trim off the top edges and do that too. You want to do SIX panels, you crazy person? Go right ahead: 2x3 is fine, trim 6 top edges and use the side by sides. So, we don't even run into a problem until you want to scale up to a 3x3 matrix-- 5625 LEDs to solder and several thousand dollars invested. At this point, controlling that mega matrix gets to be a little bit challenging, and you can probably find some lower alternatives where the assembly time does not become quite so infinite.
On the other hand, we do have a few ideas for possible future projects that *might* make more sense to tile... but that's still a ways off. Windell H. Oskay drwho(at)evilmadscientist.com http://www.evilmadscientist.com/ |
![]() Evil Scientist ![]() Status: offline
Registered: 06/15/06 |
||||||||
|
|||||||||
|
voxel | ||||||||
Yes, we've thought of that as well. The Modern Device 8x8 uses through hole from both sides in their display
We are using the FTDI USB-TTL cable, which has the chip built in. This is an alternative to building in a chip on the board that lets you reuse the cable (and chip) in other places.
|
![]() Apprentice Status: offline
Registered: 05/28/08 |
||||||||
|
|||||||||
|
Windell | ||||||||
So armed with this cable, some rewiring and software changes I could add full hardware serial to the ATMega168 on the Peggy2... Right? Basically yes. (But note that we already support full hardware serial via USB with that cable and no other changes (for programming)-- we just don't support doing that at the same time as driving the LED matrix. As far as I'm concerned, this mod is borderline for too much work for the return. I think the hardware serial would be best because I'm considering putting two side-by-side and having them animate with real-time serial input from a PC. I disagree. Using the I2C (aka "TWI" or "wire" Also, what are the specifications of the 'Optional AC Adapter' ? What might be a good single-power-adapter solution if I wanted to use two Peggy2's beside eachother?4.5 or 5 V regulated, with 600 mA+ capacity. You could split a single 5 V 1 A power supply between two. Windell H. Oskay drwho(at)evilmadscientist.com http://www.evilmadscientist.com/ |
![]() Evil Scientist ![]() Status: offline
Registered: 06/15/06 |
||||||||
|
|||||||||
|
voxel | ||||||||
note that we already support full hardware serial via USB with that cable and no other changes (for programming)-- we just don't support doing that at the same time as driving the LED matrix.
Using the I2C (aka "TWI" or "wire" interface is a better idea because they can be both addressed on the same bus
|
![]() Apprentice Status: offline
Registered: 05/28/08 |
||||||||
|
|||||||||
|
Windell | ||||||||
What exactly do you mean by 'at the same time' ? Would it be possible to use the already-present hardware serial via USB for both programming and serial communication as is the case on the Arduino? (everything over same cable)The basic idea is this: You hook up the USB-TTL cable and program the Peggy with the Arduino software. When the upload completes, the Peggy runs the program, for as long as you leave it powered on. You don't have to unplug the USB-TTL cable, it just works. When you want to change the program, you just upload a new one. (Unplug the USB-TTL cable when you feel like it.) Now, what does Peggy do when it runs a program? There are a lot of different things that it could do. One is to configure its PORTD pins to use the serial port and talk to another computer. Another is that it could configure the PORTD pins to drive the LED matrix. You get to choose. It can do one after another-- it could periodically pause the LED display-- potentially for a very short time-- and retrieve new data to display. The only time that you run into conflict is if you need to run the display at the same moment as using the *hardware* serial port. Again, I2C may be the way to go. Ah yes, that would be much better. Like I said, I'm not very familiar with I2C, but that sounds like it would work nicely. How would I go about implementing an I2C connection from my PC to the Peggy? Would I be able to do it using the TTL USB cable?You could still use the USB-TTL cable to do the programming, but you would need to generate the I2C signal from another source. Here are some ways to do it. Using a USB-equipped Arduino (or a BBB with the USB-TTL) may be one of the best USB-I2C adapters available, with the right program added, of course. Windell H. Oskay drwho(at)evilmadscientist.com http://www.evilmadscientist.com/ |
![]() Evil Scientist ![]() Status: offline
Registered: 06/15/06 |
||||||||
|
|||||||||
|
|
| All times are PDT. The time is now 07:48 AM. |
|
|
Octolively
Interactive LED kits
Meggy Jr RGB
LED matrix game
development kit.
Business-card sized
AVR target boards
Peggy 2
LED Pegboard kits