- #PROGRAM MOTOR DC DENGAN CODEVISION AVR DRIVER#
- #PROGRAM MOTOR DC DENGAN CODEVISION AVR FULL#
- #PROGRAM MOTOR DC DENGAN CODEVISION AVR CODE#
#PROGRAM MOTOR DC DENGAN CODEVISION AVR DRIVER#
The obvious next step would be to hook it up to a motor driver to supply it with more juice.īut then a little thinkin': I'm only driving it with 5v, and the coil-winding resistance is ~125 ohms. Only problem is that the motor doesn't seem to have all that much torque, which could be due to the fact that the microprocessor will only put out ~50mA per pin.
Two arrays are now defined (clockwise, counterclockwise) and both have 5 elements each to allow for the i+1 entry in the halfStepping function.
#PROGRAM MOTOR DC DENGAN CODEVISION AVR FULL#
Then the second PORTB command sets a second pole (on the other winding) to positive, engaging both windings for 1.4x the torque (and 2x the current).Ī full program listing is attached below. The first PORTB command sets a single pole to positive and all the rest to negative. Void halfStepping(uint16_t delay, uint8_t direction)
#PROGRAM MOTOR DC DENGAN CODEVISION AVR CODE#
Now the part of the code that does the half-stepping looks like this: Can you tell from the video? I'm not sure. The upshot is that for half the time you're engaging both magnets at once.Īnd during the times that both sets are engaged, the motor points halfway between the two, shrinking the angle between "steps" and making the motor turn more smoothly. Half-stepping in a nutshell: Instead of Blue, Black, Red, Yellow, you drive the motor with Blue, Blue+Black, Black, Black+Red, Red, Red+Yellow, Yellow, Yellow+Blue. You get more peak current, more instantaneous torque, and twice the angular resolution. Quest lyric aside, half-stepping your motor is where it's at. If you're really on your game, count the number of steps per cycle to figure out the motor's single-stepping angular resolution. For starters, I selected a half-second delay between steps.
#define DELAY 200 /* milliseconds between steps */ĭDRB = 0xff /* Enable output on all of the B pins */Īll it does is make some nice definitions so I could refer to the wires by color rather than their pin-names, and then it toggles them on in sequence with an adjustable delay in between. * Playing with getting the small stepper motors driven. Hook up the wires directly up to your microproc and burn it up with the following code: If you're not already tooled up for microprocessor programming, you could do worse than the Ghetto Development Kit or any of the various PIC programmers. Maybe you could use this to sense rotation in the Red-White-Blue coil when the Black-Yellow coil is being driven.) It's like it's half-bipolar, half-unipolar. (This motor's strange and doesn't have a center tap on the top magnet coil. You can see that White is the ground for the bottom trio b/c it has half the resistance to Red or Blue that they have to each other. Pictured is my notes from hooking up wires to wires and noting the resistance (or if they're connected at all). You can tell which is ground in a bipolar motor because it has half the resistance to either of the poles than the poles do across themselves. What you're looking for is the common (ground) wire for each half. If you've got a unipolar motor, or more than 4 wires, you're going to have to break out your ohmeter. All you have to do is figure out which two pairs of wires go together. If you're only looking at four wires, you're in luck - it's a bipolar motor. Your motor's going to have two halves, and you can probably even tell just by looking which side each wire belongs to. So you've got five (or four, or six) wires.