Hacking a Better Elvis (Part I of 3)

The previous series of articles on this Robocommunity site on establishing a way to drive the Elvis Alive bust from a PC are useful but it becomes a peripheral which can do nothing without being attached to a PC with what amounts to a RS-232 umbilical. This also loads down the PC such that running any other other processes could affect the playback of the animation sequences.  What I plan to do in the next three articles are to make the "PC Elvis" more like the Elvis Alive bust, only better!  Unfortunately the Elvis Alive personality is removed in the process but then there are so many other personalities waiting to come out! 

Improvements To the Original Hack

The goals to be achieved with this upgrade are as follows

  • Still maintain the capability for a PC to send the individual animation commands via the RS-232 link.  This will still be used as before to create animation sequences.
  • Add the new capability to have the microcontroller drive its own movements and play its own audio, triggered by a single command on the RS-232 link.  This opens the door to allow the PC to function as a higher level "brain" that monitors the surroundings and then triggers the sequences. No loading of the PC occurs just to drive the audio and the movements which is also better for driving multiple Elvis busts from the same PC.
  • Add a wireless link between the PC and the Elvis bust to send the sequence trigger commands. This is also better for driving multiple Elvis busts since there can be multiple receivers for a single transmitter with no other special interface design involved.
  • Provide a standalone wireless remote control with some programable customization for triggering sequences on up to 16 Elvis busts.
  • Allow a unique optional capability to connect the remote control to the PC to trigger sequences from audio files. This allows the Elvis busts to do things like announce the arrival of email, insult you when you make errors, or event assist you during a Power Point presentation.

The first step to achieve these goals requires a small but not very cheap module (~$40) called a VMUSIC2. Member Retroplayer on this forum recommmended this module to me and has an excellent Instructables article on the module. The link for it is: http://www.instructables.com/member/RetroPlayer/ (Thanks Retroplayer!). 

In short, the VMUSIC2 module will do the following.

  • Plays back MP3 audio files from a USB flash drive (at least a 4GB size is supported).
  • Allows other files to be accessed on the flash drive which can include files where animation events can be stored.
  • Supports a directory structure on the flash drive to organize the animation sequences.
  • Interfaces to a microcontroller via a RS-232 or an SPI bus interface (I used the SPI bus).
  • Operates from a 5V supply but uses 3.3V signals the same as the existing design. 
  • As an added plus, it allows the playback volume to be adjusted via commands.

The cost of this module is 2/3 what I spent on my Elvis Alive bust but the work it saves it is worth at least 5 times that. So the decision was a no brainer. This module is available at this link http://www.mouser.com/search/ProductDetail.aspx?qs=vnwGVgFuQiYCrKscKT8PIQ%3D%3D for $37.50.

This first article covers the addition of the VMUSIC2 module and a few additional preparations for adding the remote capabilities in the next articles. Once the changes in this first article have been completed, the Elvis bust will run the sequences on its own but will still require a single RS-232 command string to tell it which sequence to play. This will accomplish the first two goals mentioned above.

Required Changes to the PC Elvis Application

To make use of this module, the following changes will be needed to the PC Elvis software application created for the original Elvis Alive hack. This application was previously only used to create and playback the Elvis Alive bust sequences.

  • Add a record sequence capability to save the animation movements to a file which can then be copied to the USB flash drive. A corresponding MP3 file must also be created from the .wav file used with the sequence. This can be done with a freeware program such as Audacity available here http://audacity.sourceforge.net/.
  • Support at least a two level directory structure for storing the sequence files both on the PC and on the USB flash drive.
  • Add a playback sequence capability to send just the sequence name to the bust to trigger that sequence (instead of the tens or hundreds of individual movement commands).
  • Support the playback sequence capability through a wireless remote via a RS-232 connection to the remote from the PC.
  • Support downloading the list of sequence names to the wireless remote for triggering playbacks via a keypad on the wireless remote (standalone without a RS-232 connection from the remote to the PC). 
  • Add a capability to create audio files that contain the frequency encoded sequence names. When these files are played back on the PC into the remote via an audio link, the remote will decode the sequence name and send it to the bust through the wireless link to trigger that sequence.

Materials Needed for this Additional Hack

