Better stepper motor to try

303 views
Skip to first unread message

Lex Kravitz

unread,
Jan 2, 2020, 12:00:35 PM1/2/20
to FEDforum

Hi all,

I've been playing with a different stepper motor and I've been having good results that I wanted to share.  It's a drop-in replacement and only costs $2 if anyone wants to try swapping the new motor in. Please write back if you try it!  The short story is that we’ve been using this stepper since the original FED1 design:


  https://www.adafruit.com/product/858

 

It is a 5V stepper with 1/16 gearing (each turn of the interior motor turns the exterior brass cog 1/16 of a turn).  It works well but is pretty low torque, so it has trouble clearing jams when they occur.  (Side-note, we specifically chose this motor for its low torque, after testing several higher-torque servos that would grind up pellets and cause major jams in FED2.)


Anyway I recently found that these “28BYJ-48” motors are more commonly made with 1/64 gearing, which is a higher torque arrangement (each turn moves the brass knob only 1/64 turn). They can be found from many sellers on Amazon for ~$2 each, and they are exactly the same form factor as the Adafruit version, just different gearing. They require a slight tweak to the code to use, as now each command to the stepper - ie: stepper.step(15) - only moves  the motor ¼ as far as with the 1/16 gear motor.  However, it moves with ~4x the torque!  So you just change each stepper command in the code to turn the motor 4x as far.  To make a long story short, I updated the code to accommodate the new motor and include a new "high torque" jam clearing mode and it’s working really well in my first testing.  New code here.  I've only set up one FED3 like this so far but that device has been running for 6 days without a jam, dispensing >1200 pellets J  I hope to get a few more going next week for a more thorough test, but I wanted to share this result now.



Happy New Year!

-Lex

Amy Sutton

unread,
Jan 14, 2020, 7:54:32 AM1/14/20
to Lex Kravitz, FEDforum
Hi all,

I've gone all in on the new motors and have had great success! Previously, we could not do free feeding for more than one day without many of the FEDs getting jammed/batteries need changing. Now, I have 18 FEDs set up with the new motors, and I set them up over the weekend without adjustment for ~65 hours. As you can see below in an example graph, many of the FEDs are working quite well, and mice learn quickly to eat out of them. A couple of the FEDs jammed (~5/18), suggesting that we need to check on FEDs maybe 1x/day to clean them out, make sure the discs aren't hitting anything, and replace batteries. I presume that these FEDs just need minor adjustments in the way the pellet discs are sitting. 

Thanks to Lex for the heads up on this! I can't recommend switching to the new motors enough. 

Amy

image.png


--
You received this message because you are subscribed to the Google Groups "FEDforum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fedforum+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fedforum/ea6bc765-0380-4100-ab25-e7b53c0dcaf1%40googlegroups.com.

Amy Sutton

unread,
Jan 14, 2020, 8:07:17 AM1/14/20
to Lex Kravitz, FEDforum
Someone just requested to see motor turns as well, so here's an example of a working FED and a jammed FED with motor turns and mouse retrieval time as well.

FED working well: 
image.png
Jammed FED: 
image.png

Matthew Luby

unread,
Apr 23, 2020, 2:24:14 AM4/23/20
to FEDforum
Hello Lex,

I am trying to troubleshoot a FED3 that I seem to have correctly assembled.  We are using this stepper motor (28BYJ-48) and it is vibrating when it should be rotating. I have used the forward and reverse Fixed Ratio 1 programs for testing purposes; the screen is recording beam breaks accurately and activating the motor only on the correct side until a beam break is detected in the center. I have attached a log from the last time I attempted to run the program (using the 12-26-2019 iteration of the script; I have tried the 12-05-2019 and 10-17-2019 scripts as well.)

I noticed in another thread that the batteries take ~44 hours to fully charge; I have had this problem with a battery showing ~3.7 V (3.68 V on a voltmeter) and with the USB cable plugged in.

Are there any recommendations you have for addressing this problem? I'm currently reviewing the code to see if there are any adjustments I might be able to make, but I suspect the issue is electronic in nature.

Best,
Matt Luby
FED000_042320_03.CSV

Lex Kravitz

