In a very exciting moment I connected a Lynxmotion PS2 wireless controller via a Lynxmotion PS2 receiver to to the arduino, installed Bill Porter's wonderful PS2X library, supplied power to the arduino and the outputs and downloaded the example program and - TA DA - I have remote control of my arduino, which means very very soon Bernie will be operated remotely. Many many thanks go to Bill for this lovely little library which makes this all so easy to do.
On a side note, having looked at the price of battery chargers and batteries it might be a while before he is moving around completely remotely...
Servos are amazing things. Tell them to move and they get right to it and go to exactly where you told them to be within milliseconds. Dragons are much lazier, and might make it there eventually if you ask them nicely. Maybe. So the servos inside a dragon need to learn to relax a bit, take their time and meander their way to their destination slowly. I've been doing that in software to make the neck move nice and smooth, but once I add the legs and wings the load on the arduino is going to be too much and everything will slow down unreliably, making the movements very jerky and not in the least bit smooth. I found a design online for an RC landing gear which makes the servo act over a much slower timeframe, up to about 10 seconds long. This sounds more dragon like already.
I ordered 3 sample PIC12F629 chips from Microchip to play with and bought a big bag of capacitors, and I'm all set to build the landtastic circuit. Hopefully I can adapt this design to work with my dragon - I definitely do not want to have to spend the time building up a program in assembly from scratch it there are functional systems out there already!
This week I made the first step towards a speaking (or roaring) dragon by soldering together the wave shield from adafruit industries and testing some of the software. Using the example code audio files, burnie now has the ability to recite pi to... well a lot of digits.
Those aren't just untidy yellow wires either - unfortunately the wave and the arduino mega are not naturally compatable, so there was a little bit of extra soldering and software configuration to get this running. Nothing a bit of debugging and some helpful forum folk couldn't fix.
The audio is a little quiet (who ever heard of a whispering dragon?) so I'm going to have to build an amplifier, but this will work for now so that I can get on with some other construction developments which are underway.
I've had a few questions about how 'wired' this dragon is.
This is what he looks like at the moment. As you can see, he is tethered to power by two power cables (the black and red you can see in the photo), and has a usb cable (the grey one) which can connect to my laptop to reprogram the arduino.
The usb cable is completely removable, which leaves the two power supplies. These can both be replaced by rechargeable li-po batteries when the dragon moves beyond the current testing phase.
That's the easy bit though. I want a control panel which will allow me to interact with the dragon and control him to move around, which means I will eventually need to work out some remote wireless i/o. I'm not going to be up to that for a while though, so I can do a lot more research first.
The last two days have been great, so many packages arriving all at once!
From little bird electronics I got the second servo for the tail so that they would be matched. This is now installed but not yet plugged in or configured (although I have written the code already, so hopefully it works!)
More importantly, part of my order from DFRobot included a pan and tilt kit, which I have constructed and installed. Bernie can now look around - up and down as well as left and right. To do this though I had to CUT OFF HIS HEAD! Normally it is measure twice cut once, but I think this time I may have measured about 20 times. That cut would be hard to undo!
The neck now looks very mechanical, but moves very smoothly and can do so many things, I look forward to playing around with it. I will upload new video once I have it automated.
It would be so lovely to be able to buy the supplies for the dragon in a store, but the prices are astronomical ($25 for a servo which costs $4 online) and I need a LOT of things, so I have placed several orders for various parts. Today the first order finally arrived from DFRobot, including:
Now I just have to wait for the other things I ordered from Amazon, Little Bird Electronics, Ebay and DealExtreme to arrive.
I love working with this arduino Mega board - so far everything I have tried to do has just worked, and I can already see that it will make development much faster and less depressing, especially in comparison with my last attempt using PIC technology and hand wiring everything.
About half an hour after I got home I had the first servo running, only to discover that actually I didn't know how to stop it... I was so surprised that it worked it took me a little while to remember to wire in a switch.
I now have a momentary push button which enables the servos, which means that if I release the button they gradually come to a stop as they complete their respective routines. In future I will program this as an interrupt as it will be a safety device to stop the dragon trying to move further once it has reached the limits of the skeleton structure - I would hate for it to destroy itself on the first test!
The button will also be replaced by a slider switch so that I can turn the dragon on and off properly rather than having to re-enable it each time it cycles through the main loop program.
The circuits in this photo have been rigorously tested by a 3 year old who found the concept of pressing a button and having things spin fascinating for about an hour. I figure if it can survive that, I'm on the right path.
My only issue so far is that the tower-pro servos are incredibly noisy - I think for a lot of the more important servos I will have to invest in better quality servos which have metal gears instead of plastic so that they are more accurate and less loud.
Today some of the parts I ordered from littlebirdelectronics.com arrived. The order so far has been very prompt, and even arrived in a great box which I will use to store lots of bits and pieces while the dragon is under construction.
This includes an Arduino Mega, which I hope will act as the dragon's sole control board. This board has 54 i/o and can control about 40 servos, so I hope it will allow me to expand significantly before I need a replacement. My order also included 2 servo motors, which will form the first part of the dragon's motion ability. These will probably both be used to manipulate the tail in the first stage of the electrical installation.
This order also included a lot of hook up wire and other connectors so that I can get started on building and testing the electronics.