Other than the first item of course in the list below, this is a relatively small hack.

  • An Elvis Alive bust that has been modifed to receive animation sequences via an RS-232 cable (My previous 4 articles). IMPORTANT! One change is required to the PC To Elvis Alive Interface Schematic! You must tie Trace Point G-2 on the Elvis Alive CPU board high to 3.3V instead of routing it to pin 29 of the 34 pin connector. You can do this at the same point Trace Point H-2 was tied to 3.3V. Otherwise the second A/D converter on the main CPU board will not be enabled using the new microcontroller circuit in this article.
  • 1 VMUSIC2 module
  • 1 2 foot long 3.5mm male-male audio cable
  • 2 feet of ribbon cable (4 conductors for SPI bus)
  • 4 feet of 22 gauge hookup wire (VMUSIC2 power and ground)
  • 1 74HCT04 Hex inverter (14 pin DIP)
  • 1 14 pin DIP socket
  • 1 1N4004 Diode
  • 1 or 2 connectors for SPI cable to microcontroller board (if not previously added) 

Wiring up the VMUSIC2

If you wired the microcontroller board with the additional expansion connector for the SPI bus that was shown in the original schematic then you are a step ahead. All you need to do to complete this connector is add a 1N4004 diode (D2) to drop the 5.5 volt supply going to it to about 5 volts.  If you have not yet added this connector you will need to add it to the microcontroller board or connector combination with at least 6 wires total. The VMUSIC2 comes with a short cable which can be reworked to create the cables needed to complete this connection. The first cable will consist of 6 wires, 2 for power/gnd and 4 more for the SPI bus.  To build this cable it is best to cut the short cable supplied with the VMUSIC2 in half. Then splice in the wires from your chosen connector type to the microcontroller board to one half of the VMUSIC2 cable. This will leave you with spare pins to make the second audio cable. The connector drawing is shown below.

The length of the SPI cable should be kept to less than 2 feet. It must be able to reach from the microcontroller circuit board through the base to the VMUSIC2 module siliconed directly to the bottom of the bust. The VMUSIC2 can be mounted underneath the base since the legs that raise the base are taller than this module. The bottom of the VMUSIC2 module is the flat side so it will be attached in an upside down position at any convinient location. With the USB port exposed to the outside of the bust, the flash drive can be easily inserted and removed.  A picture of the VMUSIC2 mounded to the rear left side of the Elvis bust is shown below.

An additional cable is needed to connect the audio output of the VMUSIC2 to the audio input of the Elvis bust. The schematic above also shows the audio cable. I had to cut the extra 8 pin VMUSIC2 connector plug into two 3 and 5 pin connector plugs to make this cable. Just cut off one end of the male-male 3.5mm audio cable and solder the wires to the pins of the 3 wire plug created this way.

The audio cable runs from the pins on the back of the VMUSIC2 to the front external audio jack on the bust. This still allows you to unplug this cable and plug in an audio cable from your PC while creating sequences. The audio output from the back of the VMUSIC2 module must be used instead of the front plug output due to the better impedence match between the rear signals and the Elvis bust external audio input. A picture of the cables and the VMUSIC2 module is shown below.

 

Addtional Changes to the Microcontroller Board

One other addtion to the microcontroller board is to add a 74HCT04 hex inverter. Power and ground go to pins 14 and 7 of this chip respectively and add a .1uf capacitor across them. The signal being inverted is the same signal being used as the chip select to the first A/D converter on the Elvis Alive CPU card. This signal is now also used as the select for the VMUSIC2 module's SPI interface. This can be done since both of these devices do not use the SPI bus.   Pins 1,2 on the 74HCT04 are used to invert the signal going to the VMUSIC2 to make this Select signal active at the same polarity as the A/D chip select is active.  This is microcontroller pin 7 which after being inverted on the 74HCT04 goes to pin 2 on the external SPI bus connector. This new connection can be seen in the updated microcontroller circuit schematic show below.

 

The only other wiring change required is to move a signal to make the INT2 input of the microcontroller one of the remaining two unused pins on the microcontroller. These two pins will be used to connect a wireless tranceiver for the remote control. Alternately these unused pins could be used without the remote capability to trigger sequences from external inputs such as motion detectors.  The software delivered with this release does not use these pins so it could be easily modified to drive this capability.

