How To Control the WowWee Alive Elvis From An External PC (Part 2)

This is the second of four articles about adding a "parasitic" microcontroller to the WowWee Alive Elvis that allows control of this device from an external PC via a serial interface.  This article covers the layout of the microcontroller board to drive the interface that was detailed in the first article.  A link to the microcontroller C source code and programmer loadable hex files are included.  At the end of the construction detailed in this article, your Alive Elvis will be ready to be controlled from a serial interface for your own animation application.  My application will be the control of "PC Elvis" via a MIDI sequencer (covered in the next article), but you can alter the command structure in the source code to suit your needs, and even port the software to a different microcontroller if you desire.

Selecting the Microcontroller

The requirements for this processor are as follows:

  • It must drive the 29 I/O lines in the 34 pin ribbon cable for the interface to the Alive Elvis main board (added in the previous article).
  • Support at least 2 external interrupts (within the 29 I/O lines) to maintain counts for the two head encoder signals (Head UP/DN and Swing L/R).
  • It must have 2 additional I/O lines to support RS232 communications with the controlling PC.
  • Run at the voltage levels of the Elvis Alive (3.3 volts).
  • Have additional I/O lines available for later expansion.
  • Have a clock rate fast enough to drive the duty cycles for the 10 motors of Alive Elvis and monitor the A/D inputs for each.
  • Have at least 256 bytes of EEPROM to save maximum and minimum A/D limits, minimum duty cycle values, and motor overshoot values for the 10 motors.

The microcontroller I chose was the PIC18F4620 with 33 I/O lines, a 32 MHZ clock (without using any external components), 64K of EPROM memory, almost 4K bytes of RAM, 1K bytes of EEPROM, several external interrupts, one USART for serial communications, and an additional serial interface for later expansion via a SPI or I2C interface. You can get the PDF's for this chip as well as the C18 compiler used to develop the C software for this hack free from the site.  The only other major components required to complete this interface are a RS-232 tranceiver and a voltage regulator. You will also need a programmer for which ever microcontroller you do select and I chose to get a PICKIT2 from the site. Clones of these programmers are available for about 10$ less. Either way your talking from 30$-50$ price including shipping for the programmer.

Programming your Microcontroller

