Stepper 28BYJ loosing steps

Support for Arduino in combination with Air Manager and Air Player

Moderators: russ, Ralph

Message
Author
marcel_felde
Posts: 159
Joined: Wed May 09, 2018 12:19 am

Re: Stepper 28BYJ loosing steps

#31 Post by marcel_felde »

Will do that, Joe! But since yesterday, my Mega 2560 development board at my office desk has been in use for coding the interior lighting logic for our sim. ;)

https://www.youtube.com/watch?v=HdQfAUjoYfU

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Stepper 28BYJ loosing steps

#32 Post by jph »

marcel_felde wrote: Tue May 25, 2021 2:24 pm Will do that, Joe! But since yesterday, my Mega 2560 development board at my office desk has been in use for coding the interior lighting logic for our sim. ;)

https://www.youtube.com/watch?v=HdQfAUjoYfU
Nice ! :) you gained a subscriber as well :D
I have re-wired the BYJ back to unipolar and am just digging for a 5 way Dupont connector (this time I believe I know where THEY are haha) so can experiment here.
I am out this afternoon and tomorrow - Covid Vaccine for my bride - but will have all the stuff to experiment including the 2 pin Bipolar stepper controller controller to see if there is any difference.
I have plenty or Arduinos on the bench ! - it is just so annoying that I have at least a dozen BYJ units but am damned if I can find them :roll: The one I have here though will be no issue.
I can then also experiment with missed steps in AM with both the BYJ unipolar and ULN controller - the standard unit - and also with the Bipolar conversion and the A4988 in AM. We can then compare notes. I can also try with a faster processor as well to see if it makes any difference - I have the Leonardo and also the Pi PICO here as well as the mega. I think it will be a very useful comparison and test for many.
Joe
Joe. CISSP, MSc.

marcel_felde
Posts: 159
Joined: Wed May 09, 2018 12:19 am

Re: Stepper 28BYJ loosing steps

#33 Post by marcel_felde »

photo_2021-05-26_19-20-44_.jpg
I am building a test gauge meanwhile...

User avatar
Ralph
Posts: 7878
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Stepper 28BYJ loosing steps

#34 Post by Ralph »

Nice work. Is there a calibration sensor as well?

marcel_felde
Posts: 159
Joined: Wed May 09, 2018 12:19 am

Re: Stepper 28BYJ loosing steps

#35 Post by marcel_felde »

No, the scale will be turnable... ;)

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Stepper 28BYJ loosing steps

#36 Post by jph »

Hi Marcel,
Well, here are the results of the first tests...........................

Firstly, on slow speeds - I AM getting the same 'jerky' movement. This is with the standard stepper library with the ULN / Darlington - driver board, the cheap one supplied with the stepper. (AND I can gurantee it is NOT related to the library / Arduino etc)
By slow speeds, I mean 1 RPM or less - as would be needed for an ASI or VSI for example. We can decrease the speed by using dividers on the step per rev etc.
The issue is firmly one of hardware in my opinion. The 28BYJ gearing is simply not precise enough - by not 'precise' I am not referring to the gear RATIO, that would NOT be an issue as we could compensate. I am referring to the poor quality in the actual manufacture of such gears. they are simply not machined well enough to cope with what we need. It is causing hardware binding of the gear mechanism at slow speeds. It can clearly be seen at specific points of the movement. This also leads to missed steps at slow speeds - and by slow speeds, I am talking about speeds that really represent instrument movement speed if direct from the BYJ. For the original use intended for these steppers, then is is perfectly acceptable. But, we are trying to make a silk purse out of a pigs ear.. or -as they say in the North UK.. "you cannot polish a turd"......

This is purely Arduino to the 28BYJ stepper at slow speeds, 0.25 RPM etc.
At higher speeds, it can be ok, I believe that this is due to a small amount of inertia in the movement, and also the interaction of the inductance of the coils.
There definitely seems to be mechanical binding issues.
I don't know if you would agree Marcel but I believe, from experimentation with the 28BYJ with direct needle drive that a figure of around 0.25 RPM is needed to simulated normal slow speed needle movement ?.

Moving to missing steps in AM which is possibly, and I think - probably the case - then the fact that the motor already MISSES steps at appropriate slow speed due to mechanical binding makes it a rather pointless exercise - unless - we use an rpm of the 28BYJ that does NOT miss steps when driven directly from the Arduino - which is possible at higher RPM on a direct Arduino to stepper drive ... even then the results would not be overly helpful as the thing cannot perform at the speeds necessary - the lower speeds.
However, I will set up a 10 RPM or similar setup and adjust the timing so that it is more or less accurate over the 10 revolutions, then maybe 20 RPM etc. I have done this before with direct drive and at the higher speeds I have more or less ensured - with numerical - calibration (not hardware calibration) that it is pretty good. - meaning I can fire off 20 revolutions and ensure the needles is pointing at the original start pos.

When constantly repeatable, I can try the same thing in AM.

Even then, although it may identify an issue in AM. The fundamental issue - at this point - is the motor hardware. - from all my experimentation. (and yes - I HAVE lubricated the gear mechanism with graphite spray etc...) - and for any onlooker who may ponder ( graphite ????) no ! - graphite is not an issue in a stepper ! ....

