Let's Make Robots!

Accelerometer controlling 2 servos

Good Evening Everyone, 

What I am trying to do is use an accelerometer (http://www.sparkfun.com/commerce/product_info.php?products_id=847) to control two seperate servos (http://www.servocity.com/html/s3003_servo_standard.html), I was thinking I would use this microcontroller (http://www.sparkfun.com/commerce/product_info.php?products_id=666). (Are these all compatible?) 

The idea is balance a platform in a dynamic equilibrium with the two servos, as on if it rotates clockwise (0 to 90 degrees) in the x axis, it would move servo a in the positive direction, and servo b in the negative direction.

likewise on the same x axis if the platform rotated counterclockwise, servo a would move in the negative direction, and servo b would move in the positive direction.

Also there will be movement in the y axis(0 to 90 degrees). In a manner such that if the board starts to rotate forward servos a AND b will both move in the positive direction, and if it starts to rotate backward, servos a AND b will both move in the negative direction.

Will the microcontrolled be able to accept those signals and send out the proper balance to each servo? (As in there will movement in x and y axis at the same time, which will mean each servo has two inputs)

For example if movement in the x axis tells servo a to rotate 30degrees clockwise, but movement in the y axis tells it to move 15 degrees counterclockwise, will the end result be a rotation of 15 degrees clockwise like I need it to be?

 

Hope this can be understood.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hey fellas, another quick question regarding wiring connections...

I understand how to supply power to all the components when using a breakboard, but what is the best way to do this on a final project? Is there some sort of "splitter" to divide the power wire up, or run multiple wires from a single wire???

 

Thanks Again

Hey guys real quick just looking at the adxl335 breakout board, how do you connect to it? Are there ways to do it other then soldering to the board? Can you use headers somehow?

You have to solder to it somehow, even if your're using headers. the advantage of headers is that you can easily plug in or out the component.

You can connect it to a bread board or extension wire with matching sockets

Alright cool, thanks again for all your help voodoo and lex lee, probably start ordering parts soon and testing.

Hey Guys here is a schematic I made for this system. As you can tell my electrical sense is not the best. If anybody can take a look over it and point out any mistakes or improvements. I would really appreciate it.

Here are the components involved

Microcontroller

http://www.sparkfun.com/commerce/product_info.php?products_id=666

Accelerometer

http://www.sparkfun.com/commerce/product_info.php?products_id=9269

Servos

http://www3.towerhobbies.com/cgi-bin/wti0001p?&I=LXH288&P=ML



so I'll use the onboard regulators, though I'm quite sure that's not a good practice.

For your application, I think you'll only need 2 of the 3 axes. Find out which 2 you need and modify the codes.

 

 

I don't see why it would be bad practice. place some caps by the servo power leads and that should help with any spikes/noise you might get.  I think this drawing works perfectly for what the OP was looking to do. Great work!  :D

Second servo would be hooked up the same way this one would(different pwm pin though).

Bad practice because if the onboard regulator is burnt, it's more troublesome to change it, as compared to an external regulator

I guess this is why you should be mindful of the current draw on your regs as well as the limits, but that goes without saying.  External regs would be a pain as well as you'd have to replace it from whatever locatoin it currently resides even if it's not on the main board, it's still a pita to replace.

It's not bad practice if you do pay your mind to these details....which you should be doing if you are playing with electronics. When you fry it, thats a lesson to learn as well....  :D

 

I've learnt my lesson from the BS2, which is almost impossible to replace the regulator on the small chip.

Thankfully, that's my only experience with frying, for now at least =D