These Android figures are cute, but they don't actually do anything. Let's change that. Have a look at the video:

These are the steps to make an Android that reacts to sound, moves it's head, sends out Morse Code messages and displays some cool light patterns. In the video the LEDs in the body are not that visible, but this is what it looks like:

Step 1: Parts and Schematics

These are the required parts:

1 x Android Figure from DYZPLASTIC
1 x ATtiny44A from Mouser or Digikey
1 x 14 pin DIL socket e.g. from Digikey
1 x Micro Servo SG90 (plastic) or MG90S (metal)
1 x Microphone e.g. CMC-5042PF-AC from Digikey
1 x Piezo (passive, not the buzzer kind)
2 x blue 5mm flat top wide angle LED from ebay
1 x red super bright 5mm LED
1 x green super bright 5mm LED
1 x yellow super bright 5mm LED
1 x NPN Transistor e.g. 2N3904 from Digikey
2 x Rectifier e.g.  1N4003 e.g. from Digikey
1 x 100uF electrolytic capacitor
3 x 100nF ceramic capacitor
2 x 100K resistor
2 x 10K resistor
2 x 2K2 resistor (or other values depending on your blue LEDs)
3 x 150 resistor
1 x +5V power supply (e.g. USB charger)

There are many different versions of the Android figure. If you want to have LEDs inside the body, it is probably best to choose a light colored Android. Darker ones might block the light  shining through too much.

For the eyes I used super bright wide angle 5mm flat top LEDs. They are actually too bright, so I used some larger resistor values to adjust for that. Try different values until the maximum brightness is to your liking.

I used a Mystery SD90 servo with plastic geras. After 2 months of heavy use it wore out. I have now replaced it with a T-Pro MG90S which has metal gears. It is more noisy, but hopefully that one will last.

A +5V USB phone charger makes a nice power supply.

To program the ATtiny44A micro controller you can either use an official Atmel programmer like the  AVRISP mkII or one of the many third party programmers.

Step 2: Electronics Assembly

It is good to put the MCU and the microphone amplifier on two separate boards. This makes it easier to cramp them into the round Android body next to the servo. It is possible to add a 6 pin programming header to the MCU board. But again, for space reasons it is better to just make a separate programming adapter board with just the header and a socket.

Try to keep everything as small as possible. Solder the resistors directly to the LEDs. There is more space inside the Android.

Step 3: Open Android

Removing the head from the body can be quite hard. It requires substantial force. Take a look at the picture of the removed head. The rim in the front and the back of the head is flattened. Work from the back, so that any damage from opening the figure will  not be visible from the front. Also take care not to accidentally break the antennae during the process. If you are having a hard time getting the head off, maybe warming the plastic could soften it a bit. I have not tried this though.

Step 4: Modify the Body

We do not want to have to do that again! So the next step is to cut off most of the head's rim. This will make it easier to take it off and put it back on. But the head still needs to be held securely while turning. So do leave some of the rim to the left and right. It helps to mark the center with a pencil first.

The head needs to be able to rotate easily. Trim off about one millimeter around the inner  edge of the body.

Step 5: Prepare Head for Servo

Next prepare the head for the servo. Mark the cutouts with a pencil and try to keep everything as centered as possible. Cut two grooves into the front and the back of the head's rim.

Step 6: Install Servo

Cut off the small pieces at the side of the servo that are normally used to hold it in place. Instead use hot glue applied to the bottom of the Android figure. The servo head cross helps with centering. Make sure the servo reaches up far enough to reach the grooves in the head. If things don't quite fit the first time around don't despair. The hot glue can be removed quite cleanly and you can try again. The SG90S is slightly taller than the SD90 and fits a little better. It can just rest on the bottom.

Step 7: Install Electronics

Push the electronics to the side of the servo. Make sure the servo head can turn freely and that it's center position is to the front and back. The three body LEDs go to the front and are secured with hot glue. The same goes for the two eye LEDs in the head. Make sure the wires are tucked in securely.

The power comes in from the back, for instance into one of the feet. For better stability cut off the USB connector and use thinner, more flexible wires for just the power.

You may want to drill a few small holes where the microphone and piezo are located.

Step 8: Software

The software is written in assembler. The LEDs are controlled by five 100 Hz interrupt driven software PWMs. LED brightness is not perceived linearly. A lookup table helps to compensate for that.

The servo is controlled by a 50 Hz software PWM. Servos from different manufacturers have slightly different PWM pulse width min/max values. It is important that these are adjusted accordingly. Otherwise the servo may get damaged if it is driven repeatedly over it's limits.

The piezo requires a frequency in the kHz range.  The AVRs hardware PWM is used to drive it.

