# Stepper motor locked to mains supply frequency

Thread Starter

#### richard3194

Joined Oct 18, 2011
141
I'm making a strip chart recorder with a stepper mptor . Say you want a fair degree of accuracy regarding paper feed over a period of say a day or indeed several days.

Is there a way, or a circuit, to lock the frequency received by the stepper motor to the stable and accurate ac mains?

Seems the way to go to get good precision in the paper feed. Thanks.

#### chrisw1990

Joined Oct 22, 2011
551
theres no such thing as a stable and accurate mains..

Thread Starter

#### richard3194

Joined Oct 18, 2011
141
Of course, if I make the frequency to the stepper variable I can establish (by trial and error) the frequency that produces the required precision of feed over a day or more.

But, that frequency needs to be stable. I am wondering whether the frequency to the stepper ought to be locked to ac mains.

#### GetDeviceInfo

Joined Jun 7, 2009
1,642
don't know what your loading is, but those small synchronous motors that drive your humidifier drums are relativley cheap at a hardware store.

Thread Starter

#### richard3194

Joined Oct 18, 2011
141
theres no such thing as a stable and accurate mains..
Hi.

You know, I always assumed that ac mains was a good stable reference point, probably because I know synchronous motor clocks keep time accordimng to ac mains.

But, you are right, it's not exceedingly stable.

http://jorisvr.nl/gridfrequency.html

I suppose then locking the stepper motor frequency may have no advantage.

#### Potato Pudding

Joined Jun 11, 2010
688
Use a crystal oscillator. That will give you quartz watch precision which is going to be plenty and assuming you are using a Microcontroller, the crystal setup is going to require less than a dollars worth of parts added to the Microcontroller circuit.

You will also want to consider using a MicroSD Card interface data recorder instead of a strip chart. For the $5 of a MicroSD card with 2 GB you would need maybe a hundred dollars worth of paper rolls and the paper would add nothing to the accuracy or the usefulness of the data. The best use for a strip chart recorder would be as a movie prop. To be fair it is also good for legal substance purposes. Signed, dated, documented, and vaulted; they can be used as evidence to counter claims of falsified data. The SD card is still where I would look for the data. #### praondevou Joined Jul 9, 2011 2,942 I would also prefer a crystal oscillator. But if you want to lock your motor to mains, you can extract the mains frequency by simple connecting a step-down transformer to it, pass the output through two resistors and then 2 antiparallel diodes, which you connect to the inputs of a single supply comparator. If you supply it with 5V you will a have (almost) 5V square wave at the output of the comparator, which you can use to synchronize your motor. #### thatoneguy Joined Feb 19, 2009 6,359 theres no such thing as a stable and accurate mains.. In the US, over a period > 1 day, the mains have been extremely accurate. Many stoves, microwaves and even alarm clocks keep time by using the mains frequency as the clock. However, it was announced recently (last spring or fall?) that they will no longer be holding US lines to the same accuracy (parts per million), and the frequency will be accurate in the parts per thousand region instead. Reason for the change was something to do with alternative energy connectivity, but it that doesn't fully make sense, other than the .gov doesn't have full control over alternative energy devices feeding the grid in order to perfrom frequency correction. #### chrisw1990 Joined Oct 22, 2011 551 In the US, over a period > 1 day, the mains have been extremely accurate. Many stoves, microwaves and even alarm clocks keep time by using the mains frequency as the clock. However, it was announced recently (last spring or fall?) that they will no longer be holding US lines to the same accuracy (parts per million), and the frequency will be accurate in the parts per thousand region instead. Reason for the change was something to do with alternative energy connectivity, but it that doesn't fully make sense, other than the .gov doesn't have full control over alternative energy devices feeding the grid in order to perfrom frequency correction. ahh well my apologies! iv just always been told - mains = not stable =] #### thatoneguy Joined Feb 19, 2009 6,359 ahh well my apologies! iv just always been told - mains = not stable =] That is somewhat true in Europe and many other countries. The US has always had a thing about 60Hz line power being exactly 60Hz. #### BillB3857 Joined Feb 28, 2009 2,501 My understanding was that the 60hz in the United States was accurate OVER TIME. Instantaneous accuracy was not quite that exact. Check out this site...... http://leapsecond.com/pages/mains/ #### thatoneguy Joined Feb 19, 2009 6,359 My understanding was that the 60hz in the United States was accurate OVER TIME. Instantaneous accuracy was not quite that exact. Check out this site...... http://leapsecond.com/pages/mains/ True, over the period of a day, the average is 60.00000 Hz Looking at a 60Hz timebase for something, you get from 60.005 to 59.995 Hz, which is still quite a bit closer than EU electricity grids. A crystal in an oven is the most accurate "hobbyist" level time source, a non-temp controlled crystal has more drift over time than the 60Hz mains do. It'd be cool if Cesium fountain clocks get down into the sub$200 range, though they'd still be a bit bulky to fit into a project.

In the meantime, OXCO with PLL are the most stable you can get without breaking the bank.

Alarm Clocks and clocks on stoves never drift more than a minute away from the correct time between changing between DST and standard time, which is good enough for most purposes.

--ETA: I disagree with his "long period" measurement method of taking the measurement of 1 second every 10 minutes. It should be the sum of cycles over the 10 minute period divided by 600 for each data point. As is, the plot is simply showing second to second stability with the seconds sampled 10 minutes apart, which is far different than "stability over time".

#### THE_RB

Joined Feb 11, 2008
5,438
I did some messing about testing mains freq accuracy (in a rural area of Australia) and found the mains generally within 500 PPM (parts per million error) over any second, with some excursions (corrections?) up to 3000 PPM error for a few minutes.

17 minutes logging mains freq, error shown in PPM;

http://www.romanblack.com/onesec/High_Acc_Timing.htm

I also describe on that page 3 algorithms that can be used to run a microcontroller loosely synced to the mains so it has the better short term stability of the micro, but maintains the long term "sync" to the mains frequency.

Back on topic, I think you could run the stepper motor from a mains transfomer that reduces the mains voltage to a sinewave of lower voltage to run the stepper motor winding A. Then the stepper motor winding B could be coupled through a phase delaying capacitor to the same low voltage AC sine, in a "split-phase" or "capactor-split" style. Assuming a low shaft load on the motor that will probably work fine.

#### colinb

Joined Jun 15, 2011
351
A crystal in an oven is the most accurate "hobbyist" level time source, a non-temp controlled crystal has more drift over time than the 60Hz mains do. It'd be cool if Cesium fountain clocks get down into the sub $200 range, though they'd still be a bit bulky to fit into a project. In the meantime, OXCO with PLL are the most stable you can get without breaking the bank. Don't forget RB's awesomely inexpensive$1 OCXO.

#### thatoneguy

Joined Feb 19, 2009
6,359
Yes, that is an AWESOME "hack", using that term in the most endearing way. We are exceedingly blessed by having THE_RB an active member of this forum!

I really love some of his PIC projects, especially the 8 pin SMPS (waiting for the 3 phase version), and hope he publishes some more soon on his blog! (*ahem* *cough* HINT *cough*)

#### THE_RB

Joined Feb 11, 2008
5,438
Aww shucks thanks guys.

It has been a while (months) since I added project content to my page, I've just been too busy for hobby stuff. It's tough finding half an hour for electronics forum reading!