To move the signal from the INT2 input you will need to remove the wire going between pin 6 of the ICSP connector and pin 38 of the microcontroller. This wire is not needed for the two wire programming done with the PICKit2 ICSP programmer.  After this wire is removed, move the wire going to pin 35 of the microcontroller to pin 38. This now leaves pins 35 and 39 unused. Pin 39 was previously used to select the Elvis Alive mode which is no longer supported in this design.

Now the last change to make is to re-program the PIC18F4620 microcontroller with the latest firmware. The latest microcontroller firmware along with all the schematic updates can be downloaded from here http://www.mediafire.com/file/kznznqwydnq/PCElvis_v1_1.zip

This completes all the wiring changes! 

Loading the VMUSIC2 Firmware

The VMUSIC2 module can now be connected with the 2 cables assembled in the previous steps. However it will probably not do anything when powered on because it is usually sold with no firmware loaded. By default, the LED on its front will be flashed by its firmware when power is applied. If this does not happen you will have to put a copy of the firmware on a USB flash drive and plug it into the module before turning on power, then leave the power on until the LED stops flashing. This file is available on the VMUSIC2 support site here http://www.vinculum.com/downloads.html.  In short you will need to download the ftrfb_main_03_65VMSC1F.ftd file, rename it to FTRFB.FTD and copy it to the USB flash drive before you power it on as described above. The version of this file I used to install my firmware is included in the PCElvis_v1_1.zip file. 

If you are interested in developing your own application with the VMUSIC2 you may also want to download from this site the firmware manual and the release note that details using the VMUSIC2 with a PIC microcontroller over a SPI interface. The C code supplied in the PCElvis_v1_1.zip will also serve as an example.

New Capabilities Added to the PC Elvis Application

At this point the setup is complete if you have previously installed the PC_Elvis.exe application with the Multitrack Studio demo application. You just need to copy the newest version of PC_Elvis.exe over your old one. Any sequences you have already created are still compatible for full playback over the RS-232 cable. However, since the audio playback can now started locally from the VMUSIC2 by the microcontroller, you will need to change the audio track in Multitrack Studio to always begin at the same time as the first sequence event. This will keep the audio and the animation events in sync when the sequence is recorded to a file and the .wav file is converted to a separate MP3 file.  Once the first event is lined up with the start of the audio, to record a sequence requires the following steps.

  1. Have PC_Elvis running and then Multitrack Studio
  2. Load or create your Song file that contains the sequence to record and set to start playback at the beginning.
  3. From the Record menu on the PC_Elvis menu select Start.
  4. Start the playback and let it complete.
  5. From the Record menu on the PC_Elvis menu select Stop and only then push the stop button in Multitrack Studio.
  6. Select Save in the record menu and enter the desired name in the popup window without any file extension.

The directory that sequences are recorded to is selectable in the settings menu of PC_Elvis. However, this is always within the currect directory that the PC_Elvis application is run from and only one subdirectory level is supported. All directory names and sequence names are limited to 8 characters not including the file extension. This is a limitation of the VMUSIC2. The .SEQ extension is automatically added to the sequence name by PC_Elvis.

A corresponding MP3 file must be created and stored with the just recorded .SEQ file. This file can be created from the .WAV file used for the MultitrackStudio track. This can be done with a freeware program such as Audacity available at the site mentioned at the top of this article.  The MP3 file should:

  • always reside on the USB drive in the same directory as its sequence file
  • be the same name as the sequence file
  • have a file extension of .MP3

Just remember to do this before the recorded files are copied to the USB Flash drive.  You can then just copy all files and subdirectories in the PC_Elvis current directory to the root directory of the USB Flash drive.   

One you have moved the USB Flash drive to the VMUSIC2, you can power on the Elvis bust and you are ready to play sequences by selecting them from the Playback/Select menu on the PC_Elvis window.  This window allows you to select a Elvis bust number (1-16), a new volume setting to play that sequence, or just leave the volume at 0 to playback at the default volume. The default volume is set using the Playback/Set Default Volume menu selection which will be stored in the microcontroller's flash memory and only needs to be done once.

New Serial Commands for the Elvis Bust

If you are interested in writing your own RS-232 application to trigger the sequences, then you can use the following two command formats.