One of the ADC channels is used to read the output from the microphone amplifier. When a certain threshold is reached, the head movement is triggered. Different microphones have an impact on the output of the amplifier. The trigger level can be adjusted in software. Mine is set so that it ignores normal conversations, but get's triggered when things get excited. It's also a good sneeze detector. :-)

The ADC is read from an ADC interrupt. If this interrupt handler is active while the PWM timer interrupt fires, it can introduce a slight jitter to the PWM. This jitter may cause the servo to move a little, which produces enough noise to trigger sound detector. There are two possible solutions to this problem. One would be to not use an interrupt for the ADC and read it in a wait loop instead. This can be a bit tricky and ugly. Instead the current solution is to simply disable the servo PWM pulse while the head is not moving. This will turn of the motor, save energy and PWM jitter will not cause any problems. In general the sound detection is only active while the Android is quiet, as any Morse code beeps or head movement would also trigger it.

One of eight Morse code messages is played at random. Wikipedia has a great Morse Code article. The Morse Code alphabet is encoded in a table which translates ASCII characters to the corresponding Morse signals using a two bit encoding. The actual Morse Code messages can therefor be stored in easy to read and space efficient ASCII strings. 

The source code can be compiled and programmed into the MCU wit the free AVR Studio IDE. There are open source alternatives as well.

Step 9: The End

