Spooky Halloween Animatronics With Arduino and Bottango!
by CameronCoward in Circuits > Robots
461 Views, 7 Favorites, 0 Comments
Spooky Halloween Animatronics With Arduino and Bottango!
It may be easier than you think to build complex animatronic characters!
For Halloween last year, I built Dead E. Ruxpin. While I'm still proud of it, the impressive part was the unique cassette tape control. The actual animatronics were pretty simple. This year, I wanted to build something a bit more animated—and ideally something legitimately creepy!
Luckily, I recently learned about software perfect for the job: Bottango.
(I have no affiliation with Bottango, I just think it is neat)
Bottango is software designed specifically for controlling animatronics and it is free! Even better, it is surprisingly easy to use and works with Arduino boards right out of the box. If you're using a supported board (like an Arduino Uno), you literally won't have to write a single line of code!
I'll be explaining how I built my animatronic doll, but I'll try to stick to more general lessons that you can utilize for your own custom designs.
Supplies
You will likely need:
- An Arduino Uno R3
- An Adafruit 16-channel PWM servo driver
- MG996R 55G servo motors
- A 3D printer
Pretty much everything else comes down to what you're building. For example, I started with a creepy old doll that I found at a thrift store. You may want to do something similar, but you can also build your entire animatronic from scratch.
Mechanical Design
I'm not going to go into detail about modeling here, because I doubt you want to build exactly the same animatronic doll that I did.
But there are some key lessons that are worth absorbing.
Use "Real" CAD!
First, you'll want to use parametric CAD software like Autodesk Fusion 360 (free for hobbyists!). 3D "sculpting" software, like Blender, is nice and all, but it really isn't meant for engineering work.
Fusion 360 will let you define specific dimensions and update them at any time. It will also let you build assemblies from several parts (complete with working joints), which is critical for ensuring that your mechanisms move as expected before you waste time and material on fabrication.
Test Your Designs Early
I also suggest using a 3D printer to test your designs early on. For example, my animatronic's legs are four-bar linkages. I printed a small mockup of the geometry to make sure it moved in the way I wanted. If it hadn't, it would have been a simple matter to tweak the geometry.
Look For Reference Models
You don't have to design everything from scratch! If you're using any off-the-shelf parts, the manufacturer or a kind hobbyist might have already made a 3D model.
For example, there are lots of models online for the servo motors I used. I was able to drop the STEP files directly into my Fusion 360 assembly, instead of modeling the motors myself from scratch.
Always Consider Fabrication and Assembly
When 3D modeling, it is easy to inadvertently design parts that are difficult or impossible to fabricate in the real world. Even when designing for 3D printing, you'll want to take into account factors like tolerance and part orientation (to avoid the use of supports).
Similarly, you should consider how you'll be putting your finished product together. For example, I added holes across from my servo motor screws. Their sole purpose is to provide access for a screwdriver. Without them, I wouldn't have been able to mount the legs.
Pins/Dowels Are Great!
Bearings are nice, but they're overkill for something like this. I used simple 3x35mm steel dowel pins for all of the linkage joints and you should consider doing the same. They're cheap and easy to design around. Plus, a dab of hot glue over the holes secures them and keeps them from falling back out.
Downloads
Bottango Overview
I'm a bit infatuated with Bottango at the moment. It is really awesome software!
To use it, you first build a rough 3D model of your animatronic. The key word there is "rough," because it doesn't need to detailed or even particularly accurate. Its primary purpose is to help you create poses, so it just has to be recognizable. As you can see, my model was extremely simplified.
Once you have you model set up, you can add drivers. Those control the hardware (the Arduino, in our case) and tell the motors to actually move, providing a intermediary between the software and the servos.
Finally, you create animations using a timeline. If you'd like, you can also puppeteer your animatronic in real-time. You can even record your puppeteering for playback!
Building Your Bottango Model
There are three important components when building a basic Bottango model:
- Structures
- Joints
- Motors
The structures (default color is blue) represent the physical parts of your animatronic. Joints and motors attach to them. You can also attach them to joints to create moving parts.
Those are primitive solids and you can combine (as parent-child) them to create more complex shapes. You can also import 3D models if you want to match your animatronic perfectly—though that isn't necessary.
Hierarchies
The most important thing to remember is this: the model is hierarchical, with parent-child relationships.
So, if you place one cube as a child of another cube, it will move with the parent. The same is true for joints and motors.
If you want to attach a leg to a body, you would do so using the same kind of hierarchy. So the body would be at the top level, the joint is a child of that, and the leg is a child of the joint.
Joints
When you add a joint (default color is purple), you should pay attention to its orientation and rotation. There is a "preview" button that will wiggle the joint and show you how it moves. If it isn't right, then rotate the entire joint until it is.
You should also define the range it can move. The default is 90 degrees in either direction, but you should change that to match your design.
Motors
The motors (default color is orange) can be a bit confusing and they may seem redundant, but they're important because they provide a link between the software joints and the hardware drivers.
There are a few different types to choose from, but we're using standard servos.
You can technically place them anywhere (they have no affect on the rest of the model), but I recommend putting them near their joints. That makes it easier to keep track of them. If you like, you can also orient them so they reflect your real-world servos.
Motors can be part of the hierarchy if you want, but they don't need to be.
Setting Up Your Bottango Driver
In Bottango parlance, the "driver" is the firmware that the Bottango software communicates with to control the motors.
That is a sketch running on an Arduino Uno R3, in our case. It may even help to think of the Arduino itself as the driver.
Bottango was developed for exactly this hardware, so it works with the Arduino Uno R3 right out of the box. I'm serious, you don't have to write a single line of code!
You don't even need the Arduino IDE, because Bottango is capable of flashing the sketch (firmware) to the Arduino itself.
Define Motor Pins
Before you flash the Arduino sketch, you should first define the pins you're using for your servos.
You can connect the servos directly to your Arduino (in fact, the Bottango documentation recommends that you do). But that makes powering the servos a bit trickier, as the Arduino can't supply enough power to drive servo motors reliably.
For that reason, I think the best course of action is to use an Adafruit servo driver. That can accept external power to run to the servos.
Bottango has provisions for that, so it isn't hard to setup. When configuring your motors in Bottango, just choose the "I2C & Pin" option.
Then, specify the I2C address of your Adafruit servo driver. Mine was 0x40, which is the default.
The "pin" number is unique to each servo and refers to the connection on the driver board. That starts with 0 on the far left of the board, then 1, then 2, and so on.
Upload the Arduino Sketch
Bottango has the ability to upload the code directly to the Arduino, which you can do from the hardware page (click "hardware" at the top right, then "drivers" at the top left).
Plug your Arduino Uno R3 into your computer with a USB cable, then select the port that pops up. Now click "Upload Bottango Driver."
In the dialog box that pops up, make sure to check the option to use the Adafruit servo driver. Then click "Arduino Uno".
Bottango should then flash the sketch to the Arduino and it will be ready to use.
Remember to Turn On Your Drivers!
Before Bottango will move a specific motor, you have to toggle on three switches:
- Master Live (top right)
- The Driver ("hardware," then "status")
- That specific motor ("hardware," then "status")
If you want, you can set those up to turn on automatically when you launch the software.
If your motors still aren't moving, make sure you have a sufficient power supply. The Arduino cannot supply enough power!
Calibrate Your Motors
Bottango will take a guess when you create each motor and will assign it a default PWM range of 1000 to 2000.
However, that range varies dramatically from one servo to the next, even when they're the same model.
Adjust PWM Range
You'll need to adjust those values to match your specific motors and your specific animatronic.
In my experience, that's mostly a trial-and-error endeavor. Adjust the bottom of the range until you're at the threshold of where the motor stops moving, then do the same for the top of the range.
The "home" number should be in the middle between the two.
Link and Match Joints
Now, link each motor to its corresponding joint (using the "Link Motor" button on the joint's configuration).
You'll be able to manually enter the joint range to match the motor's PWM range, or let Bottango do it for you.
If the motor moves in the opposite direction that it should, you can swap the numbers after "Home Y Rotation +" to reverse it.
Adjust Joint/Motor Parameters
If you want, you can make adjustments to the motor parameters, such as how quickly the motors are physically capable of moving (defined as PWM per second).
However, the defaults all worked fine for me.
Animate in the Timeline
Finally it is time for the fun part: animation!
If you head over to the "Animate" tab, you'll be able to access the default animation and its timeline (default: 10 seconds). You can create additional animations if you want, each with a timeline of whatever length you want.
Add Joint Tracks
To move a motor, you first "Add Track" for its corresponding joint.
You'll probably want to add a track for each of the joints, but you don't have to if you don't want to move a joint in this animation.
There are other types of tracks, too. You can, for example, add an audio track so you can sync your animatronic's movements up with a song.
But we're just covering joints.
Keyframes
Bottango uses a keyframe system, similar to digital animation software. Each keyframe stores an explicit position for that joint.
For instance, you might create one keyframe at the 1-second mark with the right leg raised all the way up. Then, you might put another keyframe at the 3-second mark with the right leg all the way down. When you play your animation, Bottango will automatically move the leg from the raised position to the lowered position.
One of the great things about Bottango is that it handles things like acceleration curves for you, so you don't have to worry about them. You can adjust those if you want, but the defaults result in pretty smooth motion.
Adding Keyframes
You can add a keyframe on the timeline for a specific joint in one of two ways:
- By simply moving the joint on your model where you want it to go.
- By clicking the diamond button next to the joint name (great if you want to add a keyframe without moving the joint).
Keep in mind that, if your driver is live and the motor is live, the motor will move as you adjust the joint and/or scroll through the timeline.
Keep going!
That's the basic gist of it: just add keyframes to create explicit positions at specific times, then Bottango will transition from one to the next. Very cool!
Puppeteering
If you want, you can also control your animatronic directly and "record" the movements you make, then play back that recording later.
To do so, you'll need to create a "Live Input Control Scheme." That's basically just mapping input (from a keyboard, gamepad, mouse, whatever) to movement commands for the motors.
Once you have the control setup, you should be able to puppeteer your animatronic in real-time. Click the "Practice" button to puppeteer without affecting the timeline.
When you're ready to record a sequence, just push the red button on the timeline.
That will create a series of keyframes, but with the movements you just made!
Downloads
Finishing Up
Bottango has a feature that will let you export your animation as code to put on the Arduino, so it will run without a computer connected.
However, the Bottango documentation says that that isn't the ideal way to do things and I couldn't get it to work—it would just repeat the first few animation frames over and over.
I ended up having to leave the Arduino connected to a computer running the Bottango software.
There are also provisions for sending commands over a network to a microcontroller development board that has networking capability—something I haven't tried.
But if you need something compact, you could always run Bottango on an SBC (Single-Board Computer) like a Raspberry Pi.
That will let you position your spooky animatronics in strategic positions to scare the neighborhood kids when the come around on Halloween!