Welcome! Log In Create A New Profile

Advanced

Stepper motor controller

Posted by Annirak 
Stepper motor controller
February 04, 2009 11:03AM
I've been attempting to design a new stepper motor controller. My design is different from what's been done before in several key features:
1)Drive current. My solution delivers 5A per phase.
2)Current limiting. I use a PWM driven current limiting circuit.
3)Stepping. I use microstepping (At least 32 microsteps per step)
4)Controller. I'm using an ATMega48 as the controller, rather than a dedicated control IC.
5)Feedback. Because of 4), quadrature feedback signals or SPI position sensor signals are sent directly to the motor controller, allowing for a more tightly controlled feedback loop.
6) Because of the design, it should be able to handle 4-phase BLDC and servo motors. This will help with my LIM development later on.

So far, my BOM cost is about 25USD in single unit quantities. I don't know if this is unreasonable, but it seems a little high to me, so I'm trying to find places to cut it back. In particular, I'm using an L293 as a MOSFET driver, which I'd like to replace with a more suitable solution.

The entire design is done in through-hole, and I'm going to be making protoboard instructions.
Re: Stepper motor controller
February 04, 2009 11:12AM
Have fun! smileys with beer


-------------------------------------------------------

Hell, there are no rules here - we're trying to accomplish something.

Opportunity is missed by most people because it is dressed in overalls and looks like work.

Thomas A. Edison
Re: Stepper motor controller
February 04, 2009 11:17AM
Given the advance features and the higher current per phase 2A verses 5A it doesn't seem unreasonable.

One branch of our tree of possbile solutions could be low current at 2A and then high current for more robust designs or portable more powerful motors for different tasks.
Re: Stepper motor controller
February 04, 2009 11:24AM
Well, here are the first generation of schematics. I still need to clean them up quite a bit. Please forgive the overlapping values, particularly on the capacitors. I needed part numbers rather than values so that the bill of materials would come out nicely.

(c) 2008 Brendan Moran, Released under the terms of the GPL v2 (http://www.gnu.org/licenses/gpl-2.0.html)


Edited 1 time(s). Last edit at 02/04/2009 01:03PM by Annirak.
Re: Stepper motor controller
February 04, 2009 02:20PM
Theory of operation:

The PWM serves two purposes. It sets the maximum current threshold of the output and it drives the clock of the motor PWM circuit.

The flipflop, U1A is initialized to 1, driving the #Q output low. This means that the XOR gate, U2A, passes DIRA through. Both pairs of MOSFETs, IC4 and IC5, drive to the same level, so there is no voltage across the motor winding, J3.

When a rising edge on PWMA arrives, a 0 is clocked in to the D flipflop, U1A, driving #Q high. This causes U2A to invert the DIRA signal to IC1B. Thus, IC4 and IC5 will drive to opposite voltages, and the motor coil will see VCCDRV. The current through R11 will ramp up until the output of IC2, at pin 7 is greater than the setpoint voltage at R13's wiper. This will cause the output of IC2 at pin 1 to fall to 0, presetting the D-flipflop, U1A, and driving #Q back to 0, the initial state.

Q1 forces drives off until the controller has finished initialization. R11 allows setting the maximum current to any fraction of 5A. Allows the controller to operate with the same accuracy regardless of maximum current.

Because the PWM functions as a clock, the maximum duty-cycle is PWM_MAX-1. The minimum duty cycle is 0, as 0 current works just fine with 0 drive pulses.

10 bit PWM gives a maximum current setpoint error of 0.4882% with 32 microsteps per step.
12-bit PWM @ 64 steps is 0.4766%
16-bit PWM @ 512 steps is 0.0306%

The points of highest accuracy are between 10% & 90% of a step for 14-bits and 16-bits. The smaller the PWM resolution, the closer those points move together. The microsteps at actual step points are the highest accuracy, with no error at all (excluding external mechanical error sources)

This error is non cumulative, that is if you move further, the error does not build up.
jbb
Re: Stepper motor controller
February 04, 2009 03:00PM
Hi annirak.

I've done the microstepping thing with an AVR before, and it tends to work nicely. How finely you can microstep will depend on how good the motor is...

That's a clever take on current mode control... one thing to look out for is that the time constant of the R-C filter on the PWM output may reduce your maximum control rates.

I have two suggestions:
1) You're using dual opamp chips for your current limiting unit. (I assume you checked that it will go all the way down to GND.) How about using one dual opamp chip and one dual comparator chip? Opamps are known to not work too well as a comparator.
2) How about some feedback from the current controller to the AVR? Just use an RC filter on the output of the current sens amplifiers. That way you can at least check that it's all going by software.

