Sunday, April 10, 2011

Late night body building - Phase II

I was going to post this last night, but it was 2:30am.  I've built the remainder of the main body in removable segments.  Now what's left is the shell and legs.  Also this afternoon I finished redoing the front caster.  It looks so much better.  Lots of pictures here:


Droid all in pieces (except the lowest level because
I had all the wires run through it)

Speaker placed

Arch with the XBee unit placed

Third level with the dome motor placed




Dome placed

New front caster with shell (no wheel binding this time!)

Side view of the new hotness... I mean caster. :)
 


Saturday, April 9, 2011

Front wheel woes

So after mounting the front caster last night, I thought that it might be a little too far out front, but I decided to go with it.  I spent a couple hours putting the shell around the caster and framing it up, but now it REALLY looks too far out... so I might be dismantling that soon.  I'll wait until after I build him up more before deciding...


Body construction - Phase I

I have begun construction on the body.  I'm taking a triple decked approach, each level will be removable so that I can get to any of the parts.  So far, I have built the lowest level with the chassis and battery packs, mounted the front caster, and started the second level (which is where the arduino, shields, and hopefully the speaker will be held).  The third level will have the dome motor mounted to it.  I'll post more as I build it.




Friday, April 8, 2011

Dome construction

I'm at the point where the software is almost done, and the hardware is just about done as well.  So, in order to do fine tuning, I really need to build the body next.  My daughter was sick today, so I decided to start with the dome (because I required much less workspace for this). 
I'd been concerned until yesterday about how I was going handle this.  But yesterday I had a brainstorm... styrofoam craft balls!  I bought a 5" ball and tried wrapping it with aluminum foil.  This was giving mixed results because of the bumpiness of the ball.  So I decided to make a hemisphere out of posterboard to act as a layer between foil and ball which allowed for much smoother results.
I took another piece of foil and mixed some blue-purple paint to paint the wedges of the dome.  Now I just need to build the main body to decide whether to use the hollow shell by itself or if I can get away with leaving the foam ball in...

Wednesday, April 6, 2011

Sound work continued - Motor shield integration

Be prepared... long post is loooooooooooooooooooooooooong...

Today was scary.  Really scary.  Really REALLY scary.  So scary, that had I screwed something up while doing what I was doing today... I would have had no droid for my final project.  But as Seth Rogan said in the movie Paul, "Sometimes you just gotta roll the dice."  So I rolled.  And after a couple of hours, I breathed a sigh of relief.  My motor shield still works.  My wave shield works.  And most importantly, they work TOGETHER.  Let me share with you what I did today.

First, it had been a while since I loaded up the wave shield, so I brought that out and put the new R2D2 files on it.  Works like a charm.  Next, I needed to be able to access each file directly instead of consecutively, so I grabbed some of the sample code from the library and there it was.  Piece of cake.  Then, I said to myself, "Self... let's stack these things."  So I did.  I stacked the wave shield on top of my motor shield (which is on top of my arduino), and I copied in just the part of the setup code that would read the available files on the SD card (for now). 

