Operation Autonomous Flying Shark
I’ve been working at the Museum of Science for close to a year now and it’s been awesome. One of the standing challenges in my office is to create an autonomous flying shark. We have an Air Swimmers Flying Shark and I have tons of sensors and Arduinos lying around. I have accepted the challenge.
Here are the rules:
- No removing, replacing, or harming any of the existing electronics on the shark.
- Shark must be able to swim in a room by itself without running into walls or objects.
- Set up must be simple enough for someone without programming background.
Ideally I’d like to add an attiny, and IR LED, two ultra sonic distance sensors, and a mini servo to the shark.
One of the distance sensors will point down to maintain a constant height off the ground. One will be attached to the servo and will sweep back and forth scanning the environment for obstacles. The attiny will be the brains and the IR LED will send the commands to the shark. This may change once I know how much weight the shark can carry. I may need external sensors from the shark to keep it swimming in the air.
Either way I need to decode the IR Packets being sent to the Air Swimmer.
I found a great paper by Kenneth Beck. He had tried to configure a standard RC controller to work with his Air Swimmer: http://blog.geekken.net/wp-content/uploads/2013/03/Masters-Project-Report-v2-Ken-Beck-2013.pdf
In the Appendix he goes over the protocol for his Air Swimmer. He used an oscilloscope to manually decode the Air Swimmer. These were his results:
Up: 0110 1010 1011 1101 1000 0010
Down: 0110 1010 1011 1101 0100 1110
Left: 0110 1010 1011 1101 0010 1000
Right: 0110 1010 1011 1101 0001 1011
Ken concluded the air swimmer used a 24 bit code. The first 16 bits are the signature, the next 4 are the command, and the last 4 are a checksum.
Up: 0110 1010 1011 1101 1000 0010
I don’t have an oscilloscope with a memory at my disposal so I improvised. I first tried using this arduino library that decoded TV remotes. https://github.com/shirriff/Arduino-IRremote
But when tried to decode one of the buttons I was getting results that weren’t the same as Ken’s.
I stumbled across and article that someone wrote about using your computers sound card to record signals.
So I attached an IR LED to a microphone jack and plugged it into my computer. I pointed the Air Swimmer remote at the LED and recorded the “sound” in Audacity. I then visually decoded each bit and this is what I got:
UP: 0010 0000 1100 1100 1000 1010 0/1
DOWN: 0010 0000 1100 1100 0100 0110 0/1
LEFT: 0010 0000 1100 1100 0010 0000 0/1
RIGHT: 0010 0000 1100 1100 0001 0011 0/1
If you look at my code it is very similar to Ken’s however my checksum is different. Also I noticed there was one bit at the very end of the signal. I don’t know if it should be a 1 or a 0 or if it should count at all.
The first bit of my checksum is the opposite of Ken’s. However everything else matches (besides the signature, that’s unique to every Air Swimmer) .
When I was first testing, I was just testing the UP command and comparing it to Ken’s code. It wasn’t until I decoded all of the commands that I realized that my code wasn’t wrong, just different than Ken’s. I haven’t tested my code on the flying shark, but I will definitely test my code as well as Ken’s (with my signature) and see what happens. I’m attaching screen shots and also my audacity files from manually decoding the signal.
Ken also has his own Arduino library on his GitHub: https://github.com/cmptrgeekken/Arduino-Air-Swimmers
I haven’t really played around with it, but I will soon
That’s all I have for now. More cool stuff later!