jbb
Re: Stepper motor controller
February 04, 2009 03:35PM
jbb Wrote:
-------------------------------------------------------
> Hi annirak.
>
> I've done the microstepping thing with an AVR
> before, and it tends to work nicely. How finely
> you can microstep will depend on how good the
> motor is...

I'm not going to let motor quality limit my controller quality winking smiley The only difference is really which PWM outputs I use anyway. Timer1 vs Timer2 or Timer0.

> That's a clever take on current mode control...

I quite liked it when I came up with it winking smiley

> one thing to look out for is that the time
> constant of the R-C filter on the PWM output may
> reduce your maximum control rates.

Good point. The -3dB point on the filter should be an order of magnitude lower than the minimum PWM rate and an order of magnitude higher than the maximum current change frequency. The maximum current change frequency should be (full) steps/second/2.

So if the PWM runs at 10kHz, the maximum step rate would be 200 full steps/sec.

> I have two suggestions:
> 1) You're using dual opamp chips for your current
> limiting unit. (I assume you checked that it will
> go all the way down to GND.) How about using one
> dual opamp chip and one dual comparator chip?
> Opamps are known to not work too well as a
> comparator.

You know, the comparators are probably even cheaper. I like that solution, I'll try to implement it.

> 2) How about some feedback from the current
> controller to the AVR? Just use an RC filter on
> the output of the current sens amplifiers. That
> way you can at least check that it's all going by
> software.

Definitely an easy addition.

Brendan
Re: Stepper motor controller
February 04, 2009 07:19PM
Brendan,

Have you thought about having the ATMega drive multiple motors? If it were possible, the logic could all be passed to a single controller, possibly making the design cost about the same as the rrrf controller? Just a thought from an amateur.spinning smiley sticking its tongue out

Randy
Re: Stepper motor controller
February 04, 2009 08:19PM
Hi Randyy,
I did consider that. There are four reasons I didn't follow through on it.

1) (the most important) I/O. check out the ATMega in that diagram. It's got very little I/O left.

The design uses 2xPWM, 2xdirection control, 2xADC, 2xShut Down for each motor. It provides 2xoptional quadrature feedback pins (forgot to include it in the schematics), and SPI for optical position sensors (more on that one in a later topic, but trust me, it's necessary). It's possible that I could set it up so that SPI Slave Select and Interrupt are multiplexed with quadrature.

The system pins are: 2xXTAL, 3xUART/control, 3xSPI (MOSI/MISO/SCK)

The total for one motor is 18 I/O pins. For two motors, the total is 28 I/O pins

So it would immediately require either a reduction in featureset, or an upgrade to a 40-pin ATMega.

2) There's only one 16-bit timer channel in most AVR's. The exceptions to this rule are the ATMega162, which has no ADC channels and the ATMega128x series which is hard to find in DIP, and expensive when you do find it.

The 16-bit timer channel is important for controlling motors because of the error which I discussed in the theory of operation. At 8-bit resolution, the maximum number of microsteps per step is 16 if you want less than 0.5% current control (thus torque, thus position) accuracy.

3) This is the selfish one: I want to keep the board light and small because I want to connect it to my bearing trucks. I want to do this so that I can do direct position sensing right from the bearing truck. There are good reasons to do this which I will get into in that future post I'm talking about.

4) We need three motor controls, not two or four. That means that we end up with one partially populated board in a 2-fer arrangement or we have one unused channel.

I can do a secondary design which handles all of the control for two motors with either a 162 or a 128x variant, but I won't actively develop it. I can put hooks in my code for controlling the additional motor.

Brendan
jbb
Re: Stepper motor controller
February 04, 2009 11:04PM
Another couple of thoughts on the way home...