The schematic for the microcontroller board is shown in the image below.  All images for this four part article can be downloaded in a higher resolution from here ( The microcontroller schematic contained in this file has been updated (since part 1 was published) to include diode D1 in the power regulator circuit, an incorrect pin number for the serial port and the omission mentioned below. So you will want to redownload this file.

The addition of the in-circuit serial programming header (ICSP) in the schematic is useful if you are planning on developing your own version of the microcontroller code. A previous omission in the schematic for ICSP programming with the "Lite" version of the this interface is a 10K resistor on the microcontroller board before pin 29 of the ribbon cable socket. This must be added to isolate the Elvis Alive circuitry so it does not interfere with the programmer.

Alternately, you can use a serial bootloader programmed once into the microcontroller, and then the code can be downloaded into the controller via the serial interface. This works well for an application that can tolerate the power up delay required by the boot loader to sense the presents of the PC loader application prior to jumping to the micro code that is under development.

I was able to use the Colt serial boot loader (available from with this design, but with one caveat. If you are working with an Alive Elvis that has the interface wired for dual mode (Alive Elvis or PC Elvis), the Alive Elvis CPU will change the configuration of its input pins used to read the two motor encoder signals unless the CPU is cut off from accessing the A/D when it is initially using these encoder signals. This occurs about two seconds into the Alive Elvis's CPU startup. So I caught a lucky break since this is when the boot loader branches to the application! However when you take the boot loader away, the controller software must now wait until the correct time to cut the CPU off to prevent the encoder signals from being pulled high by the CPU later! So in short, a serial boot loader for this type of application is questionable but it helped me in that I now know how to keep from having to use another DPDT relay to switch these encoder signals away from the CPU. However, if you are working with the "Lite" version of the interface (i.e. no Elvis Alive in the building), a boot loader will work fine.

If you do decide to use a serial boot loader you must advance the interrupt service locations by the amount of memory reserved for the boot loader and make other changes for the version of the C compiler you are using. The web site listed above for the Colt boot loader gives directions for this.

One item to mention on this schematic is that for the "lite" version of the interface, the interface schematic shows Audio On signal moved in place of the Alive Elvis Mode signal. This microcontroller board schematic only shows the connections on the microcontroller side for the dual mode interface (not the "lite" version). When the microcontroller is programmed with the "lite" version of the hex file, this signal is correctly swapped over. So wiring the microcontroller card to this schematic will work for either version of the interface.

The List of Required Components

Here is what you will need to build the microcontroller board.

1 - Prototyping PC board, at least 3"x3"
1 - PIC18F4620
1 - MAX232 RS-232 Tranceiver
1 - LM317 Voltage regulator
1 - 40 pin solder IC socket
1 - 16 pin solder IC socket
1 - 34 pin PCB mount connector, right angle preferred
1 - 2 pin PCB mount connector for power
1 - 6 pin PCB mount connector for SPI/IC2 expansion board(s)
1 - 3 pin or greater PCB mount connector to bring in the RS-232 lines.
2 - 10k ¼ watt resistors
1 - 390 ohm ¼ watt resistor (1% or measured to that tolerance)
1 - 240 ohm ¼ watt resistor (1% or measured to that tolerance)
1 - 470 uf 16V capacitor
1 - 100 uf 16 V capacitor
3 - .1 uf capacitors
5 - 4.7 uf 25V capacitors
2 - 1N4004 diodes
1 - 1 PCB reset switch (not needed if power cycling is an acceptable
     reset when using a serial boot loader)

Miscellaneous: 30 AWG wire wrap wire, 22 AWG stranded hookup wire (Black and Red Colors preferred), Wire wrap tool for stripping insulation, a 25 watt (or less) soldering iron, solder, stripper for 22 gauge wire, and wire cutters.

The External Connectors

Except for the 34 pin cable socket, all the connectors below can be mounted anywhere that is convenient:

  • The 34 pin cable socket must be mounted on the side next to the main CPU board to plug in the cable from the Alive Elvis interface added in the previous article. I used a right angle 34-pin socket for this although a straight up socket would also work. No more than 2" of cable was provided for this connection to eliminate excess cable sticking up which could get in the way of the neck motors.
  • A connector is required for the RS-232 interface. You will need a DB9 female connector on the PC end of the cable but on the PCB side only 3 pins will be connected (pins 1,2,3). I used a 6 pin RJ-12 phone style PCB mount for this serial input. A DB9 shell with a 6 pin RJ-12 plug socket on the shell and a 6 pin RJ-12 cable finishes the cable to the PC.
  • A two pin PCB mounted connector is required to receive power from the cable wired in the previous article.
  • The 6 pin ICSP connector is for programming the PIC as previously mentioned.

For any future expansion, you will need an additional 8 pin connector on the board for the SPI/I2C interface for the PIC allowing for 4 pins for the interface and additional pins for power and ground. Possibilities for this expansion interface include: 

  • Adding a sound playback device or chip to make it possible to playback audio for  animation sequences using only the bust and no PC.
  • Adding an additional processor or processors to include additional sensors in the bust for more interaction with its environment. This would include at the very least the reintegration of its IR sensors located on each side of the front chest but I'm thinking USB camera!

Circuit Board Construction Method

There are several methods for mounting components for this custom controller including wire wrapping, making a custom printed circuit board, or the more basic point to point soldering. My choice is the last one. I prefer to get a prototyping/perf board with solder mounting holes in a repeated IC 16 pin pattern with 3 solderable holes per IC pin. I typically solder in sockets for each IC, solder in all connectors and then solder in the remaining individual components. With this type of prototyping board you will have to cut a few of the voltage and ground line traces to allow a larger 40 pin IC socket and a 34 pin cable socket to be mounted. However they do make a similar board that has only 2 solderable holes per IC pin without an IC pattern that is limited in the number of pins per IC. These are available from Then using 30 AWG wire wrap wire, I strip 1/16 inch from each end of a properly cut length and touch solder both ends in place on the bottom for each component pin using the additional solderable holes.

Remember that when doing point to point soldering, it is sometimes necessary to use larger wire than the 30 AWG wire wrap wire for runs that will carry more current than a single I/O pin of the processor. For these low power chips, you only need to do this for cases where you are distributing power and ground to the IC's and the layout does not allow you to use the prototyping board's ground and power traces.  This was necessary for the 40 pin microcontroller, bringing in power from the PCB mounted power connector, and running power from the voltage regulator. For these runs you should use the 22 AWG stranded wire.

Whatever construction method you choose, there are not to many components to be installed. This is good especially because the size of the controller board must fit next to and to the right of the main CPU board in the area next to the right speaker. A 3" by 3" plus or minus 1/4" board is about all that will fit. I left a small vacant area in the middle of the board to drill a hole for mounting to the plastic below with a single bolt and nut.

Pictures of my completed controller board (in all its "hairy" glory) are shown below. Note that I used two 4 pin connectors for power and expansion instead of a 2 pin and 8 pin connector. I'll do better next time. The jumper on the top left was only used for debugging the design and is no longer needed. There was also a coaxal power jack and diode (now shorted out) added for testing from a wall transformer which are not required and are not shown on the schematic. The RJ-12 jack was siliconed to the board upside down because the pin layout was not the .1 inch pitch of the board.

Testing Your Work

After completing the layout, component soldering, wiring, continuity checks of wiring (more than once), and being certain there are no shorts between power and ground, its time to test your work. The software I have written for the microcontroller is available at the link provided ( The files are:

  • DualModeElvis.hex - for the switchable Elvis Alive/PC Elvis version of the interface.
  • PCElvis.hex - for the "lite" version of the interface for PC Elvis only.
  • PCElvis.c - The C source code for both these files for the PIC C18 compiler.

You must use a PIC programmer to burn in the hex file for the PIC18F4620 or setup to use the serial boot loader discussed (after modifying the code for it and rebuilding). Use the correct hex file since there is one version for the Elvis Alive/PC Elvis interface and one version for the PC Elvis only interface. Once the microcontroller and the MAX232 are installed in their sockets you can power up the board by connecting it to the cable previously installed on the Elvis Alive main circuit board to supply 5.5 volts of power. For this test I would recommend not yet connecting the 34 pin cable to the Elvis Alive. If the voltages look good on all devices on the microcontroller board you can power it down and connect the RS-232 cable to your PC. A terminal program will be needed to talk to the microcontroller for testing and calibration. I used a simple terminal application called Termite (available from this link ( The data rate is hard coded in the microcontroller software to be 19200 with 8 bits and no parity. Setup your terminal software in this configuration with no echo and to append a CR after each line sent. If the microcontroller is running correctly it will return the following text on a power up for the dual mode Elvis Alive/PC Elvis interface version:

Elvis Alive is Alive!

When this occurs the microcontroller software will save some default max and min limits for motor movements into the microcontrollers EEPROM and it will set the current operating mode to Elvis Alive Mode.

If you enter a 't' or 'T' into your terminal program and then hit return, you should see the following line appear in its window.

Enter E to exit Elvis Alive Mode:

If all the above was successful, you can power down the Elvis Alive (without entering the E!), plug in the ribbon cable into your controller card and power up Elvis Alive again. Elvis should then do his usual startup sequence. If he does not then you have some issue in the wiring of your interface from first article or something is incorrectly wired on your controller card. I would go back to continuity checks in your wiring.

If all is working after the above prompt is seen again with the cable connected, you can enter a 'T' from your terminal, then enter an 'E' to switch Elvis Alive to PC Elvis and recycle its power. Once this is done, the microcontroller will now display "PC Elvis is Alive" and after about a 2 second pause, the microcontroller will calibrate the head UP/DN and Swing encoders. When this is finished the head, neck, eyes, and eyelids, should be approximately centered and the mouth should be shut. A few status messages will be displayed on a terminal program to indicate if it was successful performing this operation.

If you are using the PC Elvis only version of the interface, the above message "PC Elvis is Alive" is what you will see at the first power on.

For either interface at this point, if you enter a 't' or 'T' followed by a CR, the following menu is displayed.

1. Set Max/Min Motor Limits
2. Set Min Motor Speeds
3. Set Max/Min Motor Overshoot Values
4. Monitor A/D Channels
5. Run Motor 1 sec (stop at limits)
6. Move Motor to Position, no hold
7. Move Motor to Position, use hold
8. Mute Audio
9. Un-Mute Audio
10. Test Script Menu
11. Set Elvis Alive Number
12. Go to Elvis Alive Mode (not seen for PC Elvis only interface)

Calibration of PC Elvis

If you made it to the above menu and PC Elvis is sitting idly by with an non-contorted appearance then you can breathe a sigh of relief and begin to check the A/D inputs and motor movements using the items from the menu above.  Before you do anything else you should first check that the A/D inputs and motor outputs are working correctly using menu options 4 and 5. By alternately looking at the A/D inputs and running the motors, you can verify these are at least functional using the default limits. If all these look good you can begin to calibrate your PC Elvis using menu options 1, 2 and 3 in that order. You can then use option 10 to bring up the script menu and select option 1 in that menu to perform a full test of all motors. If this test does not complete (ending in the eyelid movements) you may need to make some manual adjustments to the calibration values in options 1-3. The use of the menu options is detailed below.

  • Menu option 1 allows you to display and change the min/max movement limit values in A/D counts. It will initially ask if you want the max/min limits to be determined automatically. You should be certain that all the A/D inputs and controller outputs are working before you give this question a 'Y' response. If your response is a 'N' or after the automatic sequence is completed, you can edit these values manually.
  • Menu option 2 allows you to display and enter the minimum speed that motion occurs at for each motor. It will initially ask if you want the minimum speed values to be determined automatically. You should be certain that all the A/D inputs and controller outputs are working before you give this question a 'Y' response. If your response is a 'N' or after the automatic sequence is completed, you can edit these values manually. These values are actually the 10% increments in the duty cycle of the waveform driving the motor. (i.e. 1 = 10% duty cycle, 2 = 20%, etc.)
  • Menu option 3 allows you to display and change the motor overshoot values for two speed ranges (low,high) for each motor. These values help the microcontroller "anticipate" the amount over overshoot after the motor is turned off and adjust to reduce this. It will initially ask if you want these values to be dertermined automatically. You should be certain that all the A/D inputs and controller outputs are working before you give this question a 'Y' response. If your response is a 'N' or after the automatic sequence is completed, you can edit these values manually.
  • Menu option 4 allows you to display the current A/D max/min values for all motors and should be run once before calibration to verifiy the A/D's are working properly. You should see different amounts for all inputs except the motor limit switches which should be 255 unless any switch is being pressed by the head movement to one extreme limit or you want to press the switch yourself to test it. You will need to select which A/D converter to look at where (1) is in the base monitoring Neck and limit switches and (2) is in the head monitoring all other motors.
  • Menu option 5 is used to check the A/D converters, min/max limits, and motor movements for your PC Elvis. Use this option to run any one of the 10 motors at a selected speed and direction for a one second duration. The slowest speed (1-10) at which motion occurs should be used. You can observe the A/D counts for the selected motor as this is posted after each movement of any motor along with the allowed maximum and minimum A/D values. The current min/max limits will be in effect and the motor will be stopped by the controller when that limit is exceeded unless this software limit is not enough for your particular PC Elvis. In which case, the motor will stop at its hardware limit before the one second time limit which should be repeated as little as possible. For any motors that reach their hard limit, you can adjust the software limit stored in EEPROM using menu option 1. Remember that all motors have increasing A/D values for a motion down or to Elvis' right. There are only software max/min limits for motion of 8 motors since the Head U/D and Head Swing motor movements are calibrated automatically by the controller at startup using the motor encoder signals. If you do set limits manually it is probably a good idea to set them a few counts early since the software will sometimes overshoot the limit as speeds are increased. This is mostly important for the non-spring loaded motors (eyes and lip). I think at least 5 counts early is needed. You can also change the minimum raw speed at which motion is detected for each motor using menu option 2. This is done after the max/min limits have been correctly set. The raw speed value is really the 10% increment of the duty cycle waveform driving the motor. Once these values are entered, any selected speed value from 1 to 10 should move the motor. However since the actual "moving" range of duty cycles (say 3-10) is mapped to the selectable range (always 1-10), some speed values will not produce different speeds. In most cases at the higher speeds, more resistance occurs and speed changes will be harder to notice anyway.

Watch Elvis Bust A-Move (get it?)

With the above calibration completed, you can try out more menu options.

  • Menu option 6 will allow you to move any motor to a relative position of 0-100 where 0 is completely left or up and 100 is completely right or down. Note that for the spring loaded motors, the Neck, Jaw or Brow will move back to their home position when the motor stops. A higher speed value is necessary to get these spring loaded motors to move much at all.
  • Menu option 7 does something similar to 6 but allows the motor to run a selected duration after a limit is reached. This option is only for the spring loaded motors for the Neck, Jaw, and the Brow. If the motor speed is high enough to completely overcome the spring, the motor will be stopped at the maximum limit. For the neck, there appears to be some sort of temporary lock to hold it at its maximum left or right position or this is just the gear box locking and maybe this is bad!.
  • Menu options 8 and 9 just mute or un-mute the audio sent in the front audio connector which we are not ready to use yet but you can plug in an audio source and test it. Remember that if you plug in an audio cable while Elvis is in the "Alive" mode he will "leave the building" of his own recognizance.
  • Menu option 11 will allow you to set the number of your Elvis (1-16) and will be used later when you are controlling PC Elvis via a MIDI sequencer. 
  • Menu option 10 will bring up the following test script menu:

1. Initialization/Test Sequences
2. Cycle Eye Lids U/D through speeds
3. Cycle Eyes L/R through speeds
4. Bump Mouth for Max Speed
5. Cycle Mouth through speeds and positions
6. Sequence 401
7. Sequence 2008

The above options in the script menu are all the tests used in the demonstration video. The first option exercises all the motors once. Options 2,3,4 and 5 do what the item says. Options 6 and 7 are just having fun with it doing a couple of minimal animations via built in scripts.

If you have all the above working then you are setup to control PC Elvis via the serial interface. If you are ready to create your own application to control PC Elvis then the serial command protocol is defined in the code comments at the top of the source code and with the code in hand you can add, remove or change what you like.

If you are interested in following my path with this interface, the next article will detail more of what the microcontroller software is doing and how it will be used for control under MIDI applications run on a PC.


rbtLong's picture

Hello, I would really like to see the schematics in greater detail, but the image included in this article seems to be way too small. Can you please send me a more visible image?


Coldblackice's picture

Thank goodness these articles are still here after RC's site renovation! I was afraid they would've gotten deleted. Anyone around still working on Elvis?

crazygeorge's picture

Hi Coldblackice   Am also working on an elvis,    a few people put ther tear downs and upgrade on here, I have gone for replacing the main board with a Pi and some electronics,  there is also a tear down on the cartridge on here that allows you hook it up to a reader, so you can keep the inbuild animations.