I have yet to try the bipolar conversion yet I do not think, due to the hardware binding of the reduction gears, that this would 'cure' the issue. - but, will certainly test.

-- Raising voltage - as you have already tried - I can confirm make no difference.
-- The type of Arduino does not even enter the equation here.
My thoughts - SO FAR.. in standard unipolar mode, the 28BYJ is utterly crap for SLOW speed movement with direct needle drive. - slow speed = 1/4 rpm or thereabouts. Which is realistic for a lot of gauges. Some may need even lower rpm ....
For things like fuel gauges etc, then ok... as the speed is not an issue.

Even things like compass units - WITH mechanical calibration, then the very very slow speed movements - will be - most likely - jerky. As to if a user finds this ok ? - well. that is up to them. Although I am sure that, due to the normal delta (rate of change) of the compass heading this would not be noticeable in 99% of cases..

There are a couple of solutions for very sensitive gauges -
Use a nema stepper with a 1:8 or 1:16 microstep with a 4988 or similar.. or, find a 28BYJ that IS mechanically sound and well built. There may well be some ?.. however, I am not personally prepared to buy a large selection of the various breeds of 28BYJs to find one that is ok, and then find that the next order of the same item is not ok.

NEMA 17 is a little large in the space it takes - the standard is 42mm square with varying depths and shaft type / lengths / inductance (hence voltage and current) / torque etc etc -, BUT it is the best compromise in cost v quality as it is ubiquitous in virtually all cnc and 3 print units. You can get 5 for around 22 euro with shipping. these 1.8 degrees per step units. (standard 200 step per rev). driven from a 4988 you can use up to 16 times micro step. There are appropriate math for the max speeds, current, voltage etc etc that are more or less related to the inductance of the windings. I have a spreadsheet I made for most ? - if not all ? the calculations although it may not be the easiest to read as it was for my use only for a specific purpose. ;)

More testing to do, I have a nema 17 (well, loads of them) here so will hook one up to the a4988, after using a bipolar converted 28BYJ to test of course.

Onwards with the tests.................... I think the sun is over the yardarm somewhere so it must be time for a beer after all that......

Joe.
Joe. CISSP, MSc.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Stepper 28BYJ loosing steps

#37 Post by jph »

marcel_felde wrote: Wed May 26, 2021 5:24 pm photo_2021-05-26_19-20-44_.jpg

I am building a test gauge meanwhile...
;)

I already built one.. It took some doing - but 220 Ohms was about right.... :lol:
:mrgreen:
stepper pointer 220.jpg

Joe.
Joe. CISSP, MSc.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Stepper 28BYJ loosing steps

#38 Post by jph »

28BYJ saga update - god knows what number update this is haha .

After - more or less - getting over my frustration with these little buggers yesterday. I thought Hell, let's push it to the max and see IF they CAN be used in some way - AT SLOW SPEEDS !- by slow speeds, I am talking about 1/4 RPM or so. I still have a few ideas.....

Ok, first thing - I have looked at the friction in the drive gears... there is definitely quite a lot due to the gears binding slightly (poor design). It isn't a problem with the shape of the teeth or quality of the teeth, it is the 'deck' height. But I have tried adjusting this - carefully - with a Stanley knife to something that looks fine. Although definitely much better !, there are still issues at very slow speeds - less than before the deck adjustments, but still not acceptable. So, my conclusion as to try finding a 'better' quality unit is absolutely not worth bothering with and would likely be exactly the same at low speed. I don't think there actually IS a 'better' 28BYJ' no matter what price you pay. They are designed to operate AIRCON and similar baffle units. They do this at a fairly high speed. Any 'calibration' is actually allowed for - in the most basic sense - as the final drive gear contains a gear wheel that CAN slip on the output shaft. Hence a final hard stop is not an issue, no matter how many missed steps in the use it was designed for. I have not seen this mentioned before ? - but this IS the case. There are actually TWO calibration factors... driving WELL PAST - hitting the limit - as the steps will simply be missed with load, and also, if necessary, the finally output gear has it's nylon gear wheel able to slip under load. So the unit is bullet proof in the use it was designed for. Cheap as shit, reasonable quality, limited accuracy (due to torque v step). Even then, there is no need, in it's intended use, to increase torque as this would complicate the intended use. ...................................... but for our use ... :shock: Hmmm.. can we overcome these limitations ?

Next step (pun intended 8-) ) - and I am looking forward to this - is trying the unit in BIPOLAR mode with a higher voltage, which should be fine, and due to the increased torque should overcome any friction in the gearing. - but the SHUDDA ? COULDA ? WOULDA ? is all to play for................
This will be using the A4988 with the BIPOLAR modded 28BYJ as opposed to stock unipolar... easy to do ! - no disassembly apart from flicking off the blue cover and cutting a track .... sorted.
Will report back. :shock:

