Introduction: Spark-e - a Spark Core + Touch OSC Controlled Wall-e Toy Robot Conversion
When it comes to cute robots, the instructables robot being at the top of the list obviously, the second most famous has got to be Pixar's Wall-e. Who wouldn't want one of these little fellas scurrying around your home cleaning up your garbage for you? Well, whilst the real thing might not be available just yet, why not create your own by upgrading a readily available child's toy into a fully remote controllable, programmable, walking, talking robot?
Things you'll need:
- Wall-e toy
- Spark Core
- Adafruit FX Board (With inbuilt amp)
- 2 x Continuous rotation servos
- 1 x Standard servo
- 1 x Micro servo
- 2 x Ultra micro servos
- 2 x LED's (or reuse from the wall-e toy)
- 1 x 2N3904 NPN Transistor
- 3 x 1k resistors
- 3 x AA batteries + Holder
- 1 x 3.7v LiPo battery (500mAh+)
- Jumper cables
- Male header strips
- Female header strips
- Jumper crimps (male and female) + housings
- TouchOSC App
- Some ingenuity
- Screwdriver set
- Hotglue + gun
- JB Weld
- Crimp tool
- Perfboard trace cutter tool
- Craft knife
- Wire cutters
Disclaimer: This build has literally been years in the making (on and off) and as such is more of a retrospective of "what I did", rather than a from beginning to end "follow along with me" type of instructable. Hopefully though it will be enough to guide you and help you to avoid some pitfalls, but with a little ingenuity, you should be able to build your own little Spark-e too.
Step 1: Prepare Wall-e
Pickup a Wall-e toy
The first thing you'll need then is a Wall-e toy. You can pick these up in many places and you'll find them on ebay all the time. There are a few models though so it's worth checking which is which. Search for "interactive wall-e" and you'll want one of the 7" ones which come in two flavours. I find the ones that have the flip down front revealing a trash sticker and WITHOUT a black IR square on the top work best, but either will do (just make sure it's not one of the smaller MP3 ones, or the one with the retractable tracks, these won't work at all).
Open him up
Once you have your Wall-e get your screwdriver set and open him up. The body is in 4 main parts. A top (which the arms are attached to), a bottom, the main body and a back, battery compartment. Unscrew the 4 screws on the underside of the toy, aswell as the two screws either side attaching the tracks to the side of the body. Next we'll need to remove the battery compartment. Unfortunately this is attached by some weird triangular screws. I got round this by grinding an old IKEA alan key into the right shape but if you have the right type of screwdriver, feel free to use that :)
With the battery compartment removed, pull away the bottom from the main body (the tracks should come away with the bottom part along with the guts of the Wall-e. Take it steady and make sure you don't break any of the body as you pries him apart.
Strip the internals
Using the screwdriver remove all the internals of your Wall-e and put to one side (we'll reuse some of the bits later). Using a Dremel tool, cut away any excesive poking in bits of plastic on the inside of the base. The only things you'll really need are the main 4 screw fixtures, but just take things steady and remove as you go if you feel more comfortable. Once it's removed, you can't add it back, so check, check and check again that you don't need something before you remove it. You can also cut away the back of the battery compartment too. I was hoping to reuse it the power box for our robot, but it hits one of our servos later on so now I house the batteries in the front of the toy so you can safely cut away as much as possible. You may also want to cut away the plastic behind the flip down front as it can be a handy way to access a power switch later on.
The key thing here is that we have very little space, so the more we can save the better.
Remove the wheel axel
Lastly, you'll want to remove the tracks from their axel. There is no easy way to do this, it's basically down to brute force. Pull and wiggle until the tracks come away as one unit, being careful not to break anything.
Step 2: Create the Power Strip
Create the strip
We're going to have quite a few things we need to connect up inside our Wall-e so to help, we'll create a power strip to distribute the battery power and provide a central point for all our servo data pin connections. Given servos create a lot of electronic noise in our circuit, we are actually going to need to connect 2 batteries. 1 for the servos, and 1 for the Spark core and FX board, but we will also use this power strip as a means to share the grounds.
Using some perfboard, knock up a circuit as per the fritzing diagram (you only need one, I've just shown it with and without the solder connections for reference). On mine, I also added some capacitors to try and limit the noise in the circuit (a 1000uF one across the power inputs, and 0.1uF ones on the servos +/- terminals) but they didn't seem to do much so feel free to leave them off.
Prepare the batteries
To power the servos we are doing to use 3 x AA batteries. You'll need a plastic holder that holds the batteries in a row. Connect wires to the positive and negative terminals of the holder and attach jumper headers to allow us to connect it to the power strip later.
To power the Spark core and FX board we will use a 3.7v LiPo battery. These work great as they are usually pretty thin and can be recharged (unfortunately the servos are a bit too power hungry to allow us to power them via a LiPo battery too). To make connecting the LiPo battery easier, I cut off the JST connector and swapped it for some jumper headers. After this, just set it charging and we'll install everything later.
Once you've go this setup, put it all aside for the time being and move on to the next step.
Step 3: Install the Track Servos
Attach the servos
Line up the 2 continuous rotation servos base to base with the main servo gears opposite each other (tape them together if it helps) then with the base plate upside down (the bottom facing you) hold up the servos against this, lining up the servo gears with where the track axel used to be, and roughly draw around them.
Using a Dremel tool, cut away any protruding plastic elements preventing the servos from sitting flush against the base plate being careful not to cut away the side mounting holes for the tracks.
Once cut away, attach the servos by whatever means suites you (occasionally offer up the tracks to make sure the servo gear lines up with the centre of the rear track wheel we'll be driving). I prefer to make things as replaceable as possible so I used a lot of zip ties and some extra strong double sided sticky tape, but hot gluing them would work just as well.
Once in place, feed the wires through to the other side of the base plate so that they will be inside the main body part when we put Wall-e back together.
Attach the tracks
With the servos in place, attach a servo horn to the servo ends, then offer up the track wheels and measure the distance between the servo horn and the wheel.
Find a suitable material to make a spacer to fill the gap between the servo horn and the wheel (I used an old lego wheel hub), cut it to size (if needed) and then use some JB Weld to glue the wheel + spacer + servo horn assembly together.
Once dry, screw the tracks back on to the base plate fitting the servo horn onto the servos at the same time. If everything was measured / lined up correctly these should all fit perfectly.
Step 4: Install the Arm Servos
Remove the top
On the inside of the main body, if you haven't done so already, unscrew the 4 scews holding the top plate of Wall-e in place. To remove the top plate, hold just above the arm joints, and pull upwards.
Mount the servos
With the top removed, unscrew all the parts holding the arms in place.
Offer up some ultra micro servos, and using a Dremel tool, cut away any plastic preventing the servo gear from lining up with the arm hole (don't remove the screw posts that were used to hold the arm in place though as we will make use of these later), then once perfectly centred, hotglue the servo into place (again, being sure not to block the screw holes).
Repeat the process for the other arm.
Mount the arms
Using your Dremel tool, cut down the arm shoulder joints to a flush surface then JB Weld on an ultra micro servo horn perfectly centred (if you are ambitious, you could drill into the shoulder joint, and glue a cut down horn into the hole to give you a tighter fit).
Once dry, attach to the servo's and move on to the next step.
Step 5: Install the Neck Servo
Remove the head
On the underside of the top plate, unscrew the neck joint (the screw going through the gear) and remove the whole neck/head assembly. Remove the neck / head assembly from the neck joint by unscrewing the screw through the neck joint and pushing out the axle (needs a bit of force). Detach the neck / head assembly and put it to one side for now.
Using the Dremel tool, remove all excess plastic from the under side of the top plate (being careful not to remove the top plate mounting holes, or the arm bracket mounting holes) and create as flat an area around the neck hole as possible. In addition to the cleanup, go ahead and extend the neck hole to be a complete circle, enough for a standard round servo horn to fit through, but not so much that the neck joint fits through.
Create a servo mount
So as to keep the neck joint flush with the top plate, we'll create a bracket to hold the servo slightly away from the surface. Use the attached template to cut out of some thin metal (I used an old camping frying pan) a bracket shape and bend it round your servo, using a zip tie to keep it snug against the servo. Using the mounting holes / screws from the original arm assembly, attach the bracket and bend slightly until the servo is positioned centrally in the top plate opening. If I was doing this now, I'd probably create a 3D printed part, but this was the easiest thing to do at the time.
(NB You may need to cut off the mounding holes on the servo itself as these will likely block the back plate when we try to re-attach it later, so it'll be easier to do this now).
Attach the neck joint
To attach the neck joint, grind the base of the neck joint flush and create a central hole all the way through the base to be able to locate a servo horn screw through (you'll need to counter sink it so it doesn't prevent us mounting the neck back on later). Next, take a standard round servo horn and create a cutout inline with the hole in the neck joint for passing wires through. JB Weld the servo horn onto the base of neck joint. Once dry screw the neck joint to the servo using a standard servo screw and check it rotates freely.
Step 6: Install the Head Servo
Disassemble the neck / head
Unscrew the neck / head assembly, removing the back of the head, from the eyes being careful not to damage the wires running through them, we will need them in a moment (At one point you will need to cut one of the wires that connects the left eye to the right eye, that's ok as we won't be using that particular wire, but be sure to keep the rest safe and as long as possible).
Using force, remove the bar that connects the two sides of the head together being careful not to break the actual head unit. Once done, the head / eyes should be in two halves. If you like, you can open up the eyes and remove the LED eyes for the time being. Lying the eyes upside down on a flat surface, bring them back together and hot glue them fix as one. Set aside and continue to mount the head servo.
Attach the servo
Choose one side of the head to mount the micro servo and using the Dremel tool, cut away all the internals, and a side portion of the head until it fits snugly. Hot glue the servo to the top half of the head piece making sure not to block the mounting area at the front.
Next, attach the lower piece of the head to the back of the eyes using hot glue being careful not to block the other mounting area, or the wire hole, or the holes for the eye screws (this is tricky as one will overlap, I ground it away so that I could still just about access the screw with the head piece glued on).
We won't attach the lower head piece to the upper head piece just yet as we will need to route some wires through it shortly, but we will hot glue these back together later.
Next, take the small plastic piece that inserted into the top of the neck and attached the head to the neck (it had the bar running through it) and grind it into a short stub about 10mm heigh (we want it to fit back into the neck, but we are going to attach a servo horn into it). Cut a slit straight down the middle of the stub going from front to back big enough to fit a micro servo horn arm into and then JB Weld the horn into the stub. Attach the horn to the servo with a screw, and check the stub fits into the top of the neck (don't screw it back together just yet, we still have work to do).
Route the wires
We could just route the wires through the top plate, but that would be too easy, so we'll route them back through the neck (or at least the lower half of the neck). Cut out a small section from the back side edge of the lower neck assembly big enough for your wires to pass through (we'll need to pass through another set in a second so make it big enough for two) and you may want to make the current hole at the bottom of the neck a little bigger too. Offer up the wire and make sure it will pass through the assembly without getting snagged, aswell as checking that it will pass through the neck joint into the main body (you may have to remove the servo connector and re-attach it on the inside, but you should be able to get it to pass through).
With the neck prepped, move on to the next step and we will re-assemble it all on a second.
Step 7: Install the LED Eyes
Our Wall-e already came with some LED eyes, so we will reuse these and give them a blink effect a little later on in code. For now we need to connect them up to power and our MCU so we will tackle this now.
Not knowing the exact spec of the LED's and knowing the spark core is only 3.3v, I decided to wire the LED's directly to the power supply, and use an NPN transistor to do the flicking on and off. This way it puts less demand on the MCU.
Route the eye wires
To start with, we'll route the wires from the right eye, over to the left eye housing (we are going to put a tiny circuit inside there so we need to bring all the wires together). The right eye should have a green, purple and black wire. You should have previously cut the black wire earlier on. The black wire should be wired up to the same pin as the purple wire. As we only need one wire per pin, just remove the black wire completely.
If you've remove the LED housings from the eyes in an earlier step, go ahead and put the right eye LED housing back into place, not forgetting to put the eye lense back first. Route the wire through the hole in the eye back, and fix the eye back back into place. Leaving plenty of length, twist the purple and green LED's together, and pass them through the eye back of the left eye.
Put the left eye into place inside the eye housing. Make sure you have some wire connected to each leg (these only need to be short). If you left enough attached from earlier, you should have one with a black wire, and one with a blue wire.
Create the switching board (See fritzing diagram)
Using a small piece of perfboard, construct the following circuit and attach the wires from the eyes accordingly. If your eye wiring is the same, which it should be, the black and purple wires should be + and the green and blue wires should be -.
Next, cut approx 5 inches of servo wire and pass it through the left eye back (you may need to make an additional hole), soldering one end to the switch board in the appropriate place as per the above schematic.
With the switching board complete, place it in the left eye housing to one side, and close the housing up. You should now have a pear of wires coming from the right eye to left, and 5 inches of servo wire coming out of the left eye.
Route the wires
Similar to routing the head servo wires, run them out of the back of the head assembly, and into the back of the lower neck assembly out the bottom, through the neck joint and into the main body. Once wired through, crimp on some female jumper headers ready to connect at the end.
Step 8: Install the Voice Box Sounds
This is probably the easiest part. Download the Wall-e sounds attached and copy them to your Adafruit FX board (you should be able to just connect a micro-USB cable and copy them over like it is an external drive).
Next, take the speaker that came inside Wall-e and attach it to either output of the FX board.
For now, give it a quick test by connecting the power and shorting the numbered pins to ground to make sure all the sounds play correctly.
Step 9: Install the Spark Core
Cut the hole
To show off the fact our Wall-e is Spark powered, we will mount our Spark core onto the back of our Wall-e.
Offer up the Spark core to the back plate, and roughly mark where we will need to make a cutout for all the pins. Next, use your Dremel tool to cut out those holes.
Create the jumper board
Using some perfboard, cut a piece big enough to fit inside the back of the back plate (make sure the lines run horizontally) and solder on some female headers down the middle cut to length to fit the spark core (12 either side). Break all the traces between this these rows of headers so that we don't short opposite pins together.
Next we want to solder on some male headers on the back side of the board to allow us to attach jumper cables when we wire everything up. These need to be as wide apart as possible so that they will fit down the sides of our neck servo which sits right in the middle of our body. Now, we need to solder these the opposite way to how you normally solder your parts (with the pins poking out on the soldered side), so the best way I found to do this was take the male headers, cut them to length (12 again), and push the plastic retainer all the way to one end of the pins and then feed this through the TOP of the board and make all the solder connections on the back (making sure not to get solder all up the leg so we can still attach our jumper cables). When soldered, remove all the plastic retainer and trim the leds on the top side flush. See the pictures for exactly what we are aiming for here.
Fix the jumper board into place
Using hot glue, or some other strong fixing, fix the jumper board to the back plate, feeding the female headers through the plate. This fixing needs to be strong as you'll usually end up removing / re-attaching your Spark core quite a bit, so this will have a lot of pushing / pulling forces on it, so you don't want it to come detached.
Step 10: Connect Everything Up
Connect all the jumpers
To start wiring everything up, connect all the servos to the power strip making sure to orient them so that the ground wire is on the outside edge. Follow this by attaching the LED eyes to the power rail in the same manor.
Next, connect the servos / LED eyes to the Spark core (via the back plate) by attaching jumper cables from all the data pins to pins on the Spark core. It's important to note that the servos will require PWM so you'll need to make sure these connect to A0, A1, A4, A5, A6, A7, D0, or D1. To keep all the data wires together, I'd suggest connecting them to the AX pins.
Next, connect jumpers from the FX board trigger pins 0 to 7 to the Spark cores D pins 0 to 7.
Connect the power
Now that we have all our data connections, we'll need to connect up the power and common grounds.
First, attach the jumpers from the AA battery holder to the power strips Vcc + Gnd inputs. Next, attach the LiPo batteries positive jumper to the Spark core's Vcc but connect the negative pin to a spare Gnd pin on the power strip, and then run a jumper from a spare Gnd pin on the power strip to the Spark cores Gnd pin (we go via the power strip first to ensure both the servo circuit and the MCU circuit share the same ground connection).
Lastly, connect power to the Fx board by attaching jumpers from the Spark cores 3v3 pin and spare Gnd to the FX boards Vcc and Gnd pins.
Now that we have everything wired up, lets go ahead and get everything put back together.
Step 11: Put Wall-e Back Together Again
Reassemble your Wall-e starting with the head and neck, re attaching it back to the top plate (be careful not to snag any wires while you do this). For the head, given we have removed one set of screw holes to house the head servo, you may need to hot glue this closed, everything else however should just screw back together. Whilst we are attaching stuff to the top plate, go ahead and attach the arms aswell.
I decided not to bother screwing the top plate back onto the body as it gives easy access to the internals, and it fits quite snugly so doesn't come off easily anyway. If you'd prefer him to be completely closed up though, you'll need to do this before you attach the bottom plate, however I'd also suggest installing the batteries now too, as access is about to get really limited :)
Next, move on to re-attaching the bottom plate to the main body, not forgetting to screw the track onto the side walls of the body.
Install the batteries
With the top plate removed, install the batteries through the back of the body, positioning the AA batteries to sit across the front of the body, and the LiPo battery to sit flat across the bottom.
Install all the components
With the batteries in, install the FX board down one side (I slid the speaker underneath the LiPo battery to help hold it down) and the power strip down the other. Try to push them as far forward as possible as we've got a heap of jumper wires we need to get in still.
If your top plate is still dettached, now is the time to attach it. Slowly put it into place, making sure not to snag any wires and to position the neck servo between the FX board and power strip, whilst making sure the AA batteries stay at the front.
With all the components in, connect the back plate by carefully feeding in all the jumpers wires down down either side of the neck servo.
Finally, screw on the back plate (now would be a good time to swap those triangle screws for some normal ones. You should be able to reuse some of the internal screws we removed) and our Wall-e is (almost) ready for programming.
Step 12: Create the TouchOSC Controller
Install the apps
Before we program our Wall-e, we'll want to create a controller to control him. For this we are going to use TouchOSC. TouchOSC is meant more for midi applications, but it uses a simple UDP based protocol called OSC that actually works really well for robotics too.
To create our controller, install the TouchOSC app on your smartphone (it may cost you, but it's worth it for not having to build our own app) and then head to the Hexer website and install the TouchOSC Editor.
Create the controller
To design our controller, we use the TouchOSC Editor to layout our controls and set what values ranges will be sent to our Spark (I use ranges 0 to 100 for the arms, -100 to 100 for the head, neck and tracks, and just 1 or 0 for the push buttons) and then sync it with our smartphone to make it available to us.
To make things easy, you can download my controller file below. Follow the TouchOSC help for how to transfer your controller to your smartphone.
Once you have your controller defined, it's now time to program our Wall-e.
Step 13: Program the Spark
If you've got this far, well done :) We are just one step away from getting our Wall-e up and running. The last thing we need to do is program him.
For the most part we can use standard functionality built in the core, however when it comes to receiving OSC messages, we are going to need a little help. To be able to parse OSC messages, we will make use of a library provided by a Spark community member:
If you read the readme, you'll see there are a couple of problems using this library, however they mainly revolve around sending messages, but as we are only interested in receiving messages, this library actually works really well for us.
To start, in the spark builder, create a new project and add the files from the OSC library that we will need. As we are only receiving messages, the only classes we need are:
Next, copy the code from the attached file and update the definitions at the top to so that they point to the correct pins as per your own wiring. When you get things running, you may also need to alter the various mapServo method calls, tweaking the last to parameters which are the servo min / max values.
Everything else should just work as is, and should hopefully be self explanatory. To outline what is going on in that code though, we have.
- As we don't need to connect to spark cloud, we start in semi automatic mode and just connect wifi. To allow over the air programming still, we watch the mode button and if pressed, reconnect to spark cloud.
- Our main loop keeps checking for new OSC messages and if received, calls the relevant handler.
- All servo handlers map the OSC values from the min / max range to the min / max range of the servos.
- The soundboard triggers a sound trigger directly on the FX board (effectively faking a real tactile button)
- In the main loop, we also run a blink routine to make wall-e blink every 5 seconds.
- For the last button in the soundboard buttons area, we make it detach all servos so we can instantly cut any strain on any of the servos.
Once you've updated as required, flash to your Spark core and connect it to the back of your Wall-e.
Step 14: Spaaaaaaark-e!
Connect the controller
With everything connected and programmed, the last thing to do is connect your controller with your Spark. For this you'll need to know your Sparks IP address (I just log into my router to see which IP has been assigned, but you can get the Spark to print this to serial aswell, but I'll live this bit for you do). Once you have this, in the TouchOSC smartphone app, make sure you have your controller selected, then in the settings, configure your device to connect to your Spark's IP via OSC. Also make sure to set the outgoing port to 8000.
Watch Spark-e go!
With the controller set to the correct IP, and with your Wall-e powered up, and if everything is connected correctly, you should now have a fully working, remotely controlled robot.
As I mentioned at the start, this was a long project in the making. I've chopped and changed so many times during it's development mainly due to the restricted space and trying to make him as stock looking as possible. I always find this kind of project way more interesting though as you are constrained from the get go as to what space you have available, and where things need to fit inside various elements.
Whilst I know this won't be the easiest instructable to follow, I do hope you at least find it interesting, and maybe inspire you to do something similar.
Grand Prize in the