1) You might want to leave a space on the board for external antiparallel diodes on the MOSFETS - the internal body diodes can suck.

2) You might want to put a small RC circuit (t = 300ns, say) between the current sense resistor and the current sense amplifier so that switching current pulses do not make it to the current comparator and cause premature turn-off.

3) The way you've connected your switching logic should work OK, but one side of each H bridge will switch much more often than the other, leading to uneven thermal loading... Also you've assumed that the power factor of the stepper will be approx 1 which is probably OK at low speeds but might limit the performance at higher speeds. I can suggest another, similar, controller type which will track a bipolar current reference very quickly if you like.

jbb
Re: Stepper motor controller
February 05, 2009 01:49AM
jbb Wrote:
-------------------------------------------------------
> Another couple of thoughts on the way home...
>
> 1) You might want to leave a space on the board
> for external antiparallel diodes on the MOSFETS -
> the internal body diodes can suck.

I don't think those are necessary. The fet's I've spec'd have a really good set of body diodes, 0.76V typical, 4A continuous. On top of this, the diodes will only conduct while a fet is switching.

> 2) You might want to put a small RC circuit (t =
> 300ns, say) between the current sense resistor and
> the current sense amplifier so that switching
> current pulses do not make it to the current
> comparator and cause premature turn-off.

You may well be right. A cap at the positive input and a series resistor on the positive input should be sufficient.
>
> 3) The way you've connected your switching logic
> should work OK, but one side of each H bridge will
> switch much more often than the other, leading to
> uneven thermal loading...

I recognized that at the outset, but the problem is this: How do you arrange for even switching? Do you set it so that in one "direction" it switches one side, and in the other, the other? If so, how do you accomplish that without adding more IC's? I have a spare XOR per channel, so I might be able to work something out there, but it'll have to be pretty fancy.

[edit:]On sober second thought, the solution is obvious. I'll have an update tomorrow with even thermal sharing. (assuming a moving motor)

> Also you've assumed
> that the power factor of the stepper will be
> approx 1 which is probably OK at low speeds but
> might limit the performance at higher speeds. I
> can suggest another, similar, controller type
> which will track a bipolar current reference very
> quickly if you like.

I was basing my idea on a current mode voltage regulator. Because of that, I shouldn't have to worry about the power factor. I'm controlling the current on a cycle-by-cycle basis.

If you mean that I get to a point where the desired current is decreasing faster than the current decay in the stepper, that's going to be difficult to solve without reverse-driving the stepper.

I'm definitely open to other ideas, by all means let me see what you've got!

Brendan

Edited 2 time(s). Last edit at 02/05/2009 02:14AM by Annirak.
Re: Stepper motor controller
February 05, 2009 12:46PM
jbb,
The only fix here is to get the thermal loading to be even given that the motor is actively moving. Let me know what you think.

Brendan


Edited 1 time(s). Last edit at 02/05/2009 12:46PM by Annirak.
Re: Stepper motor controller
February 05, 2009 02:24PM
Just FYI, a similar AVR based open source stepper motor driver is at [avrstmd.com]. Any issues with that approach? I really like their idea of drive current reduction when idle. Possibly, it would even make sense to have a gradual reduction based on the time since the last step. The avrstmd board also has optocouplers for the control connection. This is especially useful when using a separate power supply for the steppers. The stepper kit that the RRRF sells (or sold) is (was) $25, which seems an OK price target for single boards. The idea is that the RRRF would be able to buy in bulk for less and still sell the boards at $25 with their standard margins.

With my experiments using the RRRF Stepper Motor Driver-1.2 board, it seems that the real driving issues are at higher step rates (>500 Hz), where even its max of 2A isn't giving quite enough oomph at 12V with my Keling motors. I'll do experiments with higher voltages which I'd expect to work much better, possibly even at lower max currents and lower total power usage.

I'd really like to see power consumption go down at idle / low step frequencies. It seems 1A already gives plenty of holding force for the reprap, so we'd be able to cut power consumption way down for lower stepping rates. At higher speeds we'd like to use full current of course.

