Thanks sbright33 I can use this in a sun tracker project I am working on
Let me know if you like it. Any improvements I can make?
sbright33:
I guess there's no interest in the longer PWM version...
I really appreciate your work, and I would be very much interested in trying your PWM version, could you please share it? (possibly with a description of the 8-pins wiring)
I will describe the 8 pins to match the code here:
Uno D2,3,4,5 go to the L298 motor IC like before
9,10,11,13 go thru 1k RES to 2,3,4,5
There are 4x 1uf CAPs between GND and 2,3,4,5
It's a really simple circuit, times 4.
I realize 13 is not PWM, that's a bug, I should use 6 instead, but I have not fixed the original code yet.
This circuit allows the PWM pins to create a smooth voltage with the appropriate time constant.
To use PWM in the code you have to change pinMode of 2-5 to INPUT.
When you change it back to OUTPUT, the maximum speed is not reduced.
sbright33:
I will describe the 8 pins to match the code here:Uno D2,3,4,5 go to the L298 motor IC like before
9,10,11,13 go thru 1k RES to 2,3,4,5
There are 4x 1uf CAPs between GND and 2,3,4,5
It's a really simple circuit, times 4.
I realize 13 is not PWM, that's a bug, I should use 6 instead, but I have not fixed the original code yet.
This circuit allows the PWM pins to create a smooth voltage with the appropriate time constant.
To use PWM in the code you have to change pinMode of 2-5 to INPUT.
When you change it back to OUTPUT, the maximum speed is not reduced.
I will try that, thanks, have you received my PM?
Has anyone used this library lately? Any suggestions for improvements?
Steve, thanks for your work on this; I am moving next 2-3 weeks but plan to use it on a couple of projects shortly thereafter..
Hi sbright33
Your post has inspired me to have a look at my xyz-stepper-setup .. in particular with respect to vibes & resonance, and the effect-output from the steppers. So, I looked at microstepping and 'chopper'-circuit. It sounds very tantalizing, but I already burned a driver and a set of resistors, so I'll have to proceed with some more care. Putting the coil-resistors made a huge difference in effect-outtake and vibrations .. (and 'they' are the ones that's burned out, not the driver ;o) )
I've noticed that you imploy capacitors somewhere in the process .. did I miss some info on where? [edit: ah! you'r using the ic and not a driver where the capacitor likely is imployed]
I've moved time-delays from millis() to micros(). My minimum delay would be 2 millis before the stepper would stop working properly .. it would start resonating noisily, and just that. How far down do you go ( 500 micros ? .. not to insult you, but the presentation of your code leaves something to be desired ;o) ). Some time ago I dropped a pwm-implementation becourse it didn't work (I was trying a quick flip of ENABLE .. no good idea [edit: or?]). How fast (and how) do you flip a pwm-setup?
I've written a 'pen'-class that deals with two steppers (x & z) .. and I'm surprised to find that they quickly loses syncronity. I've delt with it by reducing a few micros on the fastest stepper-delay and it's bringing the problem to a minimum on the few tests I done. Is it a problem you recognize and can comment on?
Anyhow, it's been inspiring
note: I've achtually delt with the 'burning off' the drivers in code .. by preventing one stepper to have too long delays while 'holding'. I'm not sure weather your code needs it, but get an impression from my code: (burnIn sets the max-delay, pause() just sets all LOW). The code is put in a loop where micros() are executed. The code has the syncronicity-variable mentioned above too.
if( (cStepper::oldTime + cStepper::burnIn) < micros() ){
// if delay more than burnIn then holding is abandonned
cStepper::Pause() ;
}// end if oldTime + burnIn
if( ( (cStepper::oldTime + cStepper::mDelay) < micros()) ){
// mDelay microseconds has passed
if( cStepper::stepCounter < abs(cStepper::destination ) ){
// if stepper has not reached destination:
if(cStepper::mVelocity == cStepper::mMaxVelocity){
ad = 5 ; // subtract 5 micros to fastest stepper-delay becourse it lags behind
} ;
cStepper::oldTime = micros() - ad ;
if( HalfOrFull ){ cStepper::Step() ;}
else{ cStepper::StepHalf() ;}
res7 = true ;
}
if(cStepper::stepCounter == abs( cStepper::destination) ){
cStepper::Stop() ;
res7 = false ;
}
if(cStepper::stepCounter > abs( cStepper::destination) ){
Serial.println("cStepper::setTime() exeded" );
delay(100) ;
cStepper::deEnable() ;
cStepper::Stop() ;
res7 = false ;
}
}// end if (oldTime + mDelay) < micros
Has anyone tried it lately? Any suggestions for improvement?
Hi Steve,
I still haven't had time to try this out well; I am in the middle of DC motor stuff on the L298N.
Can you tell me what timer you use, and do you reprogram it's frequency? I'm trying to get my head around multiple libraries using times etc...
Regards, Terry
Not sure I understand your question. I use millis() and microseconds().
Sbright,
This is really helping me. I'm new to arduino. Are you using the resistors and caps for speed control? If I wanted my 28byj to take about 15 1.8 degree steps at timed intervals would it be better to use an ULN2003 instead of the L298N?
Thanks!
Levi
Steve,
I want to give your code a try, as I want to see how well it works in improving the toque on a small stepper I have.
I have a question about the schematic. Are you putting the resistor and cap in parallel and then hooking them up between the input and output pin? Can you explain a bit.
Thanks.
M