unread,
Apr 23, 2020, 8:28:10 AM4/23/20
to FEDforum
Hey Matt,
Thanks for writing!  3.7V is fine.  The motor won't turn at all on USB power alone, but as long as you have a battery in there with some juice it will work.  Two questions on this troubleshooting:
1) Did you get the motor from Amazon or Adafruit?  Despite having the same model# (28BYJ-48) they can have different gearing. All of the Amazon 28BYJ-48 motors I've seen are 1:64 gearing (which is what we want!) while the Adafruit's 28BYJ-48s are 1:32.
2) Can you see what happens if the motor is not in the FED? Is it possible the disk is rubbing against the wall of your print and stopping it from advancing fully? 

The motor is supposed to move forward ~10-15 degrees and then do a little vibration. The vibration enables pellets to settle so if there's a pellet impeding the hopper mechanism it doesn't just keep pushing forwards against it. The relevant lines of the code are in the "Feed" tab, lines 23, 33, and 35.  (The function stepper.step moves the motor). 


Talk soon! -Lex

Matthew Luby

unread,
Apr 24, 2020, 12:39:47 AM4/24/20
to FEDforum
Hello Lex,

I've charged the battery for 8-12 hours total now and the stepper motor doesn't rotate on battery power alone or when connected to USB. To answer some of the other questions:

1) I'm not sure where we sourced it, but we got a box of five 28BYJ-48's under the Elegoo brand. According to the data sheet, it's reduction ratio is 1/64 (full sheet below:)

IMG_20200424_001936204.jpg



2) The unit is not in the FED housing, though our prints probably will need a small amount of sanding for a slightly larger tolerance.

I'll try to get the stepper to work independently with a simple circuit. Is is conceivable that this could be a result of too much solder on a lead somewhere? Would it be useful to record the voltage difference between the pins that the motor connects to?

Best,
Matt

Lex Kravitz

unread,
Apr 24, 2020, 9:24:05 AM4/24/20
to FEDforum
A few thoughts:
1) I think your battery is charged enough.  It is likely not a power issue.
2) Keep testing with the motor not installed in the 3D print, we should make sure the motor is working before installing it and possibly having a different issue of 3D printing tolerances.
3) Can you confirm - does the motor not rotate at all (ie: no movement)?  Or in your previous post it sounded like you had it moving but it appeared to just vibrate back and forth and not advance forward?  Here is the movement it should be making.  How close is yours to this?

4) Here is some minimal code to move the stepper - can you flash this onto the FED and see if the motor spins backwards and forwards?  These are larger steps that the actual FED3 code takes, ~1/2 rotations in each direction.  It should be really obvious, can you see what happens if you flash this code onto the FED?

#include <Stepper.h>
Stepper stepper(200, A2, A3, A4, A5);

void setup () {
  stepper
.setSpeed(120);
}

void loop () {
  stepper
.step(1000);
  stepper
.step(-1000);
}



Talk soon!

Kevin Myers

unread,
Apr 24, 2020, 11:48:10 AM4/24/20
to Matthew Luby, FEDforum
Hi Matt, I've used many of that same Eleego brand of motors in other non-Fed projects too.  A couple times in those projects I've had similar problems that were entirely due to soldering issues.  If you have a few motors on hand I'd first just try connecting another motor to your FED to be sure it's not an issue with the specific motor (though I've used dozens of those Eleego motors and never had a bad one).  Sorry if this is already super obvious but did you verify you have the 5-pin connector from the motor is plugged in in the correct orientation (note the color code of the wires)? Having it connected backwards would jam the motor. If all that checks out I'd guess the most likely culprit is soldering - either a poor solder connection on one pin or a glob of solder that's bridging two pins and creating a short circuit.  I like to use a dissecting microscope to check my solder connections though if you're working from home I'm assuming you don't have one in your kitchen. There are tons of decent Magnifier apps you can install on your phone to do a close up inspection. The connections to check closest would be: 1) the joints between the FED master board and the 5 male pins you connect the motor to, 2) the female headers the on the board that the motor driver board plugs in to 2) the female headers that the Adalogger sits in, most especially the connections for pins A2, A3, A4, and A5 which are the pins to activate the motor.  If you don't see any globs bridging two points it could be a poor connection made by solder that was not hot enough and isn't "sticking" tightly to the pin. Sometimes a solder joint that looks ok to the naked eye can be making poor contact on a microscopic level.  Simply re-warming each joint can often fix a poor connection (be sure the soldering iron is heating both the solder and the pin).  A motor that vibrates but doesn't turn is getting power but probably isn't getting the correct pattern of on-off signals that makes it turn smoothly, and a poor connection on any one pin could do that.  My apologies if this is basic info you know already. Personally I had to improve my own soldering skills to make mine work. Hope this is helpful!  
Kevin


