Controlling NXT Servo with Arduino

Hi. I have an Arduino + An NXT Motor and nothing else! :astonished: What I'm trying to do is to connect the NXT servo motor to Arduino, and control it using written libraries for this purpose. 8) I already have the libraries, but my problem is the circuit part. As you might know, NXT motors have a wire that looks like a cat-5, and connects them to the NXT Block (which is the programmable brain of NXT Lego), but Arduino doesn't have such thing. :~ On the other hands, my time is too short to buy an online product. I need something that works with just an Arduino, a bunch of necessary electronic components (like wire, resistor, etc), and an NXT Servo motor. Any ideas?

pinout of the "phone-looking" cable here: http://mindstormsnxt.blogspot.com/2006/08/whats-inside-nxt-brick-part-ii.html

according to this: http://virtuallab.kar.elf.stuba.sk/robowiki/index.php?title=Measurements_of_NXT_motors "MA0, MA1 - "PWM" output signals to actuators GND, POWERMA - optional power source for embedded devices TACHOA0, TACHOA1 - internal rotation sensors The MA0, MA1 are ... simply connected to two poles of a DC motor so that they can drive it forward or backward depending on changing polarity."

so id try hooking 5v to MA1 and GND to MA0, this should activate just the DC motor inside. and then MA1 to GND and MA0 to +5v and the motor should go the other way. since these go direct to the DC motor, you CANNOT power it from arduino pins :)

POWERMA is only needed, i think, if you want to use TACHOA0/TACHOA1 for accurate positioning of the servo, otherwise the motor has continuous rotation with no feedback. For feedback, possibly: GND to GND of arduino. the POWERMA is 4.3V rated so 5v MAY work or it MAY fry it. i don't know. it depends what type of circuitry etc is in the servo. then try TACHOA0/TACHOA1 pins with some quadrature encoder code.

Hi thanks for the reply! I'm definitely gonna do it, but say... How can I use it like a servo?? It's not necessary, but I'll appreciate it if somebody can give me a method.

implement a quadrature encoder in code based off of the two TACH0A and then you'd need a motor driver. then you can measure how far the "servo" has turned with the encoder, and then use the motor driver to tell it when to stop etc. so you'd most likely have to buy something :P

here is some quadrature encoder code i made: http://dduino.blogspot.com/2012/01/hdd-rotary-encoder-with-interrupts.html

Well, I'm not able to buy anything anymore since I'm taking my robot to a contest this Saturday and it should be ready by then! :) But Thank you! You saved me... :D

Hi isn't there possibly any way to use TACHOA0 & TACHOA1 with just the Arduino? If I was able to support the motor with Arduino digital pins, I'd be able to alternate the current and make it go back & forth and stay in the same place without getting loose! Unfortunately, these digital pins of Arduino don't provide enough voltage and I have to use TACHOA0 & TACHOA1. If there's any way to use the digital pins, just to turn the DC motor on/off, it would do for me (well, without a motor controller or some other large electronic components :) ). Any ideas?

you could maybe use a PNP or a NPN or similar. teh motor uses 700ma normally and 1A max so make sure it can handle it. a 2N2222 might be a little low.

what's your recommendation for the transistor? Or is there a way to calculate what I need?

you need a transistor that can handle 1A constant, this is where im not so sure what exactly you need. a quick Google gave: http://parts.digikey.com/1/parts/1004362-transistor-npn-1-5a-80v-to126-bd13916stu.html 1.5A but i have no idea on the rest of the specs. maybe a MOSFET would be better. someone else with better electrical knowledge could help you.