As soon as I've got a bit more time for experiments, I'll try to use my Arduino-scope to measure both voltage and current over the stepper and the driver at 12V and 20V when stepping at various speeds. I have no good way to measure torque at anything but holding position. Maybe I could attach a spring with a bit of thread and see how far I can wind the thread before the motor skips. Anyone got any better ideas?

-Geert
Attachments:
open | download - Torque Measuring Setup.jpg (29.5 KB)
Re: Stepper motor controller
February 05, 2009 04:21PM
Hi Geert,
That driver is exactly the kind of thing I was looking for. It implements approximately the same control method as I am trying for.

It costs $21 per phase for the control device alone, and does 3A at up to 55V. Mine costs about $6 per phase and does 5A at up to 30V (the L293 is the limiting factor here, the FET's can take 60V).

Scaling back power at low velocities shouldn't be an issue with my design. It will come with the territory. That's just inherent in the current mode control scheme.

For my (rather beefy) motors, the power consumption at max speed should be worst case 70W, at rest, they will take 8.64W, worst case.

Not quite 10x power scaling, but close to it. Is this enough power reduction?
Re: Stepper motor controller
February 05, 2009 06:29PM
Geert, I like your idea of measuring stepper torque. A bigger spool, and a weight instead of a spring would let you measure a fixed torque at speed, until you ran out of string. You could even time it and measure the power output - P=m*g*h/t. There'd be some acceleration issues at startup, but if you ramped up the stepper speeds a bit, it should work out OK.

That's make a great test bed for stepper and driver combos. For a given weight, you could vary the speed until you find the maximum speed for a given torque. Vary the weight to find the maximum torque at a given speed.

Actually, thinking about it, just tie a string to the X axis on a Darwin, use a pulley and a weight, and you could measure the speed/torque limits over short distances, as long as your static friction is low compared to the torque you're trying to measure. My X axis is pretty smooth; it will run on only 100 mA. That might be useful as a simple test bed for the rest of us. Might be yet another way to break my Darwin too though... smiling smiley

Wade
Re: Stepper motor controller
February 05, 2009 06:59PM
This raises a point, for an all in one controller with integrated drive,
That of flexibility on the output side voltage.

Some years ago, I'd considered a uC driven charge pump, and optos to control the gates of mosfets, but I would like a fool proof circuit to ensure same side mosfets don't turn on at the same time... sometimes it's easier to just go with a common integrated package. I've looked at PCBs any time a printer becomes history, but most of the chips used these days don't come up on search engines.
Another place to look Annirak, is ST, they have some microcontrollers with built in full bridge drivers, for the auto industry, things like window winder motors etc.

[www.st.com]

Problem is, they are customised for the auto industry, CAN bus, 12 volt, and probably very hard to get hold of by the hobbyist.
Re: Stepper motor controller
February 05, 2009 07:25PM
Those are all points I want to avoid.

Here's a driver for you: [search.digikey.com]
The cost was prohibitive for me, but you might be able to use it, or it might give you an idea.
Re: Stepper motor controller
February 05, 2009 09:54PM
Hi Wade,

Are you using the standard RRRF board with Keling stepper? I'm not quite sure that mine even move without any load attached at 100 mA. I was concerned about acceleration and inertia when lifting a weight, but you remind me correctly that power is proportional to the distance a given weight is lifted in a second. Initially I was thinking moving a weight horizontally, which indeed won't tell you much. I'll just use my pulley with a thin thread to lift a weight.

This should let me get useful results. If you'd like to do the experiment as well, I'll share my testbed code, which uses the Arduino for voltage and (indirectly) current measurements and emulates a oscilloscope in the Processing environment.

Probably I should set up a Reprap blogging space somewhere to document my testing results. Does anybody have advice how I should go about that? I heard some murmurings about the current reprap.org system being full... is that correct?
Re: Stepper motor controller
February 06, 2009 07:08PM
I think for single motor boards, you are on track with using the L293N to drive your Mosfets, I had a look at that chip, and I don't think it's very good value for for money in our application.

To me, the critical thing is not to power up both devices on the same side at the same time. Even audio devices such as the LM386 are worth considering in this light, as a buffer between a micro and the output coils.
Another option would be ULN2803 coupled with totem pole transistor pairs. BUT... you would have to provide a disable too, to allow current PWM.
Re: Stepper motor controller
February 07, 2009 06:49PM
The L293 is just a level translator for me.

Check out my circuit. It uses current mode PWM without disable. To do this, it either drives or shorts the winding.
Re: Stepper motor controller
February 07, 2009 10:44PM
I think I can see what you are doing in that circuit Annirak,
But why not feed back the over current output to the L293N enable ?

Shorting a winding dissipates the stored energy into the mosfets,
powering the mosfets off allows the excess energy to go back on to the shared motor supply PSU + and - lines, back into any storage capacitors.

Graham.

Edit:
I think I see the problem,
Totem pole Mosfets are harder to get good output from, you can have current overlap while switching state:
[www.planetanalog.com]
I was thinking to use bipolar transistors for totem pole boost, if required for higher current.
That way, when you disable the outputs of the L293 or equiv chip, no current can flow through either base, and the inductance of the windings can discharge (through external protection diodes), back to the power rails of the motor supply.
Graham

Edited 1 time(s). Last edit at 02/08/2009 12:03AM by grael.
Re: Stepper motor controller
February 08, 2009 12:29AM
There's no issue with dissipating the current in the mosfets. It simply loops around through the inductor, lengthening the decay time of the current. This is equivalent efficiency to dissipating it into the supply, but allows for a slower switching rate while maintaining continuous current in the motor coils (this is a good thing for a lot of reasons that are much more apparent in power supply design).

Brendan

Edit:
Oh, and be careful when you make your totem pole boost circuit. If you use BJT's, you're very likely to short them together: You have two bases tied together, one PNP, one NPN, current will flow right out of the PNP, into the NPN.

Remember, the voltage on a PNP base is Ve-0.7 and the voltage on an NPN base is Ve+0.7.

Edited 2 time(s). Last edit at 02/08/2009 12:34AM by Annirak.
Re: Stepper motor controller
February 08, 2009 12:50AM
Annirak Wrote:
> Oh, and be careful when you make your totem pole
> boost circuit. If you use BJT's, you're very
> likely to short them together: You have two bases
> tied together, one PNP, one NPN, current will flow
> right out of the PNP, into the NPN.

You have to tie the emitters together:
[www.planetanalog.com]
(figure:9(a))

Then, you need to be at least 0.6 of a volt ABOVE the load on the common bases to drive the NPN transistor, and at least 0.6 of a volt UNDER the load on the common bases to drive the PNP transistors. It's used as an easy boost stage for audio, but they put a load sharing resistor between the base pair and the emittor pair in that type of application.


NPN collecter from VCC, PNP collector to Gnd
Graham.
Re: Stepper motor controller
May 21, 2009 05:58PM
Well, I have my all through-hole design about 80% laid out, and the size is a bit of an issue. My stepper driver, implemented in through-hole, takes about 2"x6".

With this in mind, I'm considering a mostly SMD approach. The goal here would be to use all easily solderable devices, so I would ultimately try not to use devices with a pitch of 0.5mm or lower. 0.8 seems to be easily solderable, so that would be my target floor.

Switching to SMD actually means less work for assemblers since it removes the need to drill PCBs, but it will mean a bit more skill is necessary for assembly.

Any comments?
Re: Stepper motor controller
May 22, 2009 06:43AM
Hi Brendon,

My real estate designated for steppers comes to about 4"x6", but that's with the L298s. and 4 axis. I used KiCad, which doesn't rubberband like Protel, so it's a lot more tiresome trying to compact things.

I really like the look of the L6228Q by ST, I know you wanted to use L293 and separate boost stage on the same PCB but I still like my approach.

If I need, I can configure my stepper drivers to run 2 x DC motors bidirectionally per stepper channel, and if 30 volts x 2 amps continous isn't enough, then I can run the output to the bases of totem pole transistors to boost the current as required.

I used UF 1 amp diodes on my PCB, reasoning that the peak currents are very brief duration, and I haven't noticed them even getting warm yet. If you use L293D or something like the L6228Q, then you don't need the 8 external diodes per motor for an unboosted drive. The L293D is only rated at 0.6 amps continous from memory.

The critical factor, in my opinion, is to have dedicated logic to prevent same channel, same winding, same side high and low turn on at the same time... and the charred chip smell !
After that, if you design for a custom market, you pick the precisely sized chips with an over design safety margin, else you are guessing ?

If your board is filling a niche connected to one of Zach's designs, then you are reliant on:
A) volume sales of Zach's design to pay back any personal investment in money and time that you may want to recoup.
cool smiley an agreement with makerbot for supply of your board to their customers (easy route)
C) no second sourcing of product by others to fill your niche.
D) alternative markets.