I hope you enjoyed this Instructable. There are many ways to improve or extend this Android. Or you can build Androids that do something completely different. Let me know what you come up with!
<p>I started making this but could not find the rectifiers anywhere on the diagram. Can anyone tell me where they are used?</p>
<p>Hai,</p><p>Can someone translate this program into Arduino uno</p><p>That would be very nice because that program myself would not succeed me</p><p>Kind regards</p>
<p>can it walk</p>
<p>helo, i'm new in this type of world with programming and IC's. But can i use this code for a arduino based controller?</p>
amazing!!! please get back, where can I buy the actual android figure
amazing!! please get back, where can I buy one?
Hi guys, <br> <br>Can I controll this robot with my Android device?
i love this tutorial and the others based on this. i was planning on making some as Christmas presents. i was thinking of using this tutorial and Hitmit's as well since his is pretty cool. one thing is that the servos he uses for the arm were too big for the toy but i saw that you didn't have that problem in your videos, the Android's arms move so freely without having a section of the body cut out and exposing part of the servo. what type of servos did you use? i want to leave room in for blinking LEDs in the eyes if not the body so it can blink while it dances so what would be the best servos for this to happen?
I love it but i would like a how to that shows how to get the arms and body moving too. this would be my first robot but i am thinking about if i can do the arms and body myself.
about how much do the parts cost in total???
I was wondering the same thing so I looked into it took me like 5 mins you should try it.
........ have a alarm around them in your room at night...
Thank you for such a great and fun Instructable! <br>The head of my android is having difficulties moving because the wires that I used are too stiff, but I love him anyways. Maybe one day Ill open it again and rewire him with softer cables.<br><object height="390" width="640"><param name="movie" value="http://www.youtube.com/v/yOtPilgckbo&amp;hl=en_US&amp;feature=player_embedded&amp;version=3"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed allowfullscreen="true" allowscriptaccess="always" height="390" src="http://www.youtube.com/v/yOtPilgckbo&hl=en_US&feature=player_embedded&version=3" type="application/x-shockwave-flash" width="640"></embed></object>
I uploaded the video on youtube <br> <br>http://www.youtube.com/watch?v=x5d2GzrK36M
First, Thank you for the schematics and instructions. Does any one have any specs on the Piezo or a part number/location to find one. I'm buying the parts for this project and am having trouble finding a &quot;passive&quot; one. I am new to this, but there are a lot of Piezos out there, so any help is welcome. Thanks in advance.
Hi, I had mine from a long time ago and did not get them from Digikey.<br>But look for &quot;Buzzer external drive&quot;.<br>This one may work:<br>http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;name=490-4698-ND<br>
Thank you for the quick reply! I'll try that out and let you know how it goes.
Hello, <br> I was able to program the chip, with the information you have given me, I am sending you the photo, best regads , <br> Andy <br>
Good job! Very nice!
compliments for android, I finally received four AVRStudio avrispmkii with software, I have never used this software, how do I set the fuse not to burn everything? What is the exact procedure to program ATTINY44? Frequency isp?, Internal oscillator? Many thanks for your help. I can not wait to get it working. <br>
Amazing instructable, but i failed trying to upload code on the attiny. Could you post a photo of the other side of the circuit please? <br>Thanks
I just added schematics for the programming adapter. Be sure to connect power. The AVRISP mkII does not provide power to the MCU. It's LED should go green when the adapter has power.
Thank you, I'm sure this will help other people too. I now have confirmation that the way I wired the attiny was right, but it still doesn't want to enter in programmation mode. May be I fried it while trying to make it work. <br>My programmer is an Olimex AVR-ISP500-TINY, and I only have a 10-pins cable, but it should work fine right? (I didn't understand why there is a 10-pins ISP besides the 6, since 4 of them are GND or NC...)
Sorry, I don't have any experience with that programmer. I saw a thread over at Sparkfun about people having problems with it. Do you have the latest firmware? Did you try reversing MOSI and MISO?
Ok it works now. I just received a cheap USBASP programmer (from ebay : http://cgi.ebay.fr/ws/eBayISAPI.dll?ViewItem&amp;item=270718688454), and I managed to get it work with avrdude. Thanks again for your answers, and hope this could help other people!
I got the same programmer, but not sure how the circuit diagram works since the cable is 10pin. Is the RXD and TXD goto ground? and NC you don't connect to anything right?
I think you may be looking at a wrong schematic? There should not be any RXD or TXD. Those are signals of an asynchronous serial port. The AVR programming interface uses a synchronous one with MISO, MOSI and CLK.<br><br>AVRs use a 10 or 6 pin programming header. Both have the necessary signals.<br>NC means not connected, so yes, don't connect it to anything. :-)<br>
The schematic im looking at was provided by the seller of the programmer. Here is a link to the schematic<br><br>http://www.yourportablelab.com/downloads/schematics/USBASP2_SCH.pdf<br><br>Im looking at the most upper left portion of the image labelled &quot;ISP&quot;. Is this the correct part to be looking at for the 10 pin cable?
Yep it's the same programmer, and exactly the same schematic (the other was just the first image i found on google) <br>Do the woltmeter thing to ensure you have the correct pins, then draw yourself something to remember. You should have the same as me : when you look at the pins of the cable, with the plastic thing at the left (besides the pin 5), the positions are the same as the schematic.
umm not really sure what you mean, but ill give it a try. But I still don't know what to do with the TXD and RXD (Pin 4 and 6 respectively)?
So i did the voltage test. For,<br><br>Pin 2 (+) and Pin 10 (-) i got +5V<br>Pin 2 (-) and Pin 10 (+) i got -5V<br><br>This makes sense since pin 10 is GND.<br><br>Pin 1 and Pin 9 i got 0V<br><br>Pin 2 (+) and Pin 8 (-) i got +5V which makes sense since Pin 8 is GND as well<br><br>Pin 2 (+) and Pin 6-RXD (-) i got +5V, so does that mean RXD goes to GND as well?<br><br>however,<br>Pin 2 (+) and Pin 4-TXD (-) i got 0V, so does that mean TXD does NOT goto ground?<br><br>not sure what im doing since im new to this stuff. But is any of this correct? Thanks
I didn't noticed the TXD and RXD on your scheme, on mine it is noted GND. What is important is what you called pin 2 on your cable : you know this is VCC. Be careful, {1,3,5,7,9} and {2,4,6,8,10} may be flipped since you are seeing the cable from the other side. <br>I took a photo of mine (hope you can see it) : <br>http://imageshack.us/photo/my-images/836/imag0313x.jpg/ <br>The red pin is VCC, the numbers are the same as on your scheme. <br> <br>If you plug your Atmel this way (VCC on 2, GND on 10, then MOSI/MISO/SCK/RST), it should work. <br>No problem, I'm new too, I just had a hard time making it work, so I hope the results of all the things I tried could help someone else :)
I don;t know why TXD and RXD are on that connector. You don't need them to program the AVR.. But TXD is usually an output, so you may not want to connect that to GND. I would just leave them unconnected.
I checked to make sure I had the pins in the correct order. I try programming it with AVRDude and got an error of &quot;cannot set sck period&quot;, but it read 100% then wrote 100% then read again 100%. so does that mean it worked? haven't go the rest of my components yet so I haven't tested it yet.
Yes, I get this warning too, but the chip should work perfectly.
Thanks alot for your help both of you, Foaly and tanabata. Once im finish ill let you know how it goes.
So i put everything together and i have a problem. the lights and piezo seem to work but the servo doesn't do anything. I'm guessing I wired something wrong? what can i do to check this? any advice?
If you have the same programmer, look at this (the right one) : http://www.elechouse.com/elechouse/images/product/Atmel%20AVRISP%20STK500%20USB%20ISP%20Programmer/avr_isp.jpg <br>This should be the map but at the programmer output, so the 2 columns should be flipped at the end of the cable. <br>My advice : plug your programmer in with the cable but no avr, put a voltmeter (some breadboard wires are useful) at what you think is pin 2 on this image (+) and 10 (-), you should see +5V. If 0v, you are testing 1-9 or 9-1, and if you have -5V, you have 10 on (+) and 2 on (-). <br>Then the image give you the other pins. <br> <br>Sorry if this message is not very clear, I do what I can with my poor english ^^ Hope you understand anyway, else let me know.
The link doesn't work for me for some reason. The programmer I got is the ebay link you posted. <br><br>http://cgi.ebay.ca/ws/eBayISAPI.dll?ViewItem&amp;item=270718688454&amp;ssPageName=STRK:MEWAX:IT#ht_1742wt_905<br><br>This is the same one you got right? just to make sure.
Yep I tried reversing them, with exactely no effect. I don't know if this is the latest fw, but since it's not mine (I borrowed it from my school), I don't want to try... (Apparently it's a pretty expensive gadget). <br>I'll try another time this evening, but I have to give it back tomorrow. <br>Thanks for your help anyway; I'll try another way, maybe with my arduino.
Great instructable! All my other electronic projects have been put on hold thanks to this! Have been having lots of fun putting it together. I'm still on the breadboarding phase. Have the microcontroller programmed and the piezo and lights are working just fine. I don't seem to be able to get the triggering part of the circuit working and was wondering what the best way was to test this. The microphone doesn't seem to do much. If pin 13 of the microcontroller gets anything but ground, it causes the piezo to sound off in morse code. I tried hooking up a logic probe as a way to test - hoping to get a value of high when I yell into the microphone but it always stays low. Any suggestions you have for debugging this part of the circuit would be greatly appreciated. By the way... I have been using an electret microphone from sparkfun (sku: com-08635) but as far as I can tell is it nearly identical to the one from Digikey.
I am glad to hear you are having fun. So you probably don't have access to an oscilloscope? Analog circuits can be tricky to debug without one. A multimeter will not show an audio wave form. If you really only see 0V youprobably made a mistake putting the circuit together. Did you double check the transistor? It's easy to mix up the pinout...<br><br>If all else fails, you could try BOB-09964 from Sparkfun. That one already has an amplifier on the board, and you should be able to just connect it to the AVR directly.
Thanks for your speedy reply. I don't have an oscilloscope as yet but actually do have one on order that I hope to get soon. I used a digital probe on the positive side of the microphone hoping that I would see some change when I made a noise but perhaps that isn't a good test. I did measure the voltage across the two pins on the microphone and am getting a reading of about 3.10 volts. I'm pretty sure the transistor is hooked up correctly - I tested it in a circuit using it as a switch to light an led. I didn't realize that the circuit attached to pin 13 was for amplification so maybe I will try the sparkfun board to see what happens. I happen to have ordered the Op-Amp breakout (BOB-09816) so am thinking that I could try this in place of that circuit. - feeding the output to pin 13. I can make the speaker and servo go off when I remove the connection from pin 13 - is that normal? If you can think of any other methods that I could use t breakdown the circuit further for testing, that would be very helpful. Thanks!<br><br><br>
Pin 13 goes to an Analog to Digital Converter (ADC). Basically it reads the voltage on that pin and translates it into a value from 0 to 255. The AVR is programmed to trigger its servo when the voltage goes above a certain threshold for a period of time. (When there is a loud enough noise for a certain duration.). So changing logic level on that pin will also make it go off.<br><br>If you use a different microphone or amplifier, you will probably need to adjust that threshold in the code a little bit.
Compliments for the gadget, I with AVRStudio I can not convert the file.asm.in hex to program the chip. You can send by mail? Thanks
Thank you. What kind of problems do you have with AVRStudio? You need to create a project with the ATTiny44A and then load the .asm file. It would be good if you could get this to work,so that you can adjust the sensitivity etc. Any way, I uploaded the .hex file. Hope it helps.
many thanks, I have prepared all the electronics, I'm waiting the micro servo, when I finished the Android will send you the photo <br>
Thank you so much for this Instructable! I thoroughly enjoyed, and loathed at times while trying to stuff it all in, building my little guy! :-) <br> <br>http://www.youtube.com/watch?v=oiDlWCUaxeQ
Yeah, I'd buy one of these too (or maybe even 2 or 3 so they don't feel too lonely when I'm not around)... An ability to program them through USB would be awesome. What about Bluetooth or some tiny RF tx/rx chip?? There gotta be ways to integrate these into the Android... But maybe only for advanced hackers like Tanabata. ;-)<br><br>Need to brush up on my Morse skills to decipher what the little guy is saying... Or maybe I find some Google translator or so to translate to ASCII (or UTF-8 FWIW).<br><br>Too bad T doesn't have time to manufacture and sell them, maybe your employer has some capacities somewhere to produce Android gimmicks?? Otherwise I will maybe try to bribe you :)<br><br>Nice hack!!! Keep in touch,<br><br>/lutzb
Tanabata, thanks for the great instructable.<br><br>Would it be possible to upload a .hex version of the source code?

About This Instructable




More by tanabata:Mechanized Android Figure 
Add instructable to: