for an art installation, I want to continuously rotate perforated gobo disks (Ø 90mm, weight 183g each) very slowly above a high-power LED to recreate the effect of sunlight falling through leaves. The speed should be variable between 1 revolution per minute and 1 revolution per hour and be as smooth as possible, position and accuracy as in CNC or robots not relevant, the technical package should be very small, however.
I thought the Arduino Pro Mini 5V 16MHz may be a good starting point and then some driver board, depending on the type of motor chosen. The Arduino Pro Mini should also randomly vary the dimming/brightness of the LED via PWM to the MeanWell driver I bought. But maybe I'm already wrong here, the Pro Mini not being able to control a motor and do the PWM dimming at the same time?
What would be the best option to start experimenting with, as far as the motor is concerned, avoiding gears/pulleys? A continuously rotating servo motor, or a brushless DC motor or a stepper motor? I have looked at various videos for all three being used for extremely slow motion, but found it hard to understand what would be the best solution for my project. Since the weight of the gobo is small, the "not enough torque" or "not enough holding power" problem that many seem to have would probably not come into the equation here?
Any hints on where to start motor-wise would be very much appreciated.
A stepper motor seems the obvious choice given the 1 Rev Per Minute to 1 Rev Per Hour requirement and no gears or belts. A small bipolar stepper and a microstepping driver may be what you want. The DRV8825 stepper driver offers X32 microstepping so a 200 Pulse Per Revolution motor would have 6400 steps per revolution. Is that fine enough so that the steps would not be obvious? The driver takes only 2 pins, step and dir, (3 if the enable is controlled) so there are plenty of pins left over for other things. The DRV8825 does require 8.2 to 42 volts to operate, but most any motor that you use will need an external power supply and driver as no Arduino can power a motor directly.
thanks for your input. That sounds like what I should try first to get something as slow yet smooth with a lightweight load, just like I saw here. If the 6400 steps per revolution are smooth and slow enough I can probably only glean by trial? The one I looked at, flat/small enough for my purpose, says "200 steps/1.8° step angle" in its specification, but not how many pulses one can/must supply per second/minute - 1 revolution per hour is 0,01667 revolutions per minute.
60 seconds @ 6400 steps = a pulse/step every 0,009375 seconds = extremely smooth I believe : )
3600 seconds @ 6400 steps = a pulse/step every 0,5625 seconds = very jittery : (
Microstepping @ 128 would get to a step every 0,28125 seconds... uh! So 1 hour with no discernible steps is simply too ambitious without gears/pulleys. Maybe 1 revolution per minute to 1 revolution within ten minutes is ok then.
Do you think an Arduino Pro Mini will be able to handle driving the stepper motor via the driver board you suggest, while also doing some random PWM dimming over time? I guess I have to use this approach for my "multitasking"?
For a very light load you might consider the cheap 28BYJ-48 stepper motors that use a ULN2003 as a driver. You can buy the combination of motor and driver very cheaply from lots of sources. The motor includes a reduction gearbox.
The speed of a stepper motor depends on the interval between step pulses. You could move one step every year if you wanted.
Using millis() (or micros() if appropriate) is absolutely the better way to do timing versus delay(). Here is another guide to using millis() for timing. The second sketch in Robin2's Simple Stepper Program tutorial shows how to use millis() to control step timing.
thanks, that looks compact indeed. I already saw your stepper motor primers for beginners and the multitasking/state machine posts, very helpful to get away from the dreaded delay().
Saw this from a Swedish shop; best to learn would probably getting a geared and non-geared and try with and without microstepping right away, also learning that bit of multitasking I need. Will the Pro Mini be up for both tasks described above (pulsing the motor/PWM dimming an LED via its PWM-enabled driver)?
Ok, thank you both very much once again - easily sounds good. I will use...
POWER
1 x MEANWELL SGA40E18-P1J Wall Mount AC Adapter
(output 18V DC, 2.2A)
MOTOR
1 x "Stepper Motor: Bipolar, 200 Steps/Rev, 28×32mm"
(operates at 3.8V DC, draws 0.67A per phase = 1.34A total)
1 x "DRV8825 Stepper Motor Driver Carrier, High Current"
(operates from 8.2 - 45V DC, outputs up to ~ 1.5A per phase)
MICROCONTROLLER
1 x "Adafruit Pro Trinket - 5V DC 16MHz"
(operates from 5.5 - 16V DC)
1 x TracoPower TSR 1-2450
(steps down 6.5 - 32V DC to 5V DC)
LED
1 x MEANWELL LDB-350HW
(operates from 9 - 36V DC, outputs 2 - 40V DC @ 350mA, PWM dimmable)
1 x CITIZEN CLU026-1204C1-503M2G2 1754lm
(operates at 34.6V DC @ 360mA)
...and then go through R2's tutorials regarding stepper motor driving and state machines to begin with.
For LED projects, I usually power the microcontroller and up to three PWM dimmable constant current sources for the LEDs from the same PSU or battery pack. Do you think this will work here, too, with a stepper motor and its driver thrown in the mix, as listed above?
Be aware that my code is not directly suited to the 28BYJ stepper motor. The ULN2003 driver is very basic and requires the Arduino to do a lot of work that is handled within the DRV8825. If you want to adapt my code to the 28BYJ motor a simple way might be to use the standard Stepper library but only use it to do 1 step at a time. The library will handle the calculations for which of the 4 outputs needs to be HIGH and LOW to cause the next step.
Alright. Let's see how it all goes once the parts have arrived. Quite exciting because I never did a project with electric motors of any kind. I intend to use a 12V DC wall adapter MeanWell PSU GS25E12-P1J 2A or GS36E12-P1J 3A to power it all conveniently from a single source (have several of these left over).
The 28BYJ motor requires a 5v input and the Arduino 5v pin should not be used for powering motors so you will probably need another device to drop the 12v to 5v. A simple 7805 voltage regulator with a heatsink should be fine - even if not the most efficient solution.
The 28BYJ-48 can be had in a 12V version along with ULN2003 driver modules. Here's a test sketch that will run one at 1 RPH, adjustable up to MAX of about 14RPM. Steps are barely perceptible (to me :o ):
/* pin 8 to pin 1 on ULN2003, pin 16 to pink, coilA
9 to pin 2, 15 yellow, coilC
10 to pin 3, 14 orange, coilB
11 to pin 4, 13 blue, coilD
Type a value for microseconds per step in top of Serial
Monitor and click [Send] or press [ENTER].
Default set to 878906, about 1 RPH
*/
uint32_t tStart,
tEnd = 878906UL; // microseconds per step
const byte fSteps [8] = {0x01, 0x02, 0x04, 0x08, 0x01, 0x02, 0x04, 0x08};
const byte hSteps [8] = {0x01, 0x03, 0x02, 0x06, 0x04, 0x0C, 0x08, 0x09};
byte cntr = 0;
bool dir = true; // set false for opposite direction (CW/CCW)
void setup()
{
Serial.begin(9600);
DDRB = 0x0F; // set pins 8,9,10,11 to OUTPUT
}
void loop()
{
if(Serial.available() > 0)
{
tEnd = Serial.parseInt();
Serial.println(tEnd);
}
if (micros() - tStart > tEnd)
{
tStart += tEnd;
PORTB = (PINB & 0xF0) | (hSteps[cntr & 0x07]);
dir ? cntr-- : cntr++;
}
}
that sounds rather good; I'll definitely also try the small gear motor route. First I need to understand R2's stepper motor and state machine basics...
I wonder why the DRV8825 must receive its 5V logic power via the RESET and SLEEP pins, is that really the case? Is the wall adapter PSU sufficient here and are some other recommended components missing?
The Pro Trinkets' 0 and 1 pins are indeed Rx and Tx, so I shall use pins on the other side.
For permanent 1/32 microstepping, for example, M0, M1 and M2 should be connected to G also, do I understand that right?
I am also missing the 100-μF capacitor between MOT+ and G as shown in the simple wiring schematic on Pololu's website, but then in the Texas Instruments PDF on page 3 there is this
Connect to motor supply (8.2 to 45 V). Both pins must be connected to the same supply, bypassed with a 0.1-μF capacitor to GND, and connected to appropriate bulk capacitance.
which is not depicted in that said schematic, but elaborated on page 21, and now that has me confused.
Right, follow Polulu's advice means using a 100-μF capacitor between MOT+ and G.
I found that for permanent 1/32 microstepping, M0, M1 and M2 need to be pulled high, so I can use the 5V for the microcontroller from the step down converter for that purpose, too.
I wonder why the DRV8825 must receive its 5V logic power via the RESET and SLEEP pins, is that really the case? Is the wall adapter PSU sufficient here and are some other recommended components missing?
Thanks!
It doesn't receive power from those pins, they are signal inputs. The chip generates its logic supply internally
from the motor supply. Unless you set nRESET and nSLP pins high the chip does nothing useful.