From my personal point of view, aftermarket add ons are brilliant.
To have maximum utility, coupling a motor driver with a micro, and dedicated encoder high speed motor inputs, with an RS485 or I2C bus would provide a good solution, as information could be sent on linear acceleration profiles, with synch, and then the board could be left to do it's own thing. However, this relies on that functionality not being present in the master, or the interface would never need to be created at a high level.

Is high current stepper motor drive something yearning for a solution ? has it already been solved ?

I think Brendon, that if you want a project of merit, then the next big one is a good solution for 3D scanning. Bats, whales and Dolphins have solutions.

On a personal basis, apart from still being very pleased with my own board, I have a minor concern, that it's awkward to implement more than the 2 axis spare opto encoder channel pairs that I already allocated to my board, without either wasting servo drive I/O, resorting to serial port expansion and lower speeds, or using an FPGA to replace/shadow port my LCD interface.

Those servo motors don't accelerate like DC motors yawning smiley

Good luck in whatever you decide...
Re: Stepper motor controller
May 25, 2009 12:37PM
Hi Graham,
I described my goals for this project in my first post. Microstepping is one of them. High current drive is a second. Why is this important? Well, it will lead to more motor options, not less. The more options, the better.

grael Wrote:
-------------------------------------------------------
> Hi Brendon,
>
> My real estate designated for steppers comes to
> about 4"x6", but that's with the L298s. and 4
> axis. I used KiCad, which doesn't rubberband like
> Protel, so it's a lot more tiresome trying to
> compact things.

