Forum Index > Projects > LED Pegboard and Matrix Projects
 Video Peggy TWI setup notes
 |  Printable Version
By: Anonymous: Ryan W () on Wednesday, November 04 2009 @ 08:19 PM PST (Read 3393 times)  
Anonymous: Ryan W

I just got video working over TWI / I2C on my Peggy 2.2 w/ATMega328. My Arduino is a Duemilanove, also with ATMega328.

I programmed both the peggy and the Arduino through the Arduino software, and after running into a hitch here and there, I thought it might be nice for others to have a simpler explanation all in one place. I also had to make a minor code modification to both the Arduino and the Peggy programs to get it working properly (commenting out a line, see 5 below).

1. Check out the EMSL Video Peggy Article and Jay Clegg's original "Video Peggy using TWI" page.

2. Download the Arduino and Peggy Programs. There are links to everything you need on the above two pages.
- 'Serial2TWIPeggy.pde' is the Arduino Program. It's available in the zip file at the bottom of Jay Clegg's project page.
- 'Peggy2Recv_TWI.pde' is the Peggy Program. Jay Clegg's zip file does include instructions for creating this program, but EMSL has the pde file ready for download at the bottom of the article.

3. Download the 'Processing' software and the Peggy conversion sketch. This will read in from your webcam, convert to 25x25 resolution, and send to the Arduino over Serial. These two files are linked from the EMSL article.

4. Solder up three leads to your Peggy for the I2C connection: to ground, to SDA, and to SCL. These leads will plug into the Arduino's Ground, Analog 4, and Analog 5 pins, respectively. However, I found that SDA and SCL should NOT be plugged into the arduino until the programs were uploaded to both boards.

5. Modify the programs:
- You need to point the Processing sketch 'MirrorPeggy.pde' to your Arduino's serial port. Open up the file in Processing and change this line of code to reflect the correct port:

PHP Formatted Code

void setup() {
    peggyPort = new Serial(this, "/dev/cu.usbserial-A7006Tgp", 115200);    // CHANGE_HERE
 



- I got some errors trying to compile both the Arduino and Peggy programs due to this line of code:

PHP Formatted Code

  PORTC |=  (1<<PC5) | (1<<PC4); // enable pullups
 


The error prevented Arduino from compiling. I commented out the line, and after that everything was peachy.

6. Load up the programs: 'Peggy2Recv_TWI.pde' goes to the Peggy, and 'Serial2TWIPeggy.pde' goes to the Arduino.

7. Plug in SDA and SCL to Arduino's Analog 4 and Analog 5.

8. Run 'PeggyMirror.pde' in Processing. If all goes well, you're now playing video from your Webcam to the Peggy! I had to reset my PRAM when my MBP decided it didn't want to use it's iSight, but I believe that's an unrelated Mac software issue.


Can anyone out there enlighten me as to what the "PORTC |= ..." code is supposed to be doing, and why I needed to comment it out?





       
   
By: llltonic (offline) on Wednesday, November 04 2009 @ 08:28 PM PST  
llltonic

I'd like to add: for someone with no PCB experience, my Peggy assembled very easily and has worked flawlessly since I added the jumper wire across L2 per Windell's instruction update.


Forum Apprentice
Apprentice

Status: offline

Registered: 11/04/09
Posts: 1

Profile Email    
   
By: Windell (offline) on Wednesday, November 04 2009 @ 09:17 PM PST  
Windell

>PORTC |= (1<<PC5) | (1<<PC4);

The "PB" and "PC" abbreviations changed in the underlying code for the ATmega168 versus ATMega328P, quite unnecessarily. Probably will work fine if you replace this with: PORTC |= (1<<5) | (1<<4);


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: xDGx (offline) on Thursday, January 14 2010 @ 05:32 PM PST  
xDGx

* Some hints for windows users:

'Original' code:

peggyPort = new Serial(this, "/dev/cu.usbserial-FTE0T5YQ", 115200); // CHANGE_HERE

Should be something like this:

peggyPort = new Serial(this, "COM5", 115200); // CHANGE_HERE


* WinVDIG can be found here:
http://www.eden.net.nz/7/20071008/

* I had an issue to make the camera work ( Problem connecting Video Output to Video Renderer ), this is where I found the answer (deleting some files and downgrading WinVDIG):
http://processing.org/discourse/yabb2/YaBB.pl?num=1159144149/0

Hope this is useful.


Forum Scientist
Scientist

Status: offline

Registered: 08/18/09
Posts: 39

Profile Email    
   



 All times are PDT. The time is now 12:02 AM.
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?