Those wiggles in there are from that stupid error I made in the software. It’s fixed now!
Archive for April, 2010
We got some really fancy servos for this project: the Hitec 5990tg. Behold! Titanium gears, 400 oz/in torque, digital amplifier. That’s about 10x more torque than a standard hobby servo in the same case size.
BUT! They make a horrible high pitched squealing noise almost constantly. It made everyone in the room angry. Having one of those right next to your ear all day would be criminal.
Luckily, we had a backup plan: the 7955tg. Not quite as strong at 333 oz/in, but waaaay quieter and still has all that nice metal everywhere. All is well!
Each one is molded on the head of its respective dancer. It’s going to hold the bulk of the giant puppet head, along with mounts for the microphone and the heads up display. It’s made of thermoplastic.
To make one, you heat up the plastic until it softens. It gets melty at about 160°, so it’s safe to touch. The brand is Protoplast.
Uh oh! Once I get started on an analog design, I just can’t stop tweaking! I took that envelope follower circuit and added an inverting amplifier to its input. This let me eliminate the DC offset voltage and also increase the amplitude of the signal before it gets “followed”. The response is much better! I also now use both amplifiers in the eight pin DIP. The second one is a unity gain non-inverting amp, just to bring the output impedance way down so that the ADC can handle it. The AVR likes no more than about 2kΩ of impedance on its analog inputs.
Analog designs do this. They slowly get bigger and bigger as you realize that you can make the signal just a little bit better/cleaner/niftier. Be careful!
Also, I made one of the classic C mistakes in the software filter: an “=” in the place of a “==”. Mock me, if you must. I’m not ashamed.
Apparently if you make purchases on Sparkfun, Mouser, and American Airlines all in one 48 hour period on one card you get a telephone checkup from The Man!
Look at that pretty thing! I got it from our School Store over at NYC Resistor. It’s a four bit parallel LCD display, white on blue. Werry naice!
Right now it’s just serving as a data readout. Ultimately it will be used as the tweaking interface for the puppet suit, so that in the field we can avoid having to use a computer to make small changes. We’ll be using the onboard EEPROM on the AVR to store those changes.
The unit is the ARDUINO LCD-shield V1.1 from nuelectronics.com.
here’s a simplified version of the code I used:
#include <LiquidCrystal.h> //include the library that does all the heavy lifting LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // initialize the library with the numbers of the interface pins lcd.begin(16, 2); // set up the LCD's number of rows and columns: lcd.setCursor(0, 1); //put the cursor where we want it lcd.print("I'd rather get a bike!!!"); // Print a message to the LCD
See that black rectangular blob in the middle of the picture above? That’s an operational amplifier, or op-amp. It’s a very common device that has a whole bunch of uses in the analog domain. Here I have it configured as a simple non-inverting amplifier, with a basic envelope follower circuit on its positive input. The envelope follower strips out the frequency from the microphone signal and outputs a voltage that is proportional to the amplitude of the original signal. This is almost enough to solve our problem, but the output signal is too weak for the AVR to read correctly. That’s where the op-amp comes in. It amplifies the signal before it goes into the AVR, overcoming noise issues. Fifty cents well spent! Now, instead of rapidly reading and analyzing the waveform, all the AVR needs to do is sample the output from the op-amp once in a very leisurely 11 milliseconds or so.
I was a little afraid of going back to 1970s era analog circuitry to solve this problem, but I’m glad I did. It works amazingly well. Now we get convincing, smooth servo response. And we don’t have to glue a pile of mechanical sensors to the dancer’s faces every two hours!
Here’s the circuit, drawn in SHARPIE CAD: