How to run stepper motors for my USS Enterprise ?

Hi,

I am doing a Revell model of the USS Enterprise
I want to motorise some of the parts in the nacelles, i have been looking around for some instructions, and what i have found is that the best way to do it is with a stepper motor.
But stepper motor require a driver, and a arduino or something equals.
I am a software developper and know how to code, but the eletronical part is still mysterious for me...

I have found some motors on banggood of ø8mm which is fine, but i still need to find a stepper motor driver and a aduino board !

The only things to know is that it needs to be small, the smallest possible !
I have seen that some arduino can be put together like lego with stepper motor drivers, but i don't know which are compatible ^^

Could you help me ?

Thanks a lot!

Here are some ressources that i found for my project :

You should try to get small DC motors, maybe servo motors, from model making sources. Often motors are hidden in the belly of the ship, with ropes or rods to the controlled items.

"I am a software developper and know how to code,"

That's really great but some practices you may have to change because of the lack of RAM. The one I know and have seen most often, I call automatic-int. After a while the words we type are reflex motions, it's not a fault but it requires thought.

Don't use int where byte will do. When you see pin numbers stored in ints, that's someone who didn't think. Sure you can waste bytes but every time you do the habit to break gets stronger.

Don't use C++ classes that do dynamic allocation. Arduino has String class objects. They can play havoc with the heap. Smart thing is to use C char-array strings. If you arrange things right, you won't need to include string.h.

These things are good for processing streams, it's almost like they're made for it, LOL!

There is a basic approach to cooperative multitasking that works great on these boards that is where we steer those who are ready, be sure to hit tutorials and threads that teach it. For you, it should go quick but it is a different view -- think RTS vs turn-based games with turn based being the taught default.

You can literally run 100's of things at once with a low-end Arduino, as long as they aren't special high-frequency tasks, in which case fewer can run together but it's not a problem to blink leds, read switches and do serial read/print (printing is the big load there especially if you print 32-bit integers) and a few other things in void loop() that averages over 60KHz. If all I do is count and print times through void loop() every second, I get over 110KHz but that's doing only 1 thing. If I blink a led too, it drops to under 80KHz. So maybe you get an idea of what the chip can do?

You can add components and chips to Arduino to get more out of it. When people want to run 8x8x8 led cubes the usual route is to chain shift registers or led drivers on the SPI bus and then the code amounts to shoveling data to SPI every 30-40 ms, have to give it time for the human to see it.

I was a programmer who could change a lightbulb (ie, do some hardware) and really liked physics. Your mileage may vary but even basic DC electronics skills can get you far with Arduino. Being able to solder is a big plus too.

As to your model, look into Arduino Nano or Mini. They're small, easier fits than Uno but have the same chip. They have pins that fit in breadboards and also female jumper ends. Look up DuPont Cable, there's 3 variants of male and/or female ends. You peel off as many lines as you need to make custom cables and reduce the rat's nest.

Don't buy parts until you need them, your plans may change. I know a lot of people who buy just because it is -something- they can do. Resist any urge, if you want to test something then get that. The big exception is common components like resistors, caps, diodes, leds and transistors that you can get per-piece cheap in assortment packs that fill whole ranges of values or functions. How many of each in the whatever assortment is up to you but 10 each of 20 resistor values means being able to try loads of new circuits that a bag of 50 220 ohm resistors (the standard for leds here) just won't cover.

If you're in the US or Canada, DIPMicro has good prices and ships in 2-3 days. DigiKey and Mouser are two good parts houses with quick shipping but the big savings takes more like 3 weeks unless Chinese New Year is happening, then add 2 weeks to a month before you get your parts.

That's all for now and too much typing already. Good luck.

These links may help
Stepper Motor Basics
Simple Stepper Code

I don't know what would be a suitable driver for such a small motor - especially if you are working with a low voltage.

One possibility might be a Pololu DRV8833 dual h-bridge. I would not normally recommend a DC motor driver for stepper motors but I doubt if this project needs high performance and the DRV8833 is small and works at voltages from 2.7v to 10v so could be used alongside an Atmega 328 running from 2 x AA alkaline cells.

