Show Posts
Pages: [1] 2 3
1  Using Arduino / Project Guidance / Re: Controlling several stepper motors on: May 11, 2014, 04:39:34 pm
I've done a bit of research and I'm pretty sure an Easydriver (or equivalent) can't drive a 5-wire unipolar stepper motor.
They can drive a 6-wire unipolar by ignoring the two center tap wires and treating it as a 4-wire bipolar stepper.

In a 5-wire unipolar stepper the centre taps from the two coils are joined together and appear as a single wire.

If you can modify a 5-wire stepper to break the connection between the two centre taps they could be used as bipolar steppers.


Thanks for the follow up and of course to everyone else for their input too.  I think I'll most likely have to go down the Arduino Mega route (Mega2560) or if I want to keep the physical size down, I2C with two ATMega328 chips (on a custom PCB).  Most likely I'll go with the Mega2560 for making things simpler/quicker. 

Either way I'll have the 4 cheap drivers (ULN2003) that ship with the stepper motors connected for each motor (so 16 pins in total being used).

Thanks again all!
2  Using Arduino / Project Guidance / Re: Controlling several stepper motors on: May 11, 2014, 10:22:10 am
One easy option would be to use something like a Mega2560, which has ample pins for what you need.

Yep, that's the one I saw on eBay.  For under £15 (even less if I get it from Hong Kong) I think this is looking to be the route I'll go down just because I need so many pins for this particular project. 

On other future projects where I only need a few pins, I'll probably stick to my normal way where I remove the ATMega328 and permanently add it to the circuit.  Then I just replace the chip for a few pounds.  It saves money in the long run as you're only putting in £6 of components rather than a £15 board.  It also allows me to make the form factor smaller as the Arduino boards contain lots of things I don't necessarily need in all projects.
3  Using Arduino / Project Guidance / Re: Controlling several stepper motors on: May 11, 2014, 09:46:19 am
You could use an EasyDriver stepper controller (one per motor).

