0

Intermittent stop of stepper movement
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Intermittent stop of stepper movement

by petrus_muc on Tue Mar 16, 2021 1:41 pm

Hello all,

I work on a Lego Microscope (see here https://github.com/IBM/MicroscoPy). The part for controlling the movement of the microscope consists of a "mainboard" and a "controller". Both are interconnected by a serial link.
The "controller" has 3 joysticks and one potentiometer to control steppers and brightness of illumination respectively.
At the "mainboard" are the connectors for the 6 steppers and the constant current circuit for illumination.
The position of the joysticks is passed to the mainboard as a chain of strings, which are interpreted at the mainboard and converted into stepper control signals.
Now my problem:
After everything is properly connected and powered up at one time everything works as it should, after some time of operation all of a sudden the motors only move a short ime (~ 1 sec ) and then stop. Operating the joystick again from middle position to max. (as before) again the stepper moves for about 1 sec. and stops. Next time it moves for 5 secs or 10 secs (no regular occasion noticable)
This happens at all steppers.
As everything works well (all too seldom) it seems that the hardware is ok.

Used parts:
2 Adafruit ItsyBitsy 32u4 16 MHz 5v
6 Adafruit DRV8833

My assumptions:
- either one (or both) of the microcontrollers have a spanner in their innards
- their is a timing problem in the firmware.

As i'm a nitwit regarding programming (just managed Basic 40 years ago :-D) I have no hint what could be wrong.
May I therefore ask you gurus to have a look over the respective software and (hopefully) give me a tip what to do ?

Best regards Peter

Sorry for the multiposts, I have no idea how to get rid of the unnecessar files !

Controller.ino
(10.11 KiB) Downloaded 1 time
Attachments
MainBoard.ino
(5.69 KiB) Downloaded 1 time
Last edited by adafruit_support_bill on Tue Mar 16, 2021 3:26 pm, edited 1 time in total.
Reason: removed duplicate attachments

petrus_muc
 
Posts: 7
Joined: Tue Mar 16, 2021 12:42 pm

Re: Intermittent stop of stepper movement

by adafruit_support_bill on Tue Mar 16, 2021 3:08 pm

What motors and power supply are you using?

adafruit_support_bill
 
Posts: 81280
Joined: Sat Feb 07, 2009 10:11 am

Re: Intermittent stop of stepper movement

by petrus_muc on Tue Mar 16, 2021 4:07 pm

28BYJ-48 5V 4 Phase DC Gear Stepper Motor

5V via USB. Ony one motor at a time running

petrus_muc
 
Posts: 7
Joined: Tue Mar 16, 2021 12:42 pm

Re: Intermittent stop of stepper movement

by adafruit_support_bill on Tue Mar 16, 2021 6:16 pm

OK. Those motors are fairly easy to drive and USB should easily handle one motor at a time.

Please post some photos showing your soldering and connections.

adafruit_support_bill
 
Posts: 81280
Joined: Sat Feb 07, 2009 10:11 am

Re: Intermittent stop of stepper movement

by petrus_muc on Tue Mar 16, 2021 7:56 pm

Here are some photos.

Have no fear, I know how to solder, I was working in professional communications. :-)
Attachments
20210317_003825~2.jpg
20210317_003825~2.jpg (362.04 KiB) Viewed 98 times

petrus_muc
 
Posts: 7
Joined: Tue Mar 16, 2021 12:42 pm

Re: Intermittent stop of stepper movement

by adafruit_support_bill on Tue Mar 16, 2021 8:21 pm

After everything is properly connected and powered up at one time everything works as it should, after some time of operation all of a sudden the motors only move a short ime (~ 1 sec ) and then stop.

Symptoms like that usually suggest an overload problem. Although you are only moving one motor at a time, your code does not appear to be cutting power to the non-moving motors. Unlike DC motors, stepper motors pull more current at slower step rates. And unless you explicitly reduce the holding current, they pull the most current when not moving.

Specs for 28BYJ-48 steppers vary widely. But at 5v, they are probably pulling about 120mA/phase or 240mA per motor in holding current. With 6 motors, you are looking at more than 1A. That would be a problem for most USB ports.

adafruit_support_bill
 
Posts: 81280
Joined: Sat Feb 07, 2009 10:11 am

Re: Intermittent stop of stepper movement

by petrus_muc on Tue Mar 16, 2021 8:39 pm

Thanks for your comments !

I don't think the motors are powered during standstill as I measured the power consumption at the USB feedline and it's no more than ~ 450 mA.
But to prevent the machinery from running into such a problem I would like to add the necessary code lines. Could you please tel me where I find info about this subject ?

Thanks !

petrus_muc
 
Posts: 7
Joined: Tue Mar 16, 2021 12:42 pm

Re: Intermittent stop of stepper movement

by adafruit_support_bill on Tue Mar 16, 2021 8:50 pm

There is a sleep pin (marked "SLP") on the DRV8833. Pulling that low will disable the driver.

https://learn.adafruit.com/adafruit-drv ... -2224621-3

The other option is to pull all 4 control pins (AIN1, AIN2, IN1, BIN2) LOW.

adafruit_support_bill
 
Posts: 81280
Joined: Sat Feb 07, 2009 10:11 am

Re: Intermittent stop of stepper movement

by petrus_muc on Tue Mar 16, 2021 9:01 pm

This pin is constaltly low when motor is not in operation, I checked with logic analyzer

petrus_muc
 
Posts: 7
Joined: Tue Mar 16, 2021 12:42 pm

Re: Intermittent stop of stepper movement

by adafruit_support_bill on Wed Mar 17, 2021 5:37 am

The only other thing I can think of possibly is a memory problem. You have a lot of string operations in your code. It is possible that you are fragmenting the heap and running out of SRAM on your 32u4 processors.

There are some tips here on measuring SRAM usage: https://learn.adafruit.com/memories-of- ... m-370031-5

adafruit_support_bill
 
Posts: 81280
Joined: Sat Feb 07, 2009 10:11 am

Re: Intermittent stop of stepper movement

by petrus_muc on Wed Mar 17, 2021 1:31 pm

Thanks a lot for the tip ! I will try to get values and report back.

petrus_muc
 
Posts: 7
Joined: Tue Mar 16, 2021 12:42 pm

Re: Intermittent stop of stepper movement

by petrus_muc on Fri Mar 19, 2021 8:44 pm

Hi,
I have changed the ItsyBitsy CPU at the unit "controller" and now the motors rotate like a charm ! I Fortunately I changed this CPU fist (out of 2 possibilities one normally chooses the wrong one :-) ).
I would dearly love to f'know the reason for not working but that exceeds my possibilities.
Thanks for your help !
Bye
Peter

petrus_muc
 
Posts: 7
Joined: Tue Mar 16, 2021 12:42 pm

Please be positive and constructive with your questions and comments.