Need circuit to drive stepper or servo that drives kinetic sculpture
tomboardman
Posts: 68
I am exploring ways to replace a constant force spring with a stepper or servo driven mechanism to drive my kinetic art sculptures. My needs for the circuit are the following:
-120 VAC power source
- Stepper or servo torque of about 4 lb-in
- Stepper or servo would be energized by a limit switch, which would be tripped by the sculpture at a random interval of between 1 to 3 minutes.
- Upon triggering the limit switch, the stepper or servo would rotate 120 degrees at a set velocity and acceleration. The velocity and acceleration settings would vary depending on the size of sculpture.
Can a Parallax microcontroller do what I need? Am I asking for a complicated electronics circuit? My expertise is mainly mechnical and I am looking for someone with the electronics or robotics knowledge to help me.
Thanks
Tom
-120 VAC power source
- Stepper or servo torque of about 4 lb-in
- Stepper or servo would be energized by a limit switch, which would be tripped by the sculpture at a random interval of between 1 to 3 minutes.
- Upon triggering the limit switch, the stepper or servo would rotate 120 degrees at a set velocity and acceleration. The velocity and acceleration settings would vary depending on the size of sculpture.
Can a Parallax microcontroller do what I need? Am I asking for a complicated electronics circuit? My expertise is mainly mechnical and I am looking for someone with the electronics or robotics knowledge to help me.
Thanks
Tom
Comments
Next question is do you need fast spinning motor? If not a unipolar drive would be appropriate, otherwise a proper bipolar stepper driver
(preferrably with built-in mains PSU) might be needed. There's nothing demanding here for the microcontroller, but there's several bits of
circuit you need:
mains supply for microcontroller and limit switches
microcontroller
motor controller (and supply)
enclosure, wiring,..
[ edit: one quick question - does the sculpture have significant moment-of-inertia? Are you expecting it to rotate when the motor is not "active" -
a little more background would avoid confusion about this (stepper motors for instance hold position very strongly) ]
The motor would rotate slowly, ie the 120 degree movement would last about 2 seconds. With regards to the needed electronics, how much space would be needed?. The sculpture is mounted on a wall and its size is about 38"x40" and projects off of the wall by about 8". Depending on the size of the motor controller and supply, housing some of the electronics in a box located at the base of the wall would helpful.
The sculpture's moment of inertia is the force I use to depress the limit switch.
I plan to cushion the inertia force by mounting the limit switch on a small plate attached to an extension spring.
The stepper motor will be used to 'push' a 24"diameter wheel that revolves about its center using a precision ball bearing. The 24" wheel will then coast under its own inertia for about 3 minutes before it starts to rotate backwards when it seeks equilibrium. The backward rotation is the force that will strike the limit switch and get another 'push' from the stepper.
My goal is to have the sculpture run 24/7 using household power. In doing so, will a stepper motor hold up to that type of operation and cycling? Also, when the stepper motor operates, will there be any noticeable hum or cooling fan noise? I would like to minimize the noise since the sculpture is sometimes mounted in quiet rooms.
The bulk of the project is going to be dictated by how much power the motor needs. I don't think a hobby servo with plastic gears will stand up as well as a NEMA 17 stepper motor. And you need a good motor mount for yoru NEMA 17 motor as well as the related electronics.
If it is to be powered by 120VAC, the power supply can be near the AC outlet with DC cabled to the wall hanging. That would reduce the bulk on the wall. Motor and mechanical noise would be highly dependent on how well you design the mechanical linkage. No fan, and hum should not be an issue.
The 4 lb-in torque is really going to dictate the size of the stepper motor, the stepper-motor controller, and the power supply. And even Pololu may not have anything appropriate for that large a stepper. 44oz-in torque seems to be the largest and you want 64 oz-in torque. Be sure to get a stepper-controller mated to your motor requirements.
http://www.pololu.com/catalog/product/1200
Stepper's control position, whereas a servo / DC motor can be made to provide a torque.
Pololu has a combination that reaches about 75% of what you believe you need, but I do have concerns with your perception of torque being traditional where as steppers are more about holding torque than overcoming inertia.
So, it would seem most prudent to get a stepper motor and stepper motor controller that might seem unnecessarily large, if the physical dimensions and the cost are not a huge issue.
To do that, take a look at Ebay for 2amp and 3amp stepper motor controller boards provided with stepper motors. It is hard to beat the prices on Ebay for this kind of thing. Once you have a package that suits your building requirements, a lot of other things will fall into place.
I would like to point out that there is no real advantage in terms of wiring for power to use a 5 volt stepper over a 24 volt stepper. A 5 volt stepper would actually require heavier copper wires for the same amount of torque at a 24 volt stepper. The motor controller board should have communication inputs for 5 volt and/or 3.3volt control logic. Or an RS232 serial interface.
And there is nothing wrong with getting a board that can control two steppers and comes with two steppers. There is always room to do other things.
Steps are in 100, 200, and 400 steps per 360 degress.. so an exact 120 degree may not be possible.. but certainly a very close alignment can be had. If the stepper motor is too bulky, you might consider gearing to enable you to use a smaller stepper motor. And that 2 or 3 amp stepper motor controller can be used with smaller less powerful stepper motors.
Here is one example of a typical over-sized choice with 4.5 amps 24 to 50VDC
http://www.ebay.com/itm/1PCS-NEMA23-270-oz-in-stepper-motor-driver-256-microstep-and-4-5A-current-/300711128962?pt=LH_DefaultDomain_0&hash=item4603c7af82
In addition to the EBay package, you would likely need a good 24VDC 4.5amp power supply, and a microcontroller to input the required enable, direction, and number of steps. The package has just one motor controller. You microcontroller would need a separate power supply that would be much smaller.
An MOST importantly, the stepper motor controller board I suggest requires optical isolation between it and the microcontroller. These are cheap and easy to use, but must be used.
http://www.ebay.com/itm/1PCS-NEMA17-78-oz-in-stepper-motor-driver-256-microstep-and-4-5A-current-/290712913550?pt=LH_DefaultDomain_0&hash=item43afd7068e
But, given my very limited skills in electronics, how do I control the stepper such that once a limit switch is tripped, the stepper will rotate for X number of steps at a given velocity and acceleration? Once I have the circuit to do that, I can experiment with gearing and stepper/controller size to successfully convert my sculpture to run 24/7.
A really appreciate your input, Loopy!
Mostly I was trying to tie down the physcal size limitations and the cost budget before getting into the control of the stepper via a microcontroller. That seems to be the most demanding learning curve to you, but in this case it is rather simple.
The stepper motor controller has three inputs that may require a bit of tedious explanaton about wiring, but there are a] enable, b] direction, and c] step.
If you are only rotating in one direction and want to leave enable on at all times, you really only have to pulse the step input at a rate appropriate to your requirements.
The particular stepper is 200 steps per 360 degrees or 1.8 degrees per step. So 120 degrees would require 66.667 steps. If 66 or 67 steps is close enough, you can just provide 66 pulses or 67 pulses at the rate you require and then stop until the next time the sculpture triggers a motion. If you do need greater accuracy, the stepper motor controller has a feature called microsteps. You can set the micronsteps to a finer resolution AND have to provide more pulse at a faster rate to get the same result.
So if you were to have 1/12 microsteps you would need 12x pulses. 66.667x12 = 800 pulses, and you hit dead on at 120 degrees.
If you can follow all that so far, ask me to explain how to set up the stepper motor controller. And give me a clue on how you want to trigger a cycle -- use a mechanical contact, a passing magnet, breaking a beam of light.
You might also consider how heavy the motors are for a wall hanging. I presume that you are run a power cable down the wall to the controller being hidden near a 120VAC outlet.
I must admit that I have never bought products from this Chinese supplier on EBay. So if they end up a problem, I don't know what to do.
You can use a Parallax Propeller or the Parallax BasicStamp2 to provide a very simple program that will feed the pulses either at a constant rate that you require, or adjust for accelleration or deceleration.
A constant pulse rate is quite easy, you just have a loop that generates a pulse, then pauses a bit of time and does it again for your 66 steps or 800 steps. Mostly you will find your pause necessary. Of course, having microsteps may make the whole movement much smoother as the steps are smaller, but at a faster rate.
I did make a mistake, it doesn't have 1/12 microsteps, you might have to go much faster and smaller to get an almost exact 120 degrees. But if you wanted to do 66 steps, then 67, and 67 again to get exact correction once every full resolution that is easily done. I don't want to get too bogged down in the math alternatives.. you can go to 1/256 microsteps and still have an exact 360 cycle by correcting for long and short cycles.
You could use theis 24VDC 5amp supply and the motor controller would make sure to use only 3 amps of the available power. And if you ever wanted a larger, more powerful stepper, you could simplly go up to the 4.5 amp limit of the stepper motor controller. If you want to go down, the motor controller will handle as little at 1.3 amps at 24VDC.
http://www.ebay.com/itm/NEW-AC100-240V-to-24V-DC-5A-120W-Regulated-Switching-Power-Supply-/221215808177?pt=LH_DefaultDomain_0&hash=item33817d5ab1
I guess the Propeller QuickStart is the lowest cost for a microcontroller. I prefer the Propeller ProtoBoard, but it doesn't have a USB programming interface included.
http://www.parallax.com/Store/Microcontrollers/PropellerDevelopmentBoards/tabid/514/CategoryID/73/List/0/SortField/0/Level/a/ProductID/748/Default.aspx
And you might want a ProtoBoard Kit to add the optical isolators to connect with the stepper motor controller.
http://www.parallax.com/Store/Microcontrollers/PropellerDevelopmentBoards/tabid/514/CategoryID/73/List/0/SortField/0/Level/a/ProductID/809/Default.aspx
These boards may require a 7.5VDC wall wart as a power supply. If you have some, you don't have to buy that.
That is nearly all the gadgetry you need to do this. But I may locate someone such as Gadget Gangster that has a good alternative Propeller Board. Or if you want to program in Basic, the BasicStamp can likely to an excellent job for about the same cost.
As for the wire size, you are correct that I would locate the controller next to the 120 VAC outlet. How large would the wires be that run between the controller and stepper assembly? I'm ok with taking a chance with the Chinese manufacturer to keep my cost during the experimenting process. However, since I designed the sculpture to last for years, I would like to locate a reliable stepper/controller for the final conversion.
The stepper motor movement would be triggered using a limit switch mounted on spring mount so that the switch could move with the sculpture's reversing inertia but still operate. My thought is that once the limit switch is closed, the stepper motor begins moving sculpture in the forward rotation. Once this begins, the limit switch would open, but the circuit would ignore the switch position and simply stop the stepper rotation when it completes its 67 or 66 steps.
I leave it to your judgement as to what microcontroller is best suited.
Ok, so the hardware that I need is a stepper/driver, 24 VDC 5A ps, QuickStart board, Proto board kit, and a 7.5 VDC ps for the QuickStart? Anything else and would you be willing to help me in configuring the hardware along with the programming on the QuickStart? :-)
EDIT: That's a heck of a deal on that motor/driver combo cosidering others are selling just the driver for $59.00!!!!
Package A == stepper motor, stepper motor controller, and 24 volt power suppy.
I think you have gotten a pretty good idea of what you are getting. Regarding wire size for 3 amps (the motor needs 3 amps), you could use 16 or 18 guage copper wire. Automotive parts houses sell this.
Package B == the microcontroller, a power supply for such, up to three opto-isolator chips (I think Parallax has these), maybe a 5 volt regulator. And independent power supply, likely 7.5 volt DC seems to be what you would use, not power from the USB port on a computer.
1. The microcontroller -- you could use the Propeller or the BasicStamp2 for this project
If you use the Propeller -- you could use a QuickStart board, but it is a bit odd in that all the power is usually from the USB port. And you would likely want an add on board to adapt to another power source and to mount the opto-isolators
OR
You could use a Propeller Proto Board and have to buy a USB to Protoboard programming interface. You would have 5VDC regulator provided and space to add the opto-isolators.
OR
You could buy a BasicStamp2 in a variety of configurations -- individual unit or a Homework board
2. And
You buy a 7.5VDC wall wart to power the microcontroller on a 24/7 basis. You would only use the USB when programming.
You trip switch could be 18 gauge wire, or even smaller. In fact, I suspect that you might get away with using a length of LAN cable as it has 8 wires inside. 4 would provide power to the stepper motor, 2 would go to the sense switch, and 2 would be unused or available for later additions.
~~~~~~~~~
The Propeller versus the BasicStamp2?
The Propeller can do much more and is certainly more bang for the buck, but it can be a little intimidating to a new user. The programing language is Spin, but C, Assembler, and other languages can be used -- Basic and Forth are very easy.
The BasicStamp2 is simpler, but in this context it can do the job 24/7.
There is only one programming language, PBasic.
The microcontrollers are just boards, not enclosure included. A lot of people love the Propeller Quick Start, but I personally like the Propeller Protoboard for this kind of project... just one board in the finished project with everything on it and a simple power interface.
Lots of people would be willing to help you program in SPIN, and maybe in Propeller Assembler. How fast do you expect to rotate that 120 degrees ... 1/10th sec, 1 second, 1/1000th of second. The stepping speed will partially decide what software you need to program in.
____
You do NOT need both a Propeller QuickStart Board with related items and a Propeller ProtoBoard with a different set of related items. Personally, I think you would be better with the Protoboard for this project as it is a permanent installation.
The reason I mention the BasicStamp2 is that it is adequate as well, and you may feel more comfortable with programming it on your own. But if you do learn the Propeller, you can do more complex projects in the future.
The Propeller has 32 input/output pins and is faster, more powerful; the BasicStamp2 has 16 input/output pins. But they entry cost is about the same.
Here is the info on the 4n25 opto-isolators. We might have to find another source for these.. like Radio Shack. Since you will use 3 input/output pins.. you would need 3... and a soldering iron to wire them.
http://support.parallax.com/index.php?/Knowledgebase/Article/View/8/0/using-optical-isolation
Ummm. The opto-isolation diagram is for inputs to the Propeller. This will work very well with your switch. But we need to do a different reversed configuration for the control outputs to the stepper motor controller.
It might be wise to request a copy of this before you buy.
There is a similer, but more powerful stepper motor controller that has clearer documentation online by the same vendor and itdoes indicate that the 3 inputs go directly into opto-isolators (the enable, the rotation direction, and the step). This makes sense to me. I just suspect the Chinese vendor is a bit timid about documenting in English.
The documentations is all clear and available on-line.
But I suspect it is a lot more money, you have to inquire about price. The main advantage is you have one less box to deal with, and of course, less wires. PLUS if is UL approved.. recognized safe in the USA.
http://www.amci.com/stepper-motor-control/stepper-motor-drive-sd17040C.asp
http://www.ebay.com/itm/1PCS-NEMA23-...item4603c7af82
and a 24VDC 5A ps off of Ebay. It's coming from China so I won't get that until mid May.
For your package B, yesterday I bought the QuickStart board and Proto Board kit. So what else do I need to power the board. If whatever I purchased is not the most compact solution, that's ok since I am experimenting right now. But, it sounds like the Propeller Proto board is the best compact solution, right?
As far a programming the micro controller, I have a strong background in VB.NET and I am learning C#. So, with the help of the forum, I think I can do that part.
I estimate that the the stepper will need to rotate the 120 degrees in about 1.5-2 seconds.
I have no problem with soldering. Am I shopping specifically for 4n25 3 opto-isolators? What do they consist of, ie is is a component that looks like a transistor or is it a pc board with several components?
What do you mean by
But we need to do a different reversed configuration for the control outputs to the stepper motor controller.
I recieved the user manual from the vendor for the motor driver and it says nothing about any opto-isolaters.
Lastly, thanks for the link to the stepper/controller/PS combo. That will be something that I purchase when I have successfully completed my experimenting.
With opto-isolators included in the stepper motor controller, it just may accept 3.3 volts from the Propeller outputs directly. That would be ideal. If it needs 5 volts to drive the opto-isolators (which have internal LEDs that need to shine brightly), there are several choices. Rather than have you muddle through procurement of bits, I think I can send you the bits that you require if you are willing to send me a Private Message with your mailing address. I am not concerned about payment for the items. I do want to be sure you get working right.
Right now, I need to think about how to best deploy what you have purchased. So I won't jump in with more quick answers. This is NOT a difficult project, but you are a newcomer and matters may seem more mysterious than they are.
Above all, the Stepper Motor Controller is robust when configured for proper use, but if you wire the polarity of the inputs wrong -- it can be permanently damaged. The same goes for wiring the polarity of the supply voltage. Plus goes to Plus, Minus goes to Minus or ground. Everything needs to be carefully checked. Reverse polarity or too high a voltage to a connection are the biggest causes of damage and failure for new users.
You should have tools -- A Volt-Ohm-Metter, a 20-30 watt soldering iron, and so on.
I think once you get the items, you should first familiarize yourself with just the Propeller Quick Start. Getting a blinking LED program to work will be heading in the right direction as the you really are just going to do that 66 or 67 times for the opto-isolator at a faster rate.
There is a lot to say... but I'd rather get organized first.
The stepper motor is rated at 3.0 amp maximum, buth the stepper motor controller only provides a 2.8 amp and 3.2 amp solution. Use the lower 2.8 amp solution to avoid damage to the motor which excessive current would cause in the form of heat damage.
I think 99% of the stepper motor controller is self-explanitory, but I will contact the supplier and request better clarification on the opto-isolation of the 3 control inputs.
My only concern with the Propeller Quick Start board is that it depends on the 5VDC provided via the USB port from a computer. Hence it was intended to always be tethered to a computer and for independent 24/7 use, it requires some sort of adaption. It just may be that the easiest is to get a 120VAC to 5VDC power supply that provides a USB plug and to forget what I said about a 7.5VDC wall wart.
I have extensive experience with the older Propeller ProtoBoard, but have never used a Propeller Quick Start as I have enough boards on hand. And so, I need to study the documents for it. The QuickStart may actually be a smaller board than the ProtoBoard, but they are nearly the same size.
Program can be done in C, I am pretty sure you don't need to bother with C+ or C# for this project. It can also be simply done in SPIN. But if you want to interactively experiment with the stepper motor movement, I would use either Propeller Forth or Tachyon Forth. They would allow you to tweak and observe behavior in real time. The other software all requires a more tedious cycle of 'edit-compile-load'. And in the beginning, getting the stepper motor to have the right timing is subject to guessing how long you you want each step to be.
http://www.cnc4you.co.uk/resources/CW5045.pdf
Yes there are opto-isolators and resistors on the inputs. Each pulse for one step is required to be a minimum of 10uSec. This means you do NOT need additional opto-isolators. Using a 3.3V signal directly from the Propeller's outpin pin will provide about 12 ma. That seems safe for the Propeller and bright enough for the LED. But if the LED needs more power, I can provide an IC chip that will convert the 3.3V output to 5V for all 3 signals.
Apparently, the Enable defaults on, so you don't have to provide wiring to it unless yoo want to provide a Standby mode for the CW5045 to consume less power. This is usually provided for a safety shutdown in machinery applications.
And for what it is worth, here is the original manufacturer's document in Chinese. http://www.cw-motor.com/pro/54.aspx
You don't have to have an opto-isolator on your input switch to the Propeller, but it would provide protection to the QuickStart board if you had someone wire the scupture wrong. In that case, wrong wiring would damage the opto-isolator and it could be cheaply replaced... about $1 USD.
The prop can easily drive the opto-isolator led through a current limiting resistor. Most opto's use an IR led with a typical forward voltage of 1.2V. A 100 ohm series resistor will limit the led current to 20mA. I use opto-isolators often, and not only for the protection they provide, but also for the ease of interfacing low voltage circuits like the prop to the higher voltage and power circuitry.
The Propeller Quick Start has 8 LEDs and 8 inputs that you can trigger with your finger... a touch switch.
For your scheme, you only require one input (the trip switch), and two outputs (the Direction control, and the Pulse control).
I think you can simply develop your first program without any actual wiring hook up and make the delays between Pulse outputs longer so that you can see them on two LEDS. Once the program is working well, the delay can be shortened to get your 1.5 to 2.0 second cycle and the i/o can be reassigned to real input and output pins.
At that point you can wire it up to the real trip switch and the stepper motor controller. You might then run tests with the sculpture attached or just independently.
Here is the schematic for the Quick Start Board, and a link for all its documentation.
http://www.parallaxsemiconductor.com/sites/default/files/parallax/40000-Propeller-QuickStart-Schematic-Layout-RevB.pdf
http://www.parallaxsemiconductor.com/products/quickstart
The program is simple enough.
A. You have a main loop with a short delay (say 1/10th of second) that monitors the condition of your trip switch. If the switch is not tripped, it continues to loop until it gets a hit. This runs forever.
B. If the switch indicates a hit, you jump into another loop that first increses a 1 through 3 counter, then selects a 66 step or 67 step output depending upon a counter that just cycles between 1 and 3.
C. Every time the 66 steps or 67 is complete, you return to the main loop to await the next switch trigger.
ON the whole, this is an extremely simple program. You will only need to use One COG of the Propeller, the other 7 COGs will remain dormant.
Of course if you ever wanted to run another 7 stepper motors with independent trip switches and independent motor control, you have adequate room for expansion and all would operate entirely independently of the other stepper motors. I only mention this to give you some idea of the extra capacity the Propeller offers, you would not have that if you used a BasicStamp2.
Here is a 5VDC USB power supply. I guess you would need the right cable as well. But the same cable will be used to program the Propeller QuickStart.
https://www.adafruit.com/products/501
I'm good to go with the meter, soldering iron, etc,
I've also been doing some work on the mechanical side of my conversion. With the right gearing and pulley setup, I may be able to power my sculpture with a much smaller stepper motor.But, I'll deal with the details of downsizing after I perfect the conceptual model.
Do you have a sense as to how problematic this stepper setup may be? I am concerned about the longevity of having a stepper motor constantly running 24/7. What is the life expectancy of the stepper and the supporting electronics, 1 yr, 5 yrs? I am not opposed to buying high quality components with the assurance of a longer life.
I should receive my Quickstart board any day, so I can start learning how to get an LED to blink.
You might be able to locate a power supply that provides 5 amps at 24 volts and maybe 0.5 to 1 amp at 5 volts. That would eliminate the funny wall wart for 5VDC. One less package.
I need to investigate the Stepper Motor specification, but you might be able to increase the voltage to 48 volts as long as you stay under 3 amps. That would double the torque if the first test show you need more power.
The Quick Start looks quite okay for your final design. And you may not need the additional QuickStart Protoboard if you do some careful planning with your wiring. I try to leave out personal preference, but I admit the Propeller Protoboard is a personal favorite and I have neglected to study the use of the QuickStart. The Propeller Protoboard does other things - VGA video, a keyboard, and a mouse.
If you only have to use the QuickStart, it seems to be the cheapest solution as well.
I will let you know if the Stepper Motor can handle 48 volts. The Stepper Motor Controller certainly will. But the truth is that using the 24 volts and staying at 2.7 amps or less will allow you to avoid being concerned with excessive heat. The document I located for the Stepper Motor Controller says that over 2.7 amps, the device needs an added heat sink or a cooling fan. You didn't want a fan and it seems we satisfy that target.
As far as the program outline, I may have some further clarification about that 1 to 3 counter that determines the choice of 66 or 67 pulses. I don't think I was adequately clear.