--
You received this message because you are subscribed to the Google Groups "FEDforum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fedforum+u...@googlegroups.com.

Matthew Luby

unread,
Apr 24, 2020, 6:24:36 PM4/24/20
to FEDforum
Hello Lex,

After trying your suggestion, I double checked myself on every step of the instructions.

As it turns out, it helps if you don't solder and attach the motor breakout upside down. I just soldered one correctly and got the stepper to rotate something in the range of 10-15° using the 12-26-2019 FED script. I still need to do more testing to make sure it's dispensing pellets correctly, but the motor issue seems to be resolved.

Thank you for your help. If nothing else, hopefully anyone else who makes the same mistake can figure this out sooner.

Best,
Matt Luby

Lex Kravitz

unread,
Apr 25, 2020, 11:59:16 AM4/25/20
to FEDforum
No worries I've done that too!  Thanks for replying with the resolution, and good luck with the rest of the build!  -Lex

Matthew Luby

unread,
Jun 10, 2020, 9:47:35 PM6/10/20
to FEDforum
Hello again!

Our builds have mostly been successful, with 3/4 functioning as expected. Our last unit, however, is having a peculiar issue with the motor.

Specifically, it is not always rotating correctly when one of the sensors triggers a pellet delivery (tested with Fixed Ratio: 1 and FR1 "reverse," so I don't think it has to do with the sensor or the mode itself.) It is worth noting that some of the time, it does rotate correctly: "jam clearing" is functioning correctly but "dispensing" does not rotate the arm of the motor (though I can feel it vibrating.) Do you have any recommendations for how I might try to troubleshoot this issue?

Best,
Matt Luby

On Thursday, January 2, 2020 at 12:00:35 PM UTC-5, Lex Kravitz wrote:

Lex Kravitz

unread,
Jun 10, 2020, 10:38:44 PM6/10/20
to FEDforum
Hi Matt - first few things I'd try:
1) Can you remove the pellet disk and see if the motor is turning correctly? It's possible the pellet disk is rubbing on the side of the pellet hopper so it can't turn, but the motor still tries.
2) Can you try with a different motor?  It's possible you have a bad motor.
3) Can you make sure the battery is fully charged?  The motor draws current from the battery, and if it's almost empty it can become weak, resulting in behavior like what you're describing.

Let me know! -Lex

Matthew Luby

unread,
Jun 10, 2020, 11:35:34 PM6/10/20
to FEDforum
Hello Lex,

1) Unfortunately, removing the pellet disk did not resolve the issue or alter the character of the rotation.
2) I have tried with a different motor, in addition to swapping this unit's motor with functioning units' (the motor in question works correctly with our other FED3's.)
3) The battery isn't fully charged; it's at two bars, and it does seem to elicit the proper action in our other FED3's.

Can you think of any other possibilities? I ended up desoldering and resoldering many of the parts due to issues on the very first assembly attempt (I used a conductive epoxy before our soldering iron shipped.) Are than any particular connections it would be worth removing the solder from and soldering again? I'm fairly certain I tested each of the breakout boards in other units to confirm their individual functionality, though I will probably be doing that again soon if only as a sanity test.

Thanks for the fast response!

Best,
Matt Luby

Lex Kravitz

unread,
Jun 10, 2020, 11:44:59 PM6/10/20
to FEDforum
Hi again,
Based on the soldering/desoldering you describe and that it works some of the time it seems like it could be a loose solder joint.  If any of the traces coming from the motor are not making a strong connection it could cause the motor to be weak or unreliable as you describe.  The motor has two coils that energize so if either/both aren't receiving a strong connection that will result in poor motor performance.

To track the issue down furthe rI would first swap the motor with one you know works, and then swap the TB6612 motor driver board with one from a working FED.  If it starts working normally you'll know which part is bad pretty easily.  You can then also try swapping the motor and TB6612 board from the malfunctioning FED3 into a working FED3 to confirm that the bad part is the issue.  If the parts work in the good FED you'll also know that the issue is not with those parts.  In that case the main FED3 board may have an issue with a messed up trace from soldering/desoldering.  I have some extras of this board with headers on it (part in photo below) - if it seems like the board is the issue send me a direct email with your address and I can send you one on these!  Best, -Lex


