NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Project Help and Ideas » Microcontrolled Robotic Arm

August 27, 2010
by hapshetsut
hapshetsut's Avatar

Let me just say first that the Nerdkits microcontroller that i bought has just about been the most useful electronic component i've ever had. And since the guide had an open invitation to send images of interesting things done with said microcontroller, i figured i'd share my most recent project.

It started when i purchased this:

i didn't buy it from think geek, but that was the first Google search result.

I bought it at Hobby Lobby, where it was on sale. It was a pretty neat little kit but the wired controls left me wanting more. Naturally, as the owner of a Nerdkit, the solution to the inferior wired control box was to connect it to the Atmega and run it digitally. There were two engineering hurdles to be over come:

1) how to control five axis (10 switch) movement without using every single output pin, and 2) how to switch the 3 state motor control switches (+3v, ground, -3v)?

The first issue i resolved by running two MCU outputs to an 8 bit counter, compacting 4 motor controls to two pins (since i only had an 8 bit counter, i wired the last 2 directly to the MCU)

The second, with opt couplers linked to transistors in pairs, each pair (as shown in the attached diagrams) linked to a motor, one wired to source current, the other to sink it (thereby controlling the rotation direction).

I wired the whole thing up (my narrative belies the intensity of the trial and error period, which really lasted several hours), programmed the microcontroller to either run pre-programmed movement routines, or to be controllable via the serial port through hyper terminal.

here is some video of the thing in action: it's slightly redundant if you read all the technical stuff up to this point.

to the NerdKits staff: I appreciate your time and effort making this kit so educational and useful!

August 29, 2010
by hevans
(NerdKits Staff)

hevans's Avatar

Awesome! That is a really neat project.


August 31, 2010
by kle8309
kle8309's Avatar

I just saw this video this morning and bought it an hour ago! Can't wait to play with it.

December 01, 2010
by exussum
exussum's Avatar

Does anyone watch The Big Bang Theory ? They had a Very similar thing to this on the Show, that one of the main characters made doing the same sort of motion.

I wonder if they got the idea from this project :O

It was only aired in November.

Great work dude !

June 16, 2011
by wc64
wc64's Avatar

Hi, I'm actually working on a similar project, and was wondering if you had an schematic for how you solved the 2nd issue (the 3 state motor). I've tried watching your youtube video but can't see very clearly the drawings. As of now I'm stuck because I can't get the current to change directions to control the movement.

I should also add that I'm trying to use only one voltage source.

Thanks in advance.

June 16, 2011
by hapshetsut
hapshetsut's Avatar

No problem! The trick for the forward/back/still motor is that you have to have a pair of 'switches' which toggle one pole of the motor between a 'high' and 'low' voltage. With a single supply, these 'high' and 'low' voltages can be achieved by splitting the supply. The simplest (though inefficient) method of doing this is to use a resistive voltage divider to create an 'effective' ground halfway between the two poles of the supply. This method is illustrated here: alt image text

This method is fairly effective but there is a catch! Activating S1 puts the motor and the lower resistor in series, for forward movement. Vice-versa for S2. Since the motor will be in series with a resistor, we want the resistor to be of low value to get the most power to the motor. But, if the two resistors are of some low value, since they are always in series with the supply, they constantly draw an ammount of current: I = V/(2R). This is a huge loss and will drain batteries quickly, so this setup is not very good.

An alternative involves an operational amplifier and a pair of transistors to minimize the current draw. This solution is represented here: alt image text

In this configuration, the Op-amp sets the voltage at the bases of the transistors at half the supply, as before, but now the current (and thus power) through the motor is independent of the values of the resistors, freeing us to make them as large as we want to minimize 'off' current of the circuit. I would say 10k apiece would be good. Strictly speaking, the circuit does not require the op-amp: the divider made of 10k resistors can be directly run to the bases of the transistors. In practice, however, I find that using the op-am tends to make the circuit more stabile.

Additionally, depending on the current -draw of your motor, it may be wise to include resistors on the collectors of the transistors, and potentially one into the motor, if they seem to be over heating.

Be sure that your motor uses the usual inductive load precautions, or else you are liable to smoke the transistors.

Make sure that when writing your code you never run into a situation where both switches are closed (conducting) at the same time, or else you'll short your supply.

Lastly, S1 and S2 are analog switches of some sort (relays, MOSFETs or opto-couplers). I prefer opto-couplers for MCU-motor work, but whatever you use, make sure that your MCU is properly protected from potential inductive or shorting damage from your switch of choice.

Good luck building and coding!

June 17, 2011
by Rick_S
Rick_S's Avatar

An H-bridge is another way to control a motor with forward and reverse. Google them, you'll find everything from home MOSFET built bridges to nice simple IC bridges. They are commonly used in small robotic projects.


June 17, 2011
by wc64
wc64's Avatar

This is very helpful, thanks every one. I'll let you guys know how it turns out.

Post a Reply

Please log in to post a reply.

Did you know that our kits have shipped to hobbyists in 40 countries? Learn more...