I am working on this project for my masters thesis. The experimental set up is shown in the pictures below. I have a Arduino UNO which is paired with a Adafruit Motorshield to enable control of the stepper motor. The desired motion of the stepper motor is to turn a certain amount of steps and then stop and hold for a certain amount of time. Once the certain amount of time has elapsed, the stepper motor will turn the same amount of steps and then hold and so on so forth. My problem is that the Arduino seems to go into "sleep" mode after a few minutes (I have not measured exactly). I set the dwell time to 1 seconds, meaning the stepper motor will turn and hold for 1 second and repeat. The arduino works exactly as intended for the first few minutes but sure enough it will completely stop at longer than ~5 minutes. If you look at the board in the attached pictures, you can see when I first plug it in the power LED is bright green and after a while the LED seems to dim and the stepper motor ceases movement. Initially, I used the usb port of the laptop from which I uploaded the code to the Arduino to power it. When I realized that maybe the laptop was cutting power after a few minutes, I decided to use a power bank. The problem persists with the power bank. I do not know why the Arduino stops sending commands to the stepper motor after a while but I would like to configure the Arduino to be able to run for as long as there is power supplied to the board. If I unplug and plug back in the USB cable it works fine but will stop as mentioned above. My experiments involve dwell times of up to 3 minutes per hold so an entire experiment can be up to 45 minutes to an hour. My biggest suspicion is that I will need to use the barrel jack of the arduino board but I am under the assumption that the com port works just as well. Any help is appreciated. The code I have pasted below is for a 5 second dwell time.
Can your power supply give enough power to the whole system?
How many amps does that stepper use?
Try using a high amperage ac(outlet) - 5v usb output.
Appreciate your response. I do not believe the power bank is a problem, it is a 24,000 mAh power supply. It is convenient in the sense it tells me the power draw of any device connected. The reason I suspect something with the board is because when the board is working properly, the draw is 4-4.8 W and when the board stops working the draw falls to 1.5 W. The stepper motor is a NEMA 11 pancake rated for .5A each phase so I believe total is around 4 A.
Instead of a L293D darlington driver, we now have the TB6612 MOSFET drivers with 1.2A per channel current capability (you can draw up to 3A peak for approx 20ms at a time). It also has much lower voltage drops across the motor so you get more torque out of your batteries, and there are built-in flyback diodes as well.
The fact that the power LED fades leads me to believe for some reason the load current draw is growing to where the supply voltage drops. Let the Arduino run less any loads. Next let the setup run but less the stepper motor. Do you see the same symptom? When it does this try feeling the components on your boards, anything getting hot, real hot? I am not saying your power supply is faulty but possibly after a period of time being overloaded. Start simple with a process of elimination. Why would the LED grow dim? Tells me the supply voltage is dropping.
I will try this tomorrow. Never thought about this. My advisor told me to try with different voltages. Nothing gets hot when I run it through the usb com port. When I use the barrel jack the stepper motor gets extremely hot in a few minutes so I run the com port. I assume that has something to do with what I’m experiencing now.
Looking at your pictures you seem to use this motor, right?
This motor cannot be driven by the adafruit shield, it needs a current driver like the DRV8825. The motor windings have a resistance of 4 ohm, which means >1A at 5V, which is much more than the rated current of 0.5A. And if your Motor voltage is higher its even worse. That's why it gets too hot.
Appreciate your response. I have a similar driver from Pololu which is the STSPIN220 low-voltage stepper motor driver carrier. Im assuming from the name, I am not able to use this driver? I will have to order the DRV8825 in that case.
Followup question, when I use the usb com port the stepper motor does not get hot. Is there any way to overcome my problem while still using the com port?
Without the stepper motor the board seems to power up and run fine. Nothing gets hot, no dimming lights and it has been on for over 20 minutes now, much longer than with the stepper motor.
Yes, that is thee motorshield I am using. I assume I will not be able to achieve my desired behavior while still using this motorshield. Another person commented that the motorshield is the problem as well.
Hi, @liluzibert
Check the METAL USB socket on the UNO, check that it is not shorting on the shield you have plugged on top.
Put some insulating tape over the metal box of the USB socket.
Me too. The Adafruit shield is a a constant voltage driver and Adafruit has a web page that tells about compatible motors. Your motor has a rated voltage of only 2V ( coil resistance is 4 ohm, rated current 0.5A. Ohms Law: 0.5A x 4Ohm = 2V ). And that's not compatible with the shield.