To trigger a sequence already loaded on the USE flash drive the command structure in hexidecimal is:

 0xFn 0xF3 0xyy 0xzz where:

  • n is the Elvis bust number 1-16 (0-15 in hex)
  • yy is the playback volume of 0x00-0xFE with 0xFF being the default volume
  • zz is the length of the sequence name that follows including up to one directory level
  • the zz ASCII characters that compose the sequence name follow these four bytes

To set the default volume for playback the command structure in hexidecimal is: 

0xFn 0xF7 0xyy where:

  • n is the Elvis bust number 1-16 (0-F in hex)
  • yy is the default playback volume of 0x00-0xFE with 0 being the maximum.

Looking Forward

The next article will add a small tranceiver to the microcontroller board in the Elvis bust to accept commands as well as return text (in the microcontroller's menu mode).  Also I will begin to create the custom remote control by creating a new box that contains a microcontoller interfaced to another transceiver but is still driven by the RS-232 interface from the PC. This will establish the wireless link.  The third and final article will add the bells an whistles to this box to make it a fully independant remote control. 

Comments

asimov's picture

Good work Evilis !!

are there more articles ?? Hacking a Better Elvis Part 2 of 3 and 3 of 3 ???

thanks !

Evilis's picture

asimov,

I've done the work to make a stand alone RF remote that also connects to a PC to be used as a remote link. So all the hardware works but I still have more code to write for the remote and the PC. This project has unfortunately been in limbo for almost a year due to too much work at my "real" job and due to a broken tendon in my shoulder that I've been trying to rehab for some time. So parts 2 and 3 may eventually happen but I cannot guarantee it. The good news is I plan to partially retire in a couple of months so more free time is on its way!

asimov's picture

Evilis,
Thanks a lot for the quick answer.
I stand by for the next articles if you shoulder and your free time make it possible.

Greaings from Argentina !

Coldblackice's picture

Heya Evillis,

Any updates on your subsequent articles? I'm starving for more! :)

Coldblackice's picture

Evilis, how long did it take you to write the initial C code/program for the Elvis?

I've been working toward writing my own very basic, limited version of code to interface the PC with the Elvis (based on your code, but not copying or distributing, of course!). But my jaw dropped when I saw that your code is 5000+ lines!

Good golly, how long did it take you to write all of that? As impressive as it is, it's a bit discouraging on my part, as it seems like it would take me years to be able to write out that much code to interface the PC with a PIC (to control Elvis).

Evilis's picture

Hey Coldblackice, I've been out for a while on "medical leave" so to speak. But I'm back and good as new. On your first question about more articles on Elvis Alive, I did submit one more here but it was never acted on by the powers that be. It was about a VB program I wrote to create animation sequences. It used a Microsoft tool used in Windows XP to create the mouth movements which was always the hardest to do manually. I am assuming that because the Elvis Alive bust is no longer manufactured, there was not enough interest by the person(s) who run this site. I can understand that.

On your second question about how long it took to write the code. I cannot remember exactly but I can guess it done over about 3 months of my free time probably while watching TV or something. This was for about 3000 of the 5000 lines. I am retired now but I wrote code professionally for about 35 years and C code for the past 20 so it is very much second nature for me. My proceedure is to first type in text as comments for what I plan to do and then continue to add details where I'm interested at the moment until I feel I have enough details to start writing actual code. You discover so much that you did not realize as you first start writing the actual code that you just have to keep adding more and more details as text as you go. Eventually you start writing more code than comments and then you know your getting somewhere. When you have enough of your details written as organized comments, the code writing part is actually very easy. I really need all my ideas and concepts contained in one place so this is one reason my source code ends up being a single file instead of broken up as a bunch of libraries. I of course continued to add and refine more features over about another year but the core of it was written in about 3 months.

If I were to take on the project again today I would probably do it a little differently. The PICs are still great for thier small size and capabiliy but there are some exciting new inexpensive directions to go. One new item that is about to hit the market (I have one on order) is the Rasberry PI single board computer for about $40 delivered. It has some individual I/O lines but you would still need more so I would still add a PIC as just an I/O expander. But the great thing is the abilty to build and compile your code on the same computer that runs it for about the same price as building the PIC microcontroller card. Plus you would be working under a real operating system (Linux) with a 1080p display. Plus you could choose more lauguages to work in. Plus it can run multitask. Plus it has the processing power of the old 300MHZ pentium 2 which is still at least 10 times more than the PIC. If your interested in checking it out here is a link to a wiki http://en.wikipedia.org/wiki/Raspberry_Pi The times they be a changing fast.

Coldblackice's picture

Thanks for the info. I've been voraciously reading through your code, trying to decipher the core of it. Is it possible that you could list out what the basic, core components that the program would need to communicate and interact with Elvis?

In other words, just like simple bullet-point type things, like "Must be able to read from ADC's; Read in data from encoders; etc..."

Also, as to your comment about the Raspberry -- wow! That looks fantastic. Unbelievable that they're able to sell something that cheap.

Let's say you had that and you were going to use it to control Elvis -- How would you do so (basically)? Would you still use a MCU board "parasite" on Elvis, and have that connect to the Raspberry over serial? Or would you connect and interface it through some other way?

Would you still program in C? Or would you use some higher-level type of language or interfacing?

I've actually been looking at interfacing Elvis with an old, first-generation Xbox, since it's basically a full fledged linux machine. I'm wondering if I should keep it along the same lines of your process -- an MCU board that interfaces with the computer over RS232.

But now that I'm thinking about it, I guess having a computer like these (Raspberry or Xbox) might eliminate the need for an MCU board, since it'd have access to a much more fast and capable processor!

If you would eliminate the MCU in lieu of these small computers (besides using a PIC as a I/O expander), like the Raspberry, what's the general process and interface you would use? Like over what connection/protocal would you attach to Elvis? And what kind of programming/interface would you contemplate have running on the computer to communicate with Elvis?

Don't worry, I'm not asking for all nitty-gritty details; just some general thoughts/ideas/conceptions/analysis so that I can have a bit of a general direction/foundation to go off of, as I keep taking my baby steps in the pursuit of learning digital electronics/MCUs/embedded programming! :)

