# 9-phase generator without a microcontroller (it works, but phases aren't where I expected)

#### carebare47

Oct 21, 2010
66
Hello,

A friend and myself are trying to build a brushless outrunner with a driver for a university project. The motor is being cut from sheet metal at the moment (my friends task), and I am building the driver. The motor has nine windings, so we thought we'd attempt a variable frequency 9-phase driver for it. I'm sure there is a good reason that this isn't commonly done but I don't know what that reason is yet, so we thought we'd find out.

The circuit I have designed is based around the superheterodyning of two 9-gate ring oscillators, and works as follows. A 9-gate ring oscillator (comprised of two 74HC14s) generates nine phases at about 6MHz. To slow this down, I have added resistors in between the gates and capacitors to ground on each gates input (1k, 100nF). This brings the frequency down to about 600HZ. A second, identical ring oscillator is running next to it. Every output of one ring oscillator goes to one of nine superheterodyne mixer circuits ( http://www.strangeapparatus.com/images/0ef9d08e2c4d897b93564c23e3001bfc_2qtt.jpg ). The other input of each mixer circuit is fed by one gate of the other ring oscillator. A simple envelope filter is used to further remove the high frequency component from the output of each mixer.

The voltage on one ring oscillator is varied slightly, changing its frequency. The mixer circuits gives the sum and difference of each waves frequency, and filters off the sum to give only the difference. When the oscillators are at the same frequency, there should be no output from the mixers (confirmed). If the difference in frequency of the two oscillators is 10Hz, then the output wave would be 10Hz (also confirmed). The result should be nine variable frequency phases.

The problem that I am having is that the phases aren't at ninths of a wave. I would have thought that (all being compared (or mixed) with one gate of the other oscillator), taking the signal from mixer one (connected to gate one of the oscillator) as my reference, signal two would be 40 degrees off, signal three would be 80 degrees off, signal four would be 120 degrees off etc...

I have attached an oscilloscope output of the first four signals. The bottom trace is signal one, second to last is signal two etc.

I am worried that component tolerances, or variances in the propagation delays of the not gates in the oscillators are causing the problems. I've measured the phases of the signals going into the first few mixers (so coming out of the first few gates), some of which are the expected 40 degrees apart and some of which are closer to 180 degrees apart. I don't understand this, as surely the outputs of a 9-gate ring oscillator would all be one ninth of the frequency of the oscillator.

If it turns out that nine phase is a stupid idea, then the circuit can easily be scaled down to three phases, but I fear I would still have the same issues. And nine phase sounds cool!

Any help would be greatly appreciated.

Many thanks,

Tom

#### Attachments

• NewFile1.png
50.4 KB · Views: 89
Last edited:

#### CDRIVE

##### Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
You did a very good job of providing a detailed description of your project but you know that we speak schematic here.

Chris

#### carebare47

Oct 21, 2010
66
Thanks. I thought you might say that I'll make one now.

#### CDRIVE

##### Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Thanks. I thought you might say that I'll make one now.
You mean it's all stored in your head right now or is it scribbled on multiple bar napkins? The attachment is my design. It was developed after many years of design in environments less than conducive for intellectual thought. I call it the Lazy Z.

Chris

#### carebare47

Oct 21, 2010
66
It was all in my head, but I love the bar napkin idea I'll even employ the Lazy Z next time I'm out and get struck by inspiration.

Attached is the schematic I've just put together. The two ring oscillators have seperate supply voltages (one fixed at 5V, the other variable at around 5V). The nine phase outputs are the unattached wires coming out of the superhet mixers (pointed to by the diodes).

#### Attachments

• 9phase2-1[1].png
658.2 KB · Views: 96
• 9phase2-1[1].png
658.2 KB · Views: 94
Last edited:

#### carebare47

Oct 21, 2010
66
Electronics point has compressed the image, here's one with the original resolution. Still a little blury due to conversion from PDF but should be significantly better.
http://postimg.org/image/tt64hp565/

#### carebare47

Oct 21, 2010
66
To clarify, each ring oscillator is made up of two 74HC14. All six gates from one, and three gates from the other. There are two of these oscillators, consisting of a total of four 47HC14.

Last edited:

#### (*steve*)

##### ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,505
I would recommend that you look at a twisted ring counter (AKA Johnson ring counter). If made with 9 stages and driven at 18x the desired frequency it will produce 9 outputs with the phase relationship you want.

An advantage of the twisted ring counter is that only one stage changes on any clock pulse so the incoming clock frequency can often me much faster than for similar counters.

See here.

Note that a special case of a twisted ring counter is a 2 bit version, also known as a quadrature generator.

#### CDRIVE

##### Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
To clarify, each ring oscillator is made up of two 74HC14. All six gates from one, and three gates from the other. There are two of these oscillators, consisting of a total of four 47HC14.
Not to be picky but it's improper or rather a misnomer to refer to the 74HC14 as a Gate. On the other hand it's New Years morning here. So it might be acceptable at the moment.

Chris

#### CDRIVE

##### Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
I would recommend that you look at a twisted ring counter (AKA Johnson ring counter). If made with 9 stages and driven at 18x the desired frequency it will produce 9 outputs with the phase relationship you want.

An advantage of the twisted ring counter is that only one stage changes on any clock pulse so the incoming clock frequency can often me much faster than for similar counters.

See here.

Note that a special case of a twisted ring counter is a 2 bit version, also known as a quadrature generator.

Steve, that's a nice link. It's well structured. Along with the graphics I actually was able to understand it. At the moment my head feels like someone embedded steel shrapnel in my head and then shoved me in an MRI!

Chris

#### carebare47

Oct 21, 2010
66
Happy New Year everyone! Thank you all very much for having a look at it. Very useful page you linked. I can see that it says a 3-stage Johnson (twisted) ring counter can be used to generate three phase (although I don't totally understand this), and so it could be used to generate nine phase too (although I don't quite get this yet either).
I can understand, however, how a 9-bit ring counter could be used to generate nine phase. As long as the circuit startup sent a clear pulse to all the counters first, and then shortly after sent a pulse to one of the inputs in the counter before the clock started up.

Would the standard ring counter work, or would a twisted ring counter be better?
This looks like a significantly better solution (even though I'm attached to my superheterodyned ring oscillators idea). This could be implemented entirely with a few D-type flip flops, as opposed to a breadboard packed full of superhet mixers (and a separate one for the ring oscillators). My current frequency range using superhet ring oscillators is about 2Hz to 30Hz, whereas (as far as I understand it) I could set the clock frequency of the ring counter circuit to anything I liked.

Also, thanks for pointing out that gate isn't the preferred term. Is schmitt trigger more suitable?

To conclude, is there something I'm missing in wanting to use a standard ring counter instead of a twisted ring counter?

#### carebare47

Oct 21, 2010
66
Also, I don't suppose anyone has any insight on why the ring oscillator I have at the moment isn't giving outputs at 1/9th the total frequency? I'm probably going to have to go with ring counters instead due to the very wide frequency range they will run at, but it would be nice to know what I've missed on the current circuit.

#### dorke

Jun 20, 2015
2,342
Also, I don't suppose anyone has any insight on why the ring oscillator I have at the moment isn't giving outputs at 1/9th the total frequency? I'm probably going to have to go with ring counters instead due to the very wide frequency range they will run at, but it would be nice to know what I've missed on the current circuit.

Something doesn't compute
1. You say 600 Hz,but your scope says 2Hz,which is it?
2. Two adjacent points in the ring osc. (i.e input and output of a s.t gate)should be inverted(see the white trace I added instead of the yellow one) they obviously aren't.
Are you measuring at the correct points?

#### Attachments

• NewFile1.png
45.4 KB · Views: 87

#### Alec_t

Jul 7, 2015
3,242
Also, I don't suppose anyone has any insight on why the ring oscillator I have at the moment isn't giving outputs at 1/9th the total frequency?
Not sure what you mean by the "total frequency", but each stage introduces a phase shift of 180 + 180/9 = 200 degrees (neglecting propagation delays within the inverters). That is not 1/9 of the period of either input frequency.

#### dorke

Jun 20, 2015
2,342
Not sure what you mean by the "total frequency", but each stage introduces a phase shift of 180 + 180/9 = 200 degrees (neglecting propagation delays within the inverters). That is not 1/9 of the period of either input frequency.

Alec,
the cycle is composed of 2*Td*9 .
There is no input frequency it is a ring osc.

#### Alec_t

Jul 7, 2015
3,242
Oops. "Input" should have read "ring".

#### (*steve*)

##### ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,505
To conclude, is there something I'm missing in wanting to use a standard ring counter instead of a twisted ring counter?

Actually, thinking more clearly now, a 9 stage twisted ring counter will give you signals that are 1/18 of a cycle apart.

The standard ring counter will give you a 1 chasing around the loop (if properly initialised). If that is what you actually want, then look at the 4017 instead!

#### carebare47

Oct 21, 2010
66
Dorke, the 2Hz is the output of the superheterodyne mixer, which is the difference in frequency of the two input signals. If one input signal is at 600Hz, and the other at 598Hz, then the output frequency of the mixer would be 2Hz. I think I need to further investigate/understand the outputs of the ring oscillator (inputs to the mixers), I don't think the oscillator did quite what I thought it would do. The ring counter is more what I need.

Alec, I meant total delay instead of total frequency, as opposed to the delay of one schmitt trigger/RC combo. I shall attempt to be more concise in the future

Steve, a logic 1 chasing around the loop is exactly what I'm after (which I originally thought the ring oscillator could provide, and if that isn't what it does then that's where my errors are coming from). The ring counter is variable frequency too, which makes things significantly simpler.

So in the morning I'll make up a three gate ring oscillator so that I can scope all of its outputs at once to properly understand what it's doing. Then I'll scrap that completely, order some D-type flip flops and build a ring counter instead (with initialisation circuit).

Thank you all for your help

#### dorke

Jun 20, 2015
2,342
I think a Universal shift register would serve you much better:
1.You will be able to load any initial pattern (a chasing one included).
2.It will allow you to reverse the rotation movement of the motor in a very simple way by changing the shift from say Right to Left or vice versa.

For experimenting with 3 phase, a single 74HC194 will do the trick...
You need to create the ring by connecting like this:
DSL=Q0, DSR=Q2 (note 2 not 3! for 3 phase!) outputs are Q0,Q1,Q2.

It can be easily expanded to any number of bits by cascading ICs.

.

Replies
0
Views
1K
Replies
1
Views
2K
Replies
11
Views
1K
Replies
4
Views
805
Replies
3
Views
733