...R

For low power motors the ULN28xx Darlington Array chips will do. They drove steppers out of 5 1/4 FD's back in the 90's, I picked that up from Paul Bergsman at a Trenton Fest workshop in 96. I still have the book with wiring diagrams and code in Basic.

The ULN28xx line has built-in backsurge protection just for driving motors. For small motors you might not need a heatsink but you will need resistors between Arduino pins and the driver pins.

You can probably add sound to the project. The DFPlayer (MP3/WAV player with SD) can be worked as a standalone with user buttons. An Arduino can 'press the button' with a simple state change (LOW to HIGH or opposite) equal to blinking a led. But then a LOT of control things are equivalent to led blink.
So you getcher Star Trek sounds or if you want to piss off geeks, use Star Wars sounds, LOL!

DrDiettrich : I already tried DC motors, but they spin way to fast for my project

GoForSmoke :

  • Thanks for all thoses informations but I was saying that i am a software dev more to say that I need help on hardware and not software, but yes of course I will have to practice and lean arduino !
  • And for mor I am not a zero zero in electronical, I know soldering, and know really small things like a LED need resitors, how to wire them so they all have same power, but not more ^^
  • Thanks for the DuPont cable didn't know the name, now i can find them
  • Of course i'm not going to buy parts, i am looking into this forum for help before buying, and i am now looking also to controll the LED with the arduino, but i think it will not be possible because i have a lot of LED, and if i need to keep it small i will not have enough soldering points
  • Unfortunatly i am in France, and they are not a lot a place to buy electronical things, i was looking at banggoog because a friend recommanded them to me
  • As i look for the ULN28xx on Banggood i find those : A4988 is that the correct one ?
  • As i say, i would be really please to add sound or effect tor my model with buttons, but i would need space to wire up to the aduino wich is quite small, or maybe i am wrong, but i don't know how it will work ^^

Robin2 :

  • No this project doesn't require preformance ^^
  • Sorry i have not been clear, but for the moment i am powering all my model with 9V - 2000mA or 12V - 1500mA

I still doubt that a stepper will be usable with the Z axis. It will have to push up at least the weight of the other motors.
Of course DC motors turn quite fast, but that's what gears are made for. They transform speed into force, and you'll need force in your project.
Sorry, mixed up somehow :frowning:

DrDiettrich:
I still doubt that a stepper will be usable with the Z axis.

Are you mixing up your Threads :slight_smile:

...R

All good news, Falcort! Every caveat I threw at you is already minor to you.

I don't know about that board but I got 7-channel ULN2003 (yes, I screwed up the chip line name) chips, 5 for $1 after shopping.
Most steppers are 4 or 6 wire, 1 of those can drive either. The 8-channel 2803 cost $1 ea at the same store!

It's a shame that my Francais (apologies on the no-accent text) went from "un peu" to horrible but last time I spoke or read the toungue was over 40 years ago. I even knew some Old French from my Canadien cousins in New Brunswick. Visit there if you want to hear Francais as it was spoken before The Revolution.

I am very sure that the EU has some very good electronics houses and we have EU members who can tell you but off-hand doesn't Siemens make electronics? I typed france electronis retailers into google and the top hits include 10 best places in France to buy electronics, more than 2 like that.

The same basic part might be made by 6 or more companies. I still have a catalog that gives equivalent numbers for transistors and chips, it lets them sell the ones they have with different numbers. That's why I don't know (read: did not look up) if that Banggood is a ULN-equivalent. What I do know is that that board is quite expensive if all it does is amplify signal to power. I suspect it does more and needs less code/attention of the controller. The ULN will drive small motors but only the power, the newer chips do more.

There are youtube videos and even sites on hacking salvaged toys. One big lesson is how often just 1 or 2 motors are used to make complex movements. It can be enlightening. I do tell people to watch Ralph Steiner's film Mechanical Principles on youtube, it can inspire and in parts mesmerize -- have you ever seen elliptical or square gears? They turn, they mesh, rate of rotation varies and it is eye-crazy just watching.

