Arduino Week 2: Playing with Servo Motors

My Arduino Project Musings… I like Musing

Read if you want, or skip down to the project diagram, pictures, code, and videos.

This week in Arduino, we were challenged to use a new component in our Arduino project. I chose to try controlling a motor. Why? Because Arduino fundamentally reminds me of building Rube Goldberg machines for my high school science olympiad team.

For regionals, we were challenged to create this machine which had to have several different types of transfers of energy, mechanical, electrical, chemical etc. It had to do something really simple, in a really complicated way – the nature of Rube Goldberg machines.

Obviously that isn’t the point of Arduino, but upon first opening the box, I was reminded of having to build this machine at 16 – knowing nothing about building anything really – and wishing I had had Arduino components at the time to help out – especially motors! Funny story, we actually had to send someone’s older sister to a sex shop to pick up a vibrator because we needed to hack it’s motor to shake a rattle for the machine…

So with this in mind, I wanted to make a motor do something. Servo motors – which rotate 180 degrees – immediately brought a bunch of ideas to mind. As I keep reading, making Arduino isn’t just about wiring things into a board, it’s about building a project around them. So, I thought, what the hell can I do with a motor that goes 180 degrees? Break an egg? Hammer something? Knock something over/out of place? Hmmmm…

My first thought – being a huge nerd – was to build a catapult using the motor. A catapult goes from 0 to 180 functionally, and I could wire up a potentiometer to set the angle, and a button to make the motor go from 0 to whatever angle and fire. Butttt…. from just playing with  the motor a bit, I realized it isn’t very strong, and doesn’t move very fast. I needed tension… Back to the drawing board!

So, first try with the motor, I wanted to hook up some thread to the little holes in the attachment and see how far I could pull something with tension using a potentiometer and how that would work. Hence my first project, building an old-school stick style trap. You know, the kind where some rabbit wanders up to eat celery under a bucket propped up with a stick and the person hiding in the bushes pulls a string… BAM rabbit trapped? Unfortunately, I didn’t actually have a rabbit lying around… but I did have Jason the Green Power Ranger figurine – did I mention I’m a huge nerd? So, Arduino take 1, trapping Jason the Green Ranger! This actually did happen in the show… so they could make him not evil and be the nice hot White Ranger later on… Just saying….

Circuit, Pictures, Code & Final Videos

First, here is my circuit built with Fritzing. It is the same circuit for both projects.

Catapult Trigger_bb

Also here is a link to my GitHub code for both.
IMAG5283

IMAG5284

The circuit is very simple, just hooking up the motor (which goes from 0 to 180 degrees) and the potentiometer (which goes from 0 to 1024 in value), telling them to talk to each other through a serial read from pin A0 (the Pot) and sending values to Pin 9 for the motor. Also a quick mapping of the Pot range to the Servo range. Aka saying how far for motor to move in degrees for how much change in Pot value (1024/180 = 5.68 change in voltage/degree). I also learned – from my Arduino projects book – that you have to put in 2 capacitors, because a motor draws on the current in your circuit at a variable rate.The capacitors regulate this by storing up and releasing the energy when needed – keeping the rest of the circuit working nicely.

Project 1: Trap Jason the Green Ranger!

Worked pretty well but this is actually the 4th video b/c I learned that motors are great, but you have to set the tension just right in terms of distance, and you need to anchor down both the motor and whatever it is you are trying to pull from…

Project 2: Servo Catapult Trigger!

And for the next iteration, I wanted to make a catapult and use the servo to pull the firing pin! There are a billion versions of making this catapult on the internet, concerning the construction of it with rubber bands, a spoon, binder clips, and popsicle sticks. Off to Michaels I went, and build it I did! I also learned my lesson and hot glued both it and the platform for the motor (but not the motor itself, I tied that) to a big foam board for anchorage.

Such a fun week! Stay tuned. I’ve been thinking a lot about electromagnets this week, and think I have a pretty fun final idea ready to go!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s