I have a robot that I need to be moved with stepper motors so that it can have fairly exact movements in a clear environment, I am looking for some help with what I did wrong and some steppers to buy that could fit within my current setup with minimal change. If it wouldn't be too expensive, I could rework the whole setup, even to another type of stepper, but I would prefer not two. I have also searched the forum already,
I set up a circuit on my breadboard with an atmega168 controlling two steppers from an Epson printer via 4 NJM3717 drivers.
Data sheet:
www.ortodoxism.ro/datasheets/newjapanradio/ee04004.pdfI am using the example setup from the data sheet, with I
0 and I
1 connected to one control pin and PHASE an other.
This is my code, the macro PORT_TEST is true if the given pin is on, and false otherwise, hope the code is not undecipherable (I am self taught)
void motorStepForward(int i){
static IOPin ioPin;
ioPin = ioPins[i ];
Toggle current, and possibly phase for coil A
PORT_TOGGLE(*ioPin.port, ioPin.pin + 1);
if (!PORT_TEST(*ioPin.port, ioPin.pin + 1)){
PORT_TOGGLE(*ioPin.port, ioPin.pin);
}
//Toggle current, and possibly phase for coil B
PORT_TOGGLE(*ioPin.port, ioPin.pin + 3);
if (!PORT_TEST(*ioPin.port, ioPin.pin + 3)){
PORT_TOGGLE(*ioPin.port, ioPin.pin + 2);
}
}
I got the motors to sort of work; however, there were some very interesting things that I don't think should have occurred.
- Very little torque, next to none
- I could change the direction of the spinning just by manually setting in the new direction (this was actually really fun
)
- Some time near the end of my
playing testing of the motors, some internal connection broke (no connection between A and A' anymore)
Some other facts:
I powered the motors at different times from unregulated 4.8V and 9.6V, though the drivers I used were meant for 10V to 45V
I am limited to 9.6V, as this robot is for a competition with that as a limit.
There are others on this forum with the same event, Robot Ramble, regulations:
https://www.lakesideschool.org/upperschool/community/ScienceOlympiad/rules/RobotRamble.pdfThanks,
Mad High school Freshman