Evilis's picture

I've been thinking about a Rasberry PI implementation for a couple of days so here are a few points.

1. The time critical areas should be handled with some sort of interrupt. These are detecting thehead movement limit switches and controling the motor duty cycle for speed control. I have notlooked into how to do this on the Rasberry PI board so this is TBD.  Also the Rasberry PI has onefailing in that it does not have a real-time clock. Interrupt and clock are relatively easy to do it on the PIC and since you would have a PIC anyway for I/O expansion, a quick approach might be to strip down my PIC C code to still handle the low level motor control and clock functions. So you would still keep the MAX/MIN settings of the calibration of the motor limits on the PIC's EEPROM as well.

2. There is alot of code for handling the VMUSIC2 module that could be stripped out. Since the Rasberry PI has built in audio, this would be used instead. The VMUSIC2 module was over $40 so this is a great tradeoff! Plus the RasPI has all the storage for audio files via the SMD Card or even an added USB stick.

3. The Rasberry PI does have a pins that connect to a serial port so this could be the communication between the RasPI and the PIC. I think the RasPI is 3.3V and if these serial I/O pins have the same 3.3V then you could eliminate the RS232 chip and connect them directly.

 

Here is a list of core C functions on the PIC that you would want to keep

  a. The interrupt services
     - void low_int_service (void)
     - void rx_handler (void)
     - char *getstr(void)

  b. The EEPROM read/write services
     - void Write_EEData(unsigned char Data, unsigned char Addr)
     - unsigned char Read_EEData(unsigned char Addr)

  c. The AD01 A/D converter control
     - void Millisleep(unsigned int millisec)
     - void Send_Clock(void)
     - void Send_One(void)
     - void Send_Zero(void)
     - void Set_DIO_Out(void)
     - void Set_DIO_In(void)
     - void Setup_AD01(unsigned char ad_num)
     - unsigned char Read_Input(unsigned char chan_num)
 

d. The PIC initialization
     - void Setup_Elvis_Mode(void)
 