I tend to do most of my compacting in the rat's nest stage. I just have 5+ years of practice at it. That being said, I'm used to working on 4 layers and I'm trying to do this on 1.

> If your board is filling a niche connected to one
> of Zach's designs, then you are reliant on:
> A) volume sales of Zach's design to pay back any
> personal investment in money and time that you may
> want to recoup.
> cool smiley an agreement with makerbot for supply of your
> board to their customers (easy route)
> C) no second sourcing of product by others to fill
> your niche.
> D) alternative markets.

Whoa, what happened? I'm trying to advance the technology in use by Reprap, not make money off of it. Why do you think I'm posting schematics, etc? I'd say that the ideal result would be my designs being adopted by RRRF. I don't think that's particularly likely, but at least I can provide an alternative build path.

> From my personal point of view, aftermarket add
> ons are brilliant.
> To have maximum utility, coupling a motor driver
> with a micro, and dedicated encoder high speed
> motor inputs, with an RS485 or I2C bus would
> provide a good solution, as information could be
> sent on linear acceleration profiles, with synch,
> and then the board could be left to do it's own
> thing. However, this relies on that functionality
> not being present in the master, or the interface
> would never need to be created at a high level.

This is why I'm also trying to define a communication standard within RepRap. I saw that problem coming.

> Is high current stepper motor drive something
> yearning for a solution ? has it already been
> solved ?

That's not really the point. I have a more elegant solution than what has already been done. It uses a self-chopping current controller, and all N-FETs.

>
> I think Brendon, that if you want a project of
> merit, then the next big one is a good solution
> for 3D scanning. Bats, whales and Dolphins have
> solutions.

3D scanning is a significantly more complex problem than you think. The issue is not simply performing the scan, it's more than that. Reprap can build structures with cavities. Most existing scanning technologies don't do that (ground penetrating radar excluded). This is not my field of expertise. Control systems are my field of expertise. I'm trying to develop a platform which would be conducive to adding multiple varieties of toolheads, including scanners.

>
> On a personal basis, apart from still being very
> pleased with my own board, I have a minor concern,
> that it's awkward to implement more than the 2
> axis spare opto encoder channel pairs that I
> already allocated to my board, without either
> wasting servo drive I/O, resorting to serial port
> expansion and lower speeds, or using an FPGA to
> replace/shadow port my LCD interface.

