Quantcast
Channel: Jeroen Swart - Micro .NET
Viewing all articles
Browse latest Browse all 4

Netduino - Getting Started with steppermotors, shieldless

$
0
0

In my previous post, I explained how I used the Adafruit motorshield to control a steppermotor. Since this shield uses a shift register, it needs a lot of I/O-actions. To control the steppermotor without a shift register, I put together part of the motorshield schematic on a breadboard. What remains is a single L293D with a few supporting parts, as shown in the schematic below.

You can put the schematic together on a small breadboard. Connect D0, D1, D2 and D3 to the corresponding ports on the Netduino. Connect all grounds to the ground on the Netduino, all the VCC to the Netduino 3.3V and the Vin to the Vin of the Netduino. The power of the adapter will be on Vin, powering the motor. The image below shows my result.

I changed the library for the motorshield, used in my previous post, to work with the schematic above. You can download it here. The library only supports steppermotors and it only provides support for single, double and interleave step-types. Pins D0 - D3 are used by default, but you can use any of the digital I/O pins by providing them to the constructor of the Stepper class.

The sample program that comes with the library download does the same as the sample program in my previous post: it initializes a stepper motor with 200 steps per revolution (or 1.8 degrees per step) and then repeats a few forward and reverse 360 degree rotations for each supported step-type. An example of initializing the motor and moving it forward is shown below.

Stepper stepper = new Stepper(StepperPorts.M3_M4, 200);
stepper.Step(200, MotorDirection.Forward, StepType.Single);

But… does it increase the speed of the motor? Well, yes and no. For one motor it does, and for another it doesn’t. The first motor I tested (200 steps per rotation; the one in the image above) runs at 1.36 rotations per second using the shield and at 2.46 rotations per second without the shield, so using the direct control almost doubles the speed. The second motor (a small one with 48 steps per rotation) runs at 5.68 rotations per second with the shield and at 4.04 rotations per second without it, so slowing the motor down by almost 30%.

Of course, the measurements are hardly scientific, and I only tested two motors. I ran each motor for 10 full rotations and recorded the time that took. I did this 10 times for each step-type and calculated the averages.

However, there are some issues with this approach at the moment. Running the step-loop at the highest speed doesn’t move either motor one bit or they just shake somewhat. I had to put in a minimum wait-time of 1 msec after each step to get the motors to rotate. Another problem is the decrease in torque. I need to take a good look at the pulses that come out of the output-pins. Each part of the H-bridge is now controlled one after the other, instead of all at the same time (by setting up all the right output levels first, then providing them to the H-bridge all at once). I want to have a look at this, as soon as I can get my hands on an oscilloscope :-).

It’s not really the result I was hoping for. I’m looking for a speed of about 50 rotations per second. I’m planning to use NEMA 34 motors, which can do that easily. I’m not yet sure what’s causing the issues, but I do know that controlling the pulses directly with the microcontroller will not get me the high speed I’m looking for. One solution could be the use of an L297 chip. This is a steppermotor controller that turns two signals, a clock pulse (e.g. generated with PWM) and a direction signal, into the correct pulses for the H-bridge.

Next: working with LCD.


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images