e. The Elvis Alive Initialization
    - unsigned char Init_HUD_Encoder(void)
    - unsigned char Init_HSW_Encoder(void)
    - unsigned char Initialize_Elvis(void)

 f. The motor control functions
     - unsigned char Check_For_Limit(unsigned char Motor_Num,
                              unsigned char Direction)
     - unsigned char Check_For_Position(unsigned char Motor_Num,
                                 unsigned char Position,
                                 unsigned char Direction)
     - void Run_Motor(unsigned char Motor_Num,
               unsigned char Speed,
               unsigned char Direction,
               unsigned short Duty_Cycles,
               unsigned char Hold_At_Speed_Flag)
     - void Stop_Motor(unsigned char Motor_Num)
     - void Go_To_Position(unsigned char Motor_Num,
                    unsigned char Rel_Position,
                    unsigned char Speed)
     - void Go_To_And_Hold(unsigned char Motor_Num,
                               unsigned char Rel_Position,
                               unsigned char Speed,
                               unsigned char Hold_Time,
                               unsigned char Hold_At_Speed)
     - void Motor_Off( unsigned char Motor_Num)
     - void Motor_On(unsigned char Motor_Num, unsigned char Direction)
     - void Process_Motors(void)
     - void Run_Duty_Cycles(unsigned int Num_Cycles)
     - unsigned char Move_Checking_Position(unsigned char Motor_Num,
                                     unsigned char Position,
                                     unsigned char Speed)
     - unsigned char Move_Checking_Motion(unsigned char Motor_Num,
                                   unsigned char Direction)
     - unsigned char Move_Checking_Motion_No_Limits(unsigned char Motor_Num,
                                   unsigned char Direction,
                                   unsigned char Number_Duty_Cycles)
     - unsigned char Move_Checking_Motion_No_Limits(unsigned char Motor_Num,
                                   unsigned char Direction,
                                  unsigned char Number_Duty_Cycles)

  g. Main()

 So the Main() would simply loop to receive commands from the RasPI, process them, and continue to call the Run_duty_Cycles() function to keep any motors running at a given duty cycle or to turn them off when it was time or a limit was reached.

This would make all the low level activity still controlled on the PIC and leave the high level stuff for the RasPI. And given the processing ability of the RasPI, you could get into some real (only limited by your imagination) fun stuff!

So the microcontroller card would be the same less the RS-232 chip, less the VMUSIC2 connection, which leaves almost entirely just the wires going to the Elvis Alive computer card through the 34-pin cable and two wires going to the RasPI for serial I/O.

Since the RasPI has USB ports, you could do even more control from a remote computer if you wanted using wireless LAN. Not that you would need to but the level of complexity is not limited by the hardware at all!

 

Hivoltage's picture

Wow that would be great.
I have just been working on reading the ADC stuff using an Arduino.
I will be very interested in how your progress goes.

Keep up the nice work. :)

Coldblackice's picture

Evilis, any update on your Raspberry Pi endeavors? I've recently gotten my hands on one, but was wondering if you and the other guys come around these parts anymore these days!

WarPig's picture

Here I am, still floating around! :)

Evilis,

I'm interested as well in anything you've done with the Raspberry Pi - as well as that XP program to help with jaw animations.

I'm mapping out an ambitious project that will turn Elvis into Alex Murphy (RoboCop). The first step is to convert an Elvis bust into an animatronic that I can control the sounds and movement (Evilis' PC/better conversion). After that comes the "easy" part: sculpting the cyborg parts, and ultimately replacing Elvis' face (or covering it) with a silicone likeness of Peter Weller.

I've really wanted to start the sculpt, but I realize that I need the internals in order first. Even if I don't get programmed animations right away, I need to get him so I can control him from a PC (or Raspberry Pi).

Code causes my eyes to glaze. I can follow instructions (like connect "A" to "B"), but to write an actual program? I don't have the brain cells for it.

Thanks for any updates!

Hivoltage's picture

I was considering on creating code for a different chip.
For the whole head and using a pc to animate it based off of an idea.
If I can get the code going and working I will post some vids to show everyone.
I recently lost my job and had to put things on hold. :/

Anyway if you ever want any help on reading the ADC or other stuff let me know cause I am familiar with most of it.

WarPig's picture

Finally scored an Elvis bust! He should be here in a few days and then the fun begins.

I'm going to re-read Evilis' articles on the initial conversion. I'm assuming that the Ras Pi gets interfaced to that mod, rather than replace it.