I wouldn't use an FPGA until you've exhausted the possibility of using a CPLD. Xilinx's line of XC9500XL CPLDs has a lot to recommend it, including 5V tolerant inputs. The smallest one costs a mere $1.41. That's why I'm using it as the control logic for my steppers.
Re: Stepper motor controller
May 26, 2009 06:09AM
> Whoa, what happened? I'm trying to advance the
> technology in use by Reprap, not make money off of
> it. Why do you think I'm posting schematics, etc?
> I'd say that the ideal result would be my designs
> being adopted by RRRF. I don't think that's
> particularly likely, but at least I can provide an
> alternative build path.

I'm not sure where Reprap design is at currently.

Zach was very active in developing recent generations of electronics, and looking back at the old reprap forum threads, I can see he grew in his skills alongside Reprap.

Zach has seen the enthusiasm generated by the open source theme, and is working to maintain that as far as I understand. Personally, I'm a little uncomfortable with the idea of making a living in that way, because when I've had my own business, trade secrets are often a vital edge, and protect personal/company investment.

So, I'm sitting on the fence on that at the moment. In terms of the core RRF's forward thinking, from what I can see, they are supportive of Zach, and have no overwhelming reason to suddenly move to a different hardware and software platform.

Perhaps you are the next one to push open source hardware on for the RRF/reprap community ?

In terms of my personal thoughts on the matter of open source versus closed source, you've got to have secrets worth stealing in the first place. If you do, then probably someone somewhere can make it cheaper, faster, and market it better than most of us. The idea of using microcontrollers and closed source is what attracted me to microcontrollers initially. I invent, and trade secrets are generally more effective and cheaper than patents. Especially, I prefer profits to go to me, rather than patent attorneys. I'm not reliant on profit from my board at present, but I've put a lot of work into my design, as you know, and I'd like to see a positive net return on my efforts ultimately.

Give it another couple of decades, and our efforts today will seem puny, far better will most likely be open source with negligible hardware purchase cost.

Getting there is part of the fun though.
Re: Stepper motor controller
June 10, 2009 02:55PM
Hi all,
I'm developing a microstepping driver and my schematic looks very similar as the one Annirak posted. I use MEGA8535 and instead of the OPAMs, I use the ADC port to comparate. The problem is that when I increase the velocity in the motor everything mess up, the motor got desynchronized. To fix this I have to increase the supply voltage and the velocity at same time. I think the problem is the time that the coil need to change of state (from I to -I) is too slow, somewhere I found that between any change of state I have to TURN OFF all the MOSFETs(H Bridge), is this right? Any one?

Annirak, could you help me? what does your code do?

My pseudo code is like

Adc1_comp = 30 // ref voltage1
Adc2_comp = 30 // ref voltage2

Do

Adc1 = get adc0
Adc2 = get adc1

If Adc1 > Adc1_comp Then
Decr PWM1
Elseif Adc1 <= Adc1_comp Then
Incr PWM1
End If

If Adc2 > Adc2_comp Then
Decr PWM2
Elseif Adc2 <= Adc2_comp Then
Incr PWM2
End If

if clicked button1
increase COMP_REG_TIMER2
else if clicked button2
decrease COMP_REG_TIMER2
end

Loop

timer2_on_comparator: //Enter here every X us, when timer2 = COMP_REG_TIMER2
CHANGE_STATE (N) //N = 0,1,2,3,...,7
end

This code doesnt have the chopping method, first I want to keep the current higher in HALF-STEP, then I go for changing Adc1_comp and Adc2_comp to form the SENOID

ThankS, any advise?
Re: Stepper motor controller
June 11, 2009 02:59AM
You will probably find you don't have time to control the coil current by doing analogue to digital conversions on the feedback voltage, It's almost certainly too fast a voltage rise, especially when your processor is busy doing other things too. If you want to take an approach like that, see if you can set up those input pins to do a comparator function against internal voltage references, and then experiment with changing the reference voltage, and the on/off periods.
Sorry, only registered users may post in this forum.

Click here to login