Basically you connect the four leads of the motor to the stepper driver, and then you control the driver using a single pin (it's marked STEP on the board) and optionally DIR to control the direction. The board has integrated microstepping control. I've used such board myself and I have to say it's a great product. Unfortunately, it costs $15 at (found here). So I recommend you get them from China for $3 each (Ebay link).

I wasn't expecting a reply so soon, thanks a lot!

Having 1 pin taken instead of 4 pins per stepper certainly sounds much better (I only want them to move in one direction so from your description I shouldn't need to provide that, but even if I do, 2 pins is still better!).

For the 4 wire driver (ULN2003), I believe the code should look something like this (never used steppers and they haven't arrived yet so this code may not be completely correct):-

Stepper myStepper(64,8,9,10,11); //define 64 steps and pins 8-11 for use with the stepper/driver

void setup() {
myStepper.setSpeed(1); //Set speed to 1 rpm
stepper1.moveTo(0);  //Set position to 0 degrees

void loop() {
stepper1.moveTo(32);  //Move 180 degree position
delay(5000); //wait 5 seconds

With the easyDriver, how would you define "myStepper" as you're now only using 1 pin instead of 4?  Or is it the case you need to just turn the pin "HIGH" for x microseconds and then set it "LOW" again to stop it moving?

I've also seen references on the web that the easyDriver gets pretty hot to the touch so some sort of cooling (heatsink) is needed, is that your experience?  My project won't be driving the motors very hard nor will they be lifting significant loads (it's for a custom clock project).

I think those are 5-wire steppers and can't be driven by an Easydriver - but not certain of this.

In any case, rather than buy 4 stepper motor drivers why not just buy a second cheap Arduino - or splash out and buy a Mega.

I've just got a Leonardo (similar price to an Uno) and it appears that its serial pins (0,1) can be used separately from the serial connection to the PC over the USB connection. That means it would be a convenient option for the "master" device as it could easily talk to the second Arduino as well as to the PC.

One disadvantage of not using stepper drivers is that the Arduino will need to do a lot of work to supply pulse sequences for all the coils on 4 stepper motors.


Thanks, I did think I2C was maybe a solution seeing as another ATMega328 chip costs around £2-£3 on ebay and then I double the amount of useable pins minus 2 for the clock/data lines.  I was also thinking of somehow programming an ATMega32 as my chip instead of a ATMega328 as that provides a lot more pins to use.  

I was trying to avoid having an Arduino board (like the UNO, Leonardo, Mega etc...) as a permanent control board in the project as it feels like a waste as they're more like development boards than boards you keep in a permanent/final project (I generally prefer to upload the program to another chip and then have that permanently in the final circuit).  The boards also take up more room than if you were to move it over to a PCB for instance (as they contain a lot more than you sometimes may need in your project).  However, with this project needing so many pins, I may have to re-think that and actually go for an Arduino Mega.  EBay seems to have some for under £15 and it may be the simpler (and maybe even more affordable) way to go in the end.

I think the first step is to maybe hold off buying anything further, wait for the cheap stepper/driver bundle to arrive (which may be a while as they ship from Hong Kong), see how I get on with them and then move on to this.  I'm starting to lean towards an Arduino Mega now I've seen the price on eBay smiley

Thanks a lot for your input!
4  Using Arduino / Project Guidance / Controlling several stepper motors on: May 11, 2014, 08:49:30 am

Thought I had better start a separate thread instead of having my old thread go off topic.

I have purchased some cheap stepper motors and drivers off ebay (28BYj-48 steppers and ULN2003 drivers) and would like 4 connected for a project.    Each driver needs 4 pins, so that means 16 pins are needed alone for the drivers.  In addition to this I need some pins for sensors and other components.  This all means I won't have enough pins to controls everything from one ATMega328 as you only have 18 useable pins (13 digital and 5 analog; any of which I believe the drivers can use as it doesn't specifically need PWM/analog).

So the question I have is how to control more than 18 pins from an Arduino.  Is my only option I2C where I will connect two ATMega328 chips and then spread the components/jobs amongst those two chips?

I've been looking into shift registers but they seem to become difficult to control when you involve stepper motors as you're only  turning pins high/low instead of sending "step" or "speed" instructions.

I want to avoid "Arduino shields" if possible as the end goal will have the ATMega328 permanently connected to the final circuit board rather than permanently connecting up the Arduino UNO (which feels a waste as it's a development board rather than a "final" board).  Modules and non-shield boards are fine though!

Anyone have any advice?

5  Using Arduino / Project Guidance / Re: Detecting a stepper motor position after a power cut / setting a home position? on: May 11, 2014, 06:02:58 am
Having multiple sensors to detect where the hands are in relation to the "12" home position sounds good as (like you say) you can detect the position of the hands earlier, but I don't think I'll have enough pins available.   Never heard of "hall sensors" until now but they look pretty interesting.

I've bought some cheap 28BYj-48 motors which use another cheap ULN2003 drivers.  Each driver needs 4 pins (so 16 in total as I'll need 4 steppers), then I have an I2C real time clock module to connect.  So before I've even addressed the sensors I've probably run too low on pins.  I guess I'll need to take a look into seeing if there are cheap I2C drivers I can get or a more heavy duty driver that lets me drive multiple steppers.  At the end I would want to permanently add the ATmega328 chip to the final circuit (rather than using the Arduino board itself so it's not going to waste), so I want avoid any "shields" if possible.

I'll also have a search on the forums to see how you can increase the number of pins you can control (the only idea I have is having two ATMega328 chips connected via I2C so you can spread the components/jobs)
6  Using Arduino / Project Guidance / Re: Detecting a stepper motor position after a power cut / setting a home position? on: May 10, 2014, 02:29:52 pm
Would an optical sensor like this work do you think (or does anyone have any other recommendations)?

I've never really used things like this so my assumption is that when I'm trying to reset the stepper to the home position I begin checking this sensor.  I run a loop which checks if the sensor is covered up by the clock hand and if not steps forward a little.  It then keeps looping until the sensor is covered indicating the home position has been reached (so the hand is pointing at "12"). 

Does that sound about right?
7  Using Arduino / Project Guidance / Re: Detecting a stepper motor position after a power cut / setting a home position? on: May 10, 2014, 01:43:22 pm
I do like the idea of it resetting and then finding the "real" time afterwards when there's been a power interruption.  Like Robin2 says, very un-clock-like smiley

I'll take a look into optical sensors and limiting switches.  I've never really used these before (nor stepper motors) so it's going to be a learning experience for me.  Appreciate the quick replies!

If anyone else has any other suggestions I would love to hear them.
8  Using Arduino / Project Guidance / Detecting a stepper motor position after a power cut / setting a home position? on: May 10, 2014, 11:27:29 am
Is there an easy/affordable way of doing this?

What I'm looking to do is make a customised clock using some stepper motors which drive some clock hands (one stepper motor per hand, so it's not like a normal clock where one motor plus some gearing controls all the hands).   There will be a real time clock module in the setup so in the event of power loss the time/date isn't lost but the motors will obviously stop working.  When power is restored I then want the analog clock to then "catch up" to the time the RTC module says it is.

To make this work I need to determine what position the stepper motors are in so that I can then do some math to position them in line with the RTC time.

Is there anyway to do this or will I have to use servos instead?  

I wanted to avoid servos just because my experience has always been that they are a bit noisy (even when idle) and are limited in terms of movement (unless you modify them to be continuous, but then you're moving them by milliseconds rather than to a specific position and I think you lose the ability to have a home position?) but that is the fall back position should stepper motors prove to be difficult to keep track of their position.

Another way I suppose I could do this is have the stepper motors return to their "home" positions on startup and then move it forward to the correct time.  I've never used stepper motors, can you set a home position on them so when it is powered up they return to a specific position regardless of what position they were in at the time of the power cut?

Thanks a lot in advance to any help anyone can provide
9  Using Arduino / Project Guidance / Re: Powering ATMega328 in project safely without UNO board? on: November 19, 2013, 04:24:00 pm
Cheers CrossRoads, appreciate the help.  I know programming quite well, but still learning the hardware side of things.

At the risk of revealing my amateur knowledge level of electronics, can I confirm the screenshot attached is how I should add those components to the power portion of the circuit (I just made it a simple LED circuit for the sake of example).  I'll probably buy a pack of zener diodes from ebay, so I'll have plenty to hand and I'll one to input power to be safe.

Thanks again
10  Using Arduino / Project Guidance / Powering ATMega328 in project safely without UNO board? on: November 19, 2013, 01:51:25 pm
Hi all,

Background spiel
I've been working on a arduino project involving a servo, some LEDs and an LCD module.  For the development I've been using the Arduino UNO board and a breadboard for all the components.  Now I'm ready to make the project more permanent, however I don't want to put the entire UNO board in the project as it 's a bit of a waste putting the entire thing in when I only need a few pins.  So I went on and used the "bareduino" schematic and managed to get the ATMega328 chip working on there without the UNO board.  However I want to further shrink the components needed in the permanent project.

Currently I'm using a 4x AA batteries (6V total) to power the ATMega328 using a 7805 regulator with some capacitors to reduce the voltage to 5V for the ATMega328 and the servo power is plugged in before the regulator so it can use higher current (7805 will cap to 1A max).

Instead of using batteries I wanted to instead use a 5V DC mains supply (one used for a phone where it outputs 5V DC and 2.5A max current).  As I'm using a 5V DC plug, I want to remove the 7805 portion of the circuit.  I've attached a basic strip board of what I'm trying to do minus the LEDs and LCD.

1) As I'm using a DC mains supply that is already capped to outputting 5V and 2.5A max, can I remove the 7805 regulator?
As the mains supply is 5V DC it doesn't need to reduce the voltage further, but I wasn't sure if having a 7805 regulator between the mains and IC added some other layer of protection I'm overlooking.

2) As the servo is being plugged into the same "power rails" do I need to add anything like a rectifier diode (1N4007) to protect the ATMega328 at all (as I hear people saying motors can cause reverse power spikes that can damage ICs)? 
If so, where should I put it or is it unnecessary?

Thanks for your time and advice!
11  Using Arduino / Motors, Mechanics, and Power / Re: 2 questions: Boosting current and step down converters on: August 14, 2013, 03:37:06 pm
Responses much appreciated.  I knew I was probably thinking things over wrongly.

My search results never turned up 5V 4A plugs, but now they are.  Must have been having a blind moment!

One of those should be enough (only if all motors and servos are under heavy load would each one draw 1A+ simaltaneously, so this should cover things I hope as most of the time they should only draw somewhere around 500mA-750mA each).

If it's not enough, I'll go down the DC-DC converter route with a 12V 6A power supply (though I'll probably need a large heatsink on the DC-DC converter to take it from 12V to 5A I assume?).

Thanks again!
12  Using Arduino / Motors, Mechanics, and Power / 2 questions: Boosting current and step down converters on: August 14, 2013, 01:30:57 pm

Revisiting an old project as I'm going to have a few days off work.
First off, I'm a bit of a hardware noob, so apologies on this if it sounds stupid or is completely wrong.

I wanted to try and build a robotic arm that uses 2 stepper motors and 2 servos.  The arduino will run off a battery, but the servos/motors will need some more power and should also not be connected up to the same battery (apart from where you share the common ground).  So the plan is to run the motors off the AC mains so I don't have to connect 15 batteries or an expensive RC battery to run all of this.

So, I was thinking about getting a wall wart that supplies 5V and 3A, but I realised the 3A may not be enough for all the motors as they can (depending on the load) drain up to 1A each.

Is there a way to boost the current when I have a 5V DC 3A wall wart?  Will connecting capacitors in some way boost current or do they only store voltage?

Altenatively, I could get a different Wall wart that provides 12V and 5A, but then I need to step down the 12V power without generating lots of heat or needing large heatsinks.  So can I connect two of these DC-DC converters in parallel (so I would then have 2 rails supplying 5V at 2.5A which then each power 2 motors)?

I'd like to avoid work bench power supplies if possible so I can have it as a permanent completed project.

Thanks in advance to anyone who can help or takes the time to read this!
13  Using Arduino / Motors, Mechanics, and Power / Re: Daisy chaining buck converters = bad idea? on: November 19, 2012, 06:02:20 am
Thanks for your input guys.  Looks like I'll go buy a batch of these buck converters (pretty cheap off ebay, they actually work out to be even cheaper than a linear regulator from a electronics store here in the UK!).

@Runaway Pancake
PS - So, that ATX supply is looking better and better all the time, Bobu?  (:
It certainly is.  The only reason I don't want to use an ATX power supply is because of the physical size of it.  It would be great to use as a lab power supply, but for the final project where I want to make everything permanent, it's just too big for my liking smiley-sad
14  Using Arduino / Motors, Mechanics, and Power / Daisy chaining buck converters = bad idea? on: November 18, 2012, 06:04:31 pm
Hi Arduino community!

Hope I'm posting this in the right section.

The background spiel

I'll be needing 3 different voltages in my project for various components; 5v for the AtMega328 chip, 3.3v for a display module and finally 6v for some servos.  I also want to run everything of 1 singular power supply so I plan to use a mains supply/wall wart as it's not something that requires mobility.

I plan to remove the ATMega328 chip from the board and have it permanently fixed into my project at the end (this way I can re-use the board for a future project), so I can't really rely on anything that's already built into the board to achieve this.

My plan was to have a 12V 3A AC-DC power supply (a laptop charger) connected to a buck converter to step the voltage down to 6V 3A.  This will provide power to the servos.  I would then daisy chain a second buck converter to this to bring the voltage down further to 5V which would then power the ATMega328 + it's components (crystal etc...).  From here I would then daisy chain a third buck converter to bring the 5V down to 3.3V for the display module (I may substitute this for a linear regulator as the current I need for the 3.3V part is very low; 20mA).

I was thinking of daisy chaining them in this manner, rather than having all 3 connected to the laptop chrager directly. I thought by doing this, the buck converters would have less voltage they need to drop when it gets to the 5V and 3.3V regulation (meaning less heat would be generated so I won't need to add any heat sinks or anything).  From what I understand buck converters are very efficient and will not generate lots of heat like linear regulators can, but I thought this still may be worth doing.

  • By daisy chaining buck converters, does this cause any problems?  For instance, current issues, heat issues or hazards? Is it better to have all 3 connected directly to the AC-DC plug, if so is there a reason?
  • This one may sound completely silly.  If the buck converter was rated for 3A max and the power supply says it can only provide 3A max, is there anyway to boost the current that is available after the buck converter?  For instance for powering the servos I have 6V and 3A max after it's gone through the converter, but ideally I would like 6A to be available if the servos need to lift any heavy loads as each servo can potentially try to draw up to 1A each on very heavy loads.
  • Slightly off the main topic here but, if I wanted to protect part of my circuit so it can never draw more than 2A, is there anything I can use to do this?  I'm just concerned in very heavy loads where the servos may potentially try and draw the full 3A, this leaves nothing for the rest of the circuit (ATMega328 for instance) and will cause resets or other issues.  So I was wondering if there was a way to limit this part of the circuit so it can draw between 0A-2A but no more than that, leaving 1A available for the rest of the circuit.

In case you need to know, the buck converter I planned on using has a LM2596 regulator.

Thanks you very much for your time and reading this, I look forward to your responses smiley

15  Using Arduino / Motors, Mechanics, and Power / Re: Controlling the parallax standard servo on: November 11, 2012, 04:29:39 pm
Tried powering it from a 9V battery... then from two 9V batteries in series.. (probably blew it at that point) to no avail.

Yep, that's probably what's happened.  The servo was rated for 6V max, so if you connected it directly to a 9V supply, it probably damaged it in someway.  If that didn't do it then it more than likely would have gotten damaged when 2x 9V in series (as that would come to 18V).

If you power it from something higher than what it's rated for, you'll need to use a regulator to bring the voltage down.
Pages: [1] 2 3