It would be really cool if it could interface with some kind of voice recognition - but I'll be happy if I can get him to move and speak at a key press or two :)

Coldblackice's picture

From what I've gathered from both Evilis and Retro, the ideal setup is to keep a microcontroller as the "low" level interface, enabling the Pi to function as a "high" level interface, with the ability for more advanced processing and functions.

Voice recognition definitely sounds easily reachable in the realm of possibilities!

Evilis's picture

Yes ColdBlackIce, you are exactly right on the RasPI usage. If anyone does decide to use my design for the low level control through a RS-232 port from the PI (or any other RS-232 equipped computer) you should probably go with the schematics and software for the last of my articles that includes the VMUSIC2. This contains a better version of the microcontroller software. Note you do not actually have to include the VMUSIC2 by making small changes to the C microcode and then recompiling it. However in terms of maximizing what you can do with the controlling computer, off-loading the sound file playback and motion control inputs is a definite plus. This leaves more PI CPU to do things like respond to voice input or even camera input.
And for even a newer "unpublished" version of my schematics and software, here is a link: http://www.mediafire.com/download.php?fbelqbf9a2xvb8b . There are software versions with the VMUSIC2 and a newly added transciever device RFM12B already disabled so they do not have to be installed if you want to drive everything from the serial port and playback the audio from the controlling computer. And yes ColdBlackIce, I believe I already gave you this link.

Coldblackice's picture

Awesome -- yep, same one you sent me before.

I know we talked about this a bit, but is it difficult to keep track of where everything is in these code files? And between revisions? It just seems like there's so much, it'd be hard to find what's where, and keep track of all the parts and whatnot.

Is there any kind of "mapping" system for code? It'd be great if there was a sidebar with a tree hierarchy of sections, or like a table of contents, or some type of list of sections/structures/divisions.

Of course, I'm sure it'll come easier and remember better the more I (and others) continue to read through it.

As always, a BIG public thanks to Evilis for all of his help, advice, guides, information, and continuing help and support in this Elvis-hackin' world!! :)

Evilis's picture

I have no mapping other than the comments I previously made about the must have routines needed for a RasPi implementation.

I will say what I think is obvious if you already understand C and PIC microcontrollers. All the code functions around the startup initialization and continuos looping in the "main()" function and in the low priority interrupt service routine "low_int_service()" and the high priority interrupt service routine "rx_handler()".

There are large blocks of routines for the RFM12B tranciever which you can ignore if you do not wish to use this device and large blocks of VMUSIC2 routines which you can ignore if you do not wish to use this device.

There should be suffient comments to identify all of the above.

With the different versions of programmable .hex files that are included in the link I just supplied you do not have to understand the code to eliminate either of these devices for your design. You just need to understand the RS-232 command structures which are used to control the bust movements. But if you do want to learn how the code works for any of the devices used you must learn the C language and download and read the pdf documents that describe how these devices work. Then you can step through the code and enjoy the learning.

As for using the RFM12B transciever with a RaspPi implementation, I would avoid it in favor of using a wireless interface on the RaspPi USB. That would be almost infinitely faster and easier to do.

WarPig's picture

Showing my ignorance here, but I can only learn by asking questions.

What is the difference between the different PIC18F460 chips - and which is the one I need?

Microchipdirect.com lists different flavors: PIC18F460 with suffixes E/ML, E/P, E/PT, I/ML, etc.

Evilis's picture

Greetings Warpig

Wow! Your simple question ended up leaving me with a puzzle. The part you need is the I/P which is a 40 pin inline package that can be inserted into a standard 40 pin IC socket. The puzzle occurred to me when I realized from the 4620 spec sheet that I have been using the PIC18F4620 and not the PIC18LF4620. The first part is rated from 5.5 to 4.2 volts. The second part is rated from 5.5 to 2.0 volts. The voltage needed for this design is 3.3V to interface with the control signals on the Elvis CPU card. I have built a total of 11 controller cards with the (F) part but they all appear to work as well as if I built them with the (LF) part.I would recommend you use the PIC18LF4620-I/P.

WarPig's picture

Evilis - Thanks for the quick reply!

I guess my question was entertaining as well as informative :)