As expected (because I've been lucky with a bunch of things on the project so far, so I figured that I would run out about now) the files could not be read.  I was prepared for this, thanks to Mike's truth table he sent earlier this semester.  So I went to work un-soldering 4 of the 5 jumpers from pins 2-5.  While I was at it, I decided to add some headers so I could test back and forth until I got the right combination right.  The prototyping jumpers are a little less permanent, but that will be ok for the final project.  After I put the headers in, I put the jumpers in the way they were first to test out the shield (by itself again).  Success.  Now came the first hard part... figuring out how to modify which pins the wave shield is looking to use for the DAC control. 

Luckily, there wasn't much code in the WaveHC library to go through, so in the WavePinDefs.h file, I found four sets of declarations like this (this is what my code looks like now, I put the original lines in comments at the end):

     // use arduino pins 2, 3, 4, 5 for DAC                             
     // pin 2 is DAC chip select                                        
     /** Data direction register for DAC chip select. */                
     #define MCP_DAC_CS_DDR PIN19_DDRREG // originally PIN2_DDRREG      
     /** Port register for DAC chip select. */                          
     #define MCP_DAC_CS_PORT PIN19_PORTREG // originally PIN2_PORTREG   
     /** Port bit number for DAC chip select. */                        
     #define MCP_DAC_CS_BIT PIN19_BITNUM // originally PIN2_BITNUM      

So I followed the definitions of PINx_DDRREG back to ArduinoPins.h, and saw a bunch more definitions, I believe the were some 70 pin definitions for each grouping (probably for Mega support).  So I said "let's give it a whirl and reset these definitions to the analog pins (referenced as digital pins 14-19)."  So I did that and put the jumper wires in the proper places.  Success, my wave shield was now running off the digital pins 16-19, leaving pins 2-5 available for the motor shield.  So I tried the two shields together again.  Fail.  What NOW?

I went back to the truth table (thanks again Mike!) and there were still some pin interactions that I needed to resolve.  But now I had no idea how, because the motor shield PCB is made in this way... I didn't add jumper wires like the wave shield.  So I did a search for wave and motor shield and came across this forum thread (http://www.adafruit.com/forums/viewtopic.php?f=31&t=8066#p63795).  I took a double take.  Cut the what?  Traces?  Never done that before... let's google it! (http://www.diystompboxes.com/smfforum/index.php?topic=81879.0;prev_next=next)  So at this juncture, I was floored.  Take my perfectly fine working on its own motor shield, solder some new wires and TAKE AN X-ACTO KNIFE TO THE BOARD??  ARE YOU NUTS??  I looked again, and there really was no other way around it... the SD card needs pins 11, 12, and 13 (from its documentation), so if I want these two to work together, gonna have to get in there.  This is where the dice rolling came in.  Soldering mistakes I can fix, but scraping out the traces is kinda permanent.  I highly doubted that I could've ordered a new motor shield in time, but I pretty much had no other option.  I followed the instructions by poster 'jonharrell' and soldered in new wires and scraped out the traces for the other two pins.  His pictures were life-saving with this.  I am (hopefully only) sacrificing servo capabilities to have 4 DC motors and wave shield functionality.

Well, lady luck was once again with me after all and I succeeded.  Now I have control of at least the two drive motors (haven't rigged up the third yet to test) and I can trigger a sound to be played with any of the controller buttons.  ::phew::  Now the only concern I have is whether the sounds will still be audible from inside the droid's body as well as heard over the motors (even on the other side of the shield where I could specify a higher frequency, the motors were still loud), but that's completely out of my hands unless I find a much louder speaker...

But that'll have to wait until everything else is finished if I have some time left.



Tuesday, April 5, 2011

Starting sound work

So I thought I'd take a short break from working the motor part of my project and do a little bit with the sound.  I got 161 R2D2 sound bytes from my older brother today, so I wanted to make sure that the speaker I had would work.  I cut the plug off an old pair of headphones and soldered some wires to it. 

Fortunately, the wiki page description of which parts were which was accurate and now the speaker works with my wave shield.  I've selected 16 sound bytes for the SD card (because I'm going to use combinations of the 4 top buttons to index these).

Next step is to make sure the wave shield works on top of the motor shield...


Wirelessly remote controlled Droid demo

Here we go, the long awaited demo of my droid!  I have some tuning to do with the controls of the motors (such as how much power to give to which wheels if the stick is full forward but partially turning left).  But after that, the dome will be easy (it's just one value, forward or backward) and the sounds will be controlled by digital button signals.  After that, it'll finally be time to begin work on the shell for the final showcase.  Enjoy!

(The file was too large, at 250MB, and I ran out of time this morning and didn't have time to compress it... I'll try to do that later this evening and will update this post with the smaller video... please stand by :-) )

And here it is!!