Here are a couple of pics of the 'innards' before trimming deck heights of the gears - which as I said, certainly improved things but did not cure the issue. It NEEDS more torque, which the bipolar mod 'should' do.
28byj gears.jpg
28byj gears2.jpg
When I have exhausted all possibilities I will admit defeat ... :roll: .. but, still a few things to try. I think, as said above, the definite KEY thing is increasing torque considerably (at the stepper unit prior to the 64:1 reduction drive) - not for overall torque of the output as a goal, but for the ability to drive the gearing with no missing steps at slow speed.

The issue of if AM misses steps or not ? is still, at this stage, not even considered. That is a completely separate issue.

Joe
Joe. CISSP, MSc.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Stepper 28BYJ loosing steps

#39 Post by jph »

The Saga of the 28BYJ stepper continues...........................
Ok.. first, apologies for the delay in the updates. Things to do people to see etc etc.
So, first some reasonably GOOD news for a change.
I modified the 28BYJ to full bipolar mode. I then setup the 'CNC V3 Shield' with an 'A4988' stepper driver - this was attached to an UNO. Ok so far.
This completely gets rid of the unipolar setup of the 28BYJ, and also dumps the ULN Darlington driver board for a complete H Bridge stepper controller with fully adjustable current limits and micro-stepping capabilities.
I used the Accelstepper library for the Arduino. The A4988 is a 2 wire control - simply step pulse, and a logic direction. I also used a microstep of 16 which was most important for the smooth output due to the shitty initial resolution of the 28BYJ prior to reduction drive.

First thoughts.... :?:
It is actually quite good - no, let's be fair ! it IS actually VERY BLOODY GOOD indeed. Way beyond my expectations.. - caveat - with a bipolar mod (fairly easy) - a 4988 or similar driver board - cheap as chips - and also, for ease of use - a CNC V3 Shield (again disposably cheap !)

The slow speed is incredibly smooth, the faster speeds are also smooth but i need to test on a faster processor for high speed as we are getting to 2048*16 steps per rev/sec !. yikes !
BUT, it IS damn smooth at slow speeds, which is all that matters really - around 90 steps per second moves the output 1 degree per second. - simply amazing. This should cope with even the most sensitive instrument.
So, a 28BYJ stepper CAN be used on a high precision instrument with the above caveats.

More experiments to follow.

Here is a pic of the 28BYJ bipolar modified frankenstepper with the CNC V3 shield on an UNO with an A4988 driver board - stepper is 5v rated, but running at 12v with current limiting set by the potentiometer on the A4988. All this stuff is DIRT CHEAP !.

(apologies for the image quality I only need my phone to go 'ring 'ring' really) - oh, please ignore the BIG stepper in the background, that is a NEMA 23 unit - not for this project. !!
.
frankenstepper.jpg
Joe

The code I used for this simple test was with accelstepper with the type set to a 'DRIVER' - type 1. This is a very slow speed test.

Code: Select all


  //Test using bipolar modded 28BYJ stepper with CNC shield V3 and A4988 stepper driver ------- Joe

  // Include the AccelStepper library:
#include <AccelStepper.h>

  // Define stepper motor connections and motor interface type. Motor interface type must be set to 1 when using a driver:
#define dirPin 5 // for X axis on driver shield 3 with a4988  --------- Joe
#define stepPin 2 // for X axis on driver shield 3 with a4988 --------- Joe
#define motorInterfaceType 1  // DRIVER (2 pin type / step and dir)

  // define enable pin for CNC shield V3 - Joe - effects ALL axis as they are commoned. Pin 8 - active LOW
const byte CNC_ShieldV3_enablePin = 8;

  // Create a new instance of the AccelStepper class:
AccelStepper stepper = AccelStepper(motorInterfaceType, stepPin, dirPin);

void setup() {
  // Set enable pin to output and pull it low to enable all axis on the shield.   - Joe 
   pinMode(CNC_ShieldV3_enablePin, OUTPUT);
   digitalWrite(CNC_ShieldV3_enablePin, LOW);
   
  // NOTE !!! you will be severely limited in speed on the UNO - probably to around 3 to 4 thousand steps per sec ?
  // Use a far faster processor such as the Mega, - preferably the ESP32 / DUE / etc. ESP32 is cheaper - Joe
  // Also, it is a fine balance between current limit and startup as too high a current - to enable startup at high
  // revs means the motor will tend to overheat at very low RPM - a fine balance but workable.
  
  // Set the maximum speed in steps per second: 
  stepper.setMaxSpeed(10000);
}

void loop() {
  // Set the speed in steps per second
  stepper.setSpeed(100);
  // Step the motor with a constant speed as set by setSpeed():
  stepper.runSpeed();
}

it IS possible to use AM directly - although I have not tested this yet - using the VID66-06 Hw stepper motor add
https://siminnovations.com/wiki/index.p ... VID66-06_2

I have mentioned this before, but I believe this needs to be changed to 'generic industry stepper driver' as virtually ANY reasonable stepper driver out there uses a simple step pulse and logic direction. The VID66-06 is simply one of hundreds.

Can AM keep up ? I have no idea. I am simply giving the hardware the 'once over' before testing in AM. If it is not ok in arduino direct, then there is no point testing in AM. So far, with this evolution, it is pretty damn good. Which I am rather surprised to say.
Joe. CISSP, MSc.

Post Reply