Friday, 27 November 2015

Portal Gun Build - Choosing Components Part 3

Portal Gun Build
Choosing Components Part 3 – Motion!

For Part1 – sound and Part 2 – lights see my Facebook page https://www.facebook.com/BlueRoseCosplay/

Ok so you want your prop to move. Well before you can choose what sort of motor you want to use you need to work out how exactly you want your prop pieces to move relative to each other. For the portal gun this is pretty simple, I want the barrel to slide in and out of the body of the device when it fires. I want the movement to complete in around 0.5 to 1 second. Now most motors spin, they don’t slide. The type that do slide are called linear actuators. This was where I looked first but I was unable to find one that would be fast enough and small enough for the task. They are mostly built for slow high force applications. So I went back to looking for a spinning motor.

Now if you have ever looked for little motors you might have been surprised by the number of different types available, and the jargon can be a bit daunting. The standard hobby motor of the sort you find in remote control cars and even your electric toothbrush is a dc motor.
Look familiar anyone?

DC stands for Direct Current which means a steady flow of voltage and a DC motor is one which will just work if you attach it to a battery as you would a lightbulb. AC motors are designed to be driven by the same type of power as your wall socket provides, though I wouldn’t recommend just plugging them in. This is Alternate Current and it has a constantly changing voltage that if you graphed looks like a wiggly line. It looks a little more complicated and it is, for hobby applications DC is fine and simpler.

AC and DC voltages

However there is a big but here which meant neither of these would do for me. These motors are either on or off. You can control the speed by changing the voltage you give them (e.g. two batteries instead of just 1) but you cannot tell them to move only a certain amount or turn to a certain position. So if I want the barrel to move outwards a little then inwards a little then stops, I need another option or a kind of doorstop for the motor when it reaches its final position.

Luckily there are motors out there that you can tell to move a certain amount; Servo Motors and Stepper Motors. Servo Motors have a thing called feedback which means you can even ask the motor what position it is currently in. However but you cannot tell servo motors to move more than a single full rotation. There is a way to modify them for continuous rotation but that involves taking the motor apart and doing some hacks and ain’t nobody got time for that! Actually it’s pretty simple but I'm too lazy and you still can’t tell them to move more than 360 degrees at once. Stepper motors can be told to move any amount but you have to assume the start position is where it was last and that nothing will block the motors while they turn. Still better than a DC motor so I bought one of them.


Even when you narrow it down to Stepper type motors there is still a lot of choice

Which one? Adafruit has a several page long article about choosing a stepper motor. It starts from the basics of how they work and goes into everything you might want to consider. You can find it here: https://learn.adafruit.com/all-about-stepper-motors/what-is-a-stepper-motor

For my abridged look there are four things to consider with stepper motors, speed, size, resolution and torque. Speed and size are easy to understand, although speed is often given in RPM. If I want the full portal gun motion to take place in under a second I need between 60 and 120 RPM. I got 50 because I had to compromise a little for size and torque but it's close enough.

Torque is a measure of the strength of the motor. The one I bought had 2kg*cm holding torque per phase. Sound a bit confusing? Well finding out how many phases sure is. Turns out it can be worked out with how many wires and whether the motor is bipolar or unipolar. This one is bipolar and has 4 wires so must have 2 phases. Adafruit’s article on stepper motors has more on determining how many phases your motor has. To understand the torque then just imagine you connected a 1cm (the cm in kg*cm) radius wheel to your motor. You put it on the ground and tell it to hold position (holding torque). You need to apply the equivalent of 2 kg * 2 (the number of phases), so 4kg to make it move. I want 4cm range of motion so I will use a 2cm radius wheel. So look at the measurement like 2cm*kg, per phase. It will be able to hold 2kg with this setup. Plenty to move the barrel of a portal gun but not much to stop it shifting if someone bumps it. I will still need to add a lock for when it is not moving. Note there is a gotcha using this maths, Stepper Motors have their highest torque at their lowest speeds so you will want to get one with more torque than you calculate to be just enough.

Finally resolution is how smoothly it will turn. A resolution of 200 steps per revolution is pretty common and will look smooth at almost any speed, lower resolutions need to be turning at faster speeds to look smooth.


All that and it eventually lead me to choose a motor: this one https://www.adafruit.com/products/324 
Since there was quite a lot involved in motor decision I will make the next post about driving it. I'm looking forward to testing it out!