-
Robo Sounds
04/01/2014 at 08:57 • 0 commentsSo what’s a toy robot without beeps and boops?
I’ve worked on a project before that played wav files off an SD card using an AVR, however it takes pretty much all the processing juice the chip has to play audio. So the idea is to have a separate chip dedicated to playing audio.
How will it work? (This is going to be specific for AVR/Arduino, but the principles are pretty generic)
If you run a PWM output in phase correct mode, it counts 8 bits up and down, giving 512 counts per period.
If the processor is clocked at 16Mhz, and we run the timer at prescaler div 1, we can get an overflow interrupt (whenever the timer counts back down to zero) at 31.250Khz. If we only update the PWM output compare register every second interrupt we will run at approximately 16Khz.
The main loop of the program will read as fast as possible from the SD card and fill a buffer. The interrupt will take the next sample off the buffer and set the PWM OCR.The main loop will also have to service the UART/I2C to check for new commands.
Timer1 is also free, so we can probably use that to drive another servo.
-- Electronics --
It's all on breadboard at the moment.
To start the experimenting I soldered wires to an SD-Micro SD adapter. I then used zeners to drop the IO voltage.
My first issue was that I used 10K resistors with the zeners without thinking too much about it, turns out the response isn’t fast enough, so I changed to 330R, which is fast, but wastes (5-3.3/330)=5mA per IO line (3 of them) which isn’t ideal.
-- Firmware --
I’m trying the Arduino SdFat library, their hello world example runs okay, but when I tried to open a text file on the card it didn’t want to work. Unfortunately I ran out of time to investigate further.
I also setup the timer to test the PWM which seems good. I made the interrupt toggle an IO pin and it all seems good.
-
Figuring out the leg movement
03/28/2014 at 07:38 • 0 commentsYou will remember this missing gear from yesterday's post. Who knows where it went, perhaps it was never there (I remember that we got these robots cheap as part of a "damaged stock" sale along with a bunch of other toys, maybe this one never worked).
Since I want to separate the leg movement from the torso rotation, I need to make some changes to the current drive mechanism. I have been staring at it for a while now and I think the best way will be to find a small, low rpm, gearmotor and drive the vertical groin shaft (ahem) directly. This solves the missing gear problem and also allows the torso to be mounted via servo on top of that motor assembly, so that it can rotate relative to the legs.
Here are two short videos of the legs moving. In the first one you can sort of see how the ratcheting wheels (which can only rotate in one direction) allow the robot to shuffle forwards.
So now I just need to source a small cheap gearmotor in no time at all... Dealextreme would have been the answer (isn't it always?) if shipping time wasn't an issue.
-
Disassembly
03/27/2014 at 07:15 • 0 commentsDay one was scuppered by lack of appropriate screw drivers, apparently I have all the larger and smaller sizes, but not the one I needed to get the two deeply recessed screws out of his back. Day two was a bust because once I got the right screwdriver I discovered that the head of one of those stubborn screws was already stripped. Day 3 saw my patience run out, so I took him to work and removed the screw's head with a drill. The rest of the disassembly was pretty simple, just careful unclicking of brittle old plastic parts.
All of the movement of this robot is handled by a single motor which, via some clever springs and gears, rotates the body, moves the legs and raises the arms. One of my f avorite bits is that the "brains" are actually in its head, but I doubt that will remain the case for my version, there really isn't much space up there.At least one of the reasons that he doesn't move at the moment is that there is a missing gear which should transmit power to the leg assembly.
I now need to figure out how to control the bits and pieces. Ideally I would like to handle torso rotation and arm movement with two servos. The movement of the legs can still be handled by a motor, perhaps the one that is there already, so long as I can replace that gear.