IMG_20200609_165350.jpg

Matthew Luby

unread,
Jun 11, 2020, 4:12:22 AM6/11/20
to FEDforum
Hello Lex,

I have a very curious apparent resolution to the issue.

In the most recent round of troubleshooting, I ran both FED3's as assembled per my last post and the malfunctioning FED3 had the same issue it was having. I then tried swapping the motor control breakout (I'm going to call this motor board A) from the malfunctioning unit into one of the functioning units, and the functioning unit continued to function with what appeared to be a slight reduction in the speed and degree of rotation during both dispensation and clearing modes. When I placed the motor control breakout from the properly functioning unit (motor board B) into the malfunctioning FED3, it seemed to fix the issue, i.e., it is no longer malfunctioning.

When I returned motor board A into the malfunctioning FED3, the problem of not rotating during dispensation returned; similarly, motor board B seemed to restore a slightly faster and larger angle of revolution when returned to the functioning FED3 it started in.

I haven't tested any voltages, but it seems to me like motor board A is delivering lower or more inconsistent voltage than motor board B, and that the malfunctioning FED3 is sensitive to this to a larger degree than the properly functioning unit. Do you think this assessment might describe the issue correctly? Can you think of any other means to test these hypotheses? I would try components from other FED3's (we have two others that function well,) but they are at the lab and I am not right now.

Best,
Matt Luby

Lex Kravitz

unread,
Jun 11, 2020, 2:30:41 PM6/11/20
to FEDforum
It sounds like you've identified "motor board A" as the problem?  Can you re-melt the solder joints on board A and see if that fixes the problem?  If you've soldered/desoldered this board multiple times you may have burned the traces on the board and may need a new motor board.  Trying to figure out exactly what is happening with voltages will be difficult, especially if you have a faulty/intermittent connection.  I would just replace motor board A and if that fixes the issue throw the broken one in the trash, fortunately they're only $5!

Matthew Buczynski

unread,
Oct 14, 2020, 4:19:50 PM10/14/20
to FEDforum
We're in the process of updating our FED3s by updating the code and swapping out original motors for new “28BYJ-48”, and noticed that the average pellet dispensing time went up (~2 seconds to 5-7 seconds). We think average dispensal time may impact some of our proposed experiments, and planned to play around with the settings to get closer to a 2 second average dispensal.

I know there have been multiple iterations of the the pellet dispending code (shaking dispensal, jam dislodging, etc) - can anyone provide a brief summary of what's already been tried so we don't retread old ground?

Lex Kravitz

unread,
Oct 14, 2020, 4:51:51 PM10/14/20
to FEDforum
Hi Matt,
The new motor (the ones from Amazon, not Adafruit) has a different gearing (1/64 instead of 1/16).  So what that means is that you need to turn it 4x as far in the code for the pellet disk to move the same distance.  So what's likely happening is that your code is not moving the new motor far enough to dispense the pellet, so it takes at least 2 movements before a pellet can drop. 

There have been many iterations of the pellet dispensing code, to summarize where we are now:

The normal dispensing movement is that the motor moves 6 steps of -45 (-270 in all), checking for a pellet detection at each step.  This looks like a single movement but it does check 6 times for a pellet.  It then waits 2 seconds and tries again if no pellet is detected. 
If it tries this 5 times without seeing a pellet it makes a small movement backwards (+100)
If it tries 10 times without seeing a pellet it starts vibrating around for one full cycle
If it tries 15 times without seeing a pellet it makes another small movement backwards (+100)
If it tries 20 times without seeing a pellet it moves one full rotation forward and one full rotation backwards.

For all of these movements it's checking the well between each movement and will stop the pellet disk when it detects a pellet.  Hope that clears things up, the latest code on the GitHub (1.1.48) has this behavior in it.  You can just copy/paste from the "Feed" tab if you want to swap this into some other code you're running!  Best, -Lex

Matthew Buczynski

unread,
Oct 15, 2020, 1:47:09 PM10/15/20
to FEDforum
Thanks this is super helpful summary! We plan to see if increasing the motorspeed will decrease the average pellet release time without causing lots of jams. 
Reply all
Reply to author
Forward
0 new messages