Falcort:
Sorry i have not been clear, but for the moment i am powering all my model with 9V - 2000mA or 12V - 1500mA

Then you risk over powering the little motors unless you use a driver that can limit the current. IIRC the seller's website described them as 3v motors. Strictly speaking the nominal voltage of a stepper motor is not relevant but if you know the coil resistance you can use the nominal voltage to calculate the current.

The ULN2003 cannot limit the current and the DRV8833 will need some extra components. However I don't believe it will do the job as well as a specialized stepper driver.

I wonder if the A4988 is capable of controlling very low currents. The Sparkfun Easydriver might be more suitable.

Of course a simpler alternative might be to provide a 3v or 3.3v power supply for the motor. I cannot tell from the datasheet whether the ULN2003 can work with a 3v power supply. It only mentions the max voltage.

...R

GoForSmoke:
Don't use C++ classes that do dynamic allocation. Arduino has String class objects. They can play havoc with the heap. Smart thing is to use C char-array strings. If you arrange things right, you won't need to include string.h.

Ironically, about the only reason you may not have to include string.h, is because it is already included by WString.h. :smiley:

If my code does not use it, it will be optimized out.

I mirror the DFPlayer boards..

only a few bucks USD... and easy to use.

  • on board amp
  • SD card to hold audio clips
  • supports .mp3 * .wav files (I prefer the later, without any meta data for premium playback)

And they can run on 2 batteries.

Robin2:
The ULN2003 cannot limit the current

The ULN2003 outputs current in proportion to gate current.
The channels are 1 BJT driving another with backsurge protection.
It's a volume-knob relation, current is controlled.

Also, search on ULN2803 motor driver boards for sale.

On what day do BJT's not work at less than max rated voltage?

Current is not really controlled in the ULN200x darlington drivers, the gain depends on voltage, temperature etc.
Also the ON voltage of such transistors is high, compared to nowadays FETs. This means less voltage on the load, and more power loss in the chip.

I've used such chips 30 years ago, when they performed very well. Nowadays more efficient chips in MOS technology are available, like the TPL7407L.

GoForSmoke:
On what day do BJT's not work at less than max rated voltage?

I did not suggest that it would not work with less than the max. All I said is that I could not see what the minimum motor power voltage is.

...R

DrDiettrich:
Current is not really controlled in the ULN200x darlington drivers, the gain depends on voltage, temperature etc.
Also the ON voltage of such transistors is high, compared to nowadays FETs. This means less voltage on the load, and more power loss in the chip.

I've used such chips 30 years ago, when they performed very well. Nowadays more efficient chips in MOS technology are available, like the TPL7407L.

When you are driving small low current steppers, how much difference is there? Then compare the price.

The ON voltage of a Darlington?

The 2.4V spec means the input needs to be at least that high to ensure saturation of the output. 5V logic drive will be fine, as long as the ULN2803 input does not load your driver to the point that its output voltage is too low to drive any other logic you have connected it to.

Non-TTL level FETs need 10V to turn full ON. Don't TTL FETs have an increased vulnerbility to static or overvoltage? 20V between gate and source and it's toast?

Robin2:
Then you risk over powering the little motors unless you use a driver that can limit the current. IIRC the seller's website described them as 3v motors. Strictly speaking the nominal voltage of a stepper motor is not relevant but if you know the coil resistance you can use the nominal voltage to calculate the current.

The ULN2003 cannot limit the current and the DRV8833 will need some extra components. However I don't believe it will do the job as well as a specialized stepper driver.

Extra components like current limiting resistors on the outputs? Wow, get the $5 board to make 50 cents difference!

This is for SMALL steppers. I don't need a constant current circuit to drive an indicator led for about the same reason I don't need much to run a SMALL stepper. The waste is my biggest concern and how much waste is there driving a toy motor?

GoForSmoke:
Extra components like current limiting resistors on the outputs? Wow, get the $5 board to make 50 cents difference!

You seem to have missed the last paragraph of my Reply #9.

Anyway, if this was my project I would run the whole thing from a pair of AA alkaline cells or a 3.7v LiPo which would solve many problems :slight_smile:

...R