How can I make an oscillator with 3 capacitors?

Thread Starter

Electric-Gecko

Joined Dec 10, 2016
56
I need to create an oscillator circuit that works like the following:

There are 3 capacitors of equal value. One capacitor charges until it reaches a threshold voltage, and then it is instantly discharged and then the next capacitor gets to start charging. The cycle continues. Only one capacitor gets to charge at a time.

Therefore the oscillator alternates between three states. I've tried to design circuits like this using transistors on Ngspice, but they didn't work.

Is there a way to do this using transistors? Is there a way to do this with a 555 timer? I don't need a crazy high frequency. Even 200 kHz would be enough.

I want to be able to separately adjust the charging time of each capacitor by varying the supply voltage at the other end of the resistor that charges the capacitor.
 

Thread Starter

Electric-Gecko

Joined Dec 10, 2016
56
Thank you. This isn't exactly what I wanted, as it has only one capacitor at a time at 0 volts instead of two, but I might be able to rework it. It's a good reply. I also have another use for this one.

One concern I have is that variation in turn-on voltages between the mosfets would throw-off the timing. Perhaps this can be solved by placing comparators between the MOSFETs.

Unfortunately, the waves weren't as clean in my simulation of it. That's without the comparators.

Now I need to figure out the mathematical relationship between the timings and the voltage at the positive end of each resistor.

Why do you NEED to do it this way?

What are the ACTUAL needs? Where do they come from?
What I'm asking for is an oscillator that alternates between 3 states, with the timing of each state varying based on the voltage used to charge it's respective capacitor. The timing of each state should be (roughly) inversely proportional to the voltage used.

This isn't necessarily the only way to achieve the desired timings for my project, though it's likely to be the simplest. I already made another post about my project where I would be happy to see alternative ways to achieve the desired timings, but that thread went off-track. I started this one specifically to get help on this one idea. I want this thread to stay on-topic.
 

MisterBill2

Joined Jan 23, 2018
18,442
That same ring-oscillator concept could work with 555 timers, or even CMOS gates. And there could be added individual pre-charge resistors for each of the three timing capacitors. OR, if the frequency is not excessive, it could be done with counters in a micro. But that would need a digital control signal.
 

LesJones

Joined Jan 8, 2017
4,188
Have you considdered using a micro controller ? A few years ago I made one using a PIC16F88. It was to sequence 4 solenoid valves. It worked by reading the voltage from 4 potentiometers and that controlled how long it remained in each state. Here is the schematic. It could be easily modified for 3 channels and to work at a different frequency.
This is the schematic.
sequencer.png
If it is of any interest to you I can post the source code.

Les.
 

Alec_t

Joined Sep 17, 2013
14,312
What I'm asking for is an oscillator that alternates between 3 states, with the timing of each state varying based on the voltage used to charge it's respective capacitor
Do you mean that the oscillator output voltage is at three different fixed levels, each level lasting for a period set by a respective voltage?
 

MisterBill2

Joined Jan 23, 2018
18,442
From post #1 we see also that each segment is to be separately adjustable.
So now a fundamental question: just WHAT is the important variable?? Is it the slope of each capacitor charge voltage curve? OR is it the time that each segment is active, as in an ON/OFF pulse? Or something else?? The 555 solution was first published in a 555 applications contest results back shortly after it was first released.
Next question: What is the application for this oscillator?
 

Thread Starter

Electric-Gecko

Joined Dec 10, 2016
56
So I've done plenty of experimentation with various ways of doing this. I've come up with multiple ways of implementing this using logic gates. However, none of the methods I have come up with have worked in Ngspice so far. It seems to have trouble simulating a set of identical components in a ring configuration. In a few days I will go buy some logic gates and other components to try breadboarding some arrangements.

I have also thought about making a ring counter with flip flops. Unfortunately I have not found any flip flop SPICE models. With a flip-flop implementation, would it work to use each pulse of a comparator's output as the clock?

Making the duty cycle of each step proportional to a control voltage rather than inversely proportional would work equally well if not better, but I couldn't think of a way to do it at first. But now I have thought of a way of doing it; by putting the reference voltage on the inverting input of a comparator.

Here is the latest of multiple attempts I've made. It's the first one where the duration of each step is supposed to be proportional, rather than inversely proportional to the reference voltage.
3-step oscillator_cropped.png
Once again, this one failed simulation. If it works as it's supposed to, only one of the NOR gates will be on at a time, in which it will charge it's respective capacitor up until it's at a higher voltage than the reference voltage. One of the OR gates will then turn on, causing the NOR gate to switch off and the next NOR gate to switch on.

The capacitor will discharge slowly during the subsequent step, but then brought down to zero in the step after that to make sure that it's at 0V when it starts charging again.

Will my circuit above work? Will the duration of each step be proportional to the reference voltage?

Have you considdered using a micro controller?
I have, but that would be a last resort, as I want high-frequency switching with fluctuating reference voltages.
 

LesJones

Joined Jan 8, 2017
4,188
I think a variation on the suggestion in post #5 using comparitors (Such as an LM339) in place of the 2N7002s would do what you require. Connect the inverting input to the top of the capacitor and connect the control voltage to the non inverting input. In one post I think you say that you only need it to work at about 200 hz. You should be able to achieve this using a microcontroller.
It would be helpful if you told us the purpose of this circuit.
I re read you post and you said 200 Khz so that makes it more difficult. That would require a micro with a fast ADC and the comparitor idea whould require faster comparators than the LM339. What is the minimum time period that you require for each state ? Would the frequency be constant (The sum of the three states always be the same.) ?

Les.
 
Last edited:

MisterBill2

Joined Jan 23, 2018
18,442
I think a variation on the suggestion in post #5 using comparitors (Such as an LM339) in place of the 2N7002s would do what you require. Connect the inverting input to the top of the capacitor and connect the control voltage to the non inverting input. In one post I think you say that you only need it to work at about 200 hz. You should be able to achieve this using a microcontroller.
It would be helpful if you told us the purpose of this circuit.
I re read you post and you said 200 Khz so that makes it more difficult. That would require a micro with a fast ADC and the comparitor idea whould require faster comparators than the LM339. What is the minimum time period that you require for each state ? Would the frequency be constant (The sum of the three states always be the same.) ?

Les.
Back at post #1, the intended max frequency is a bit higher: " I don't need a crazy high frequency. Even 200 kHz would be enough. " so it would take a much higher performance than the average cheap small processor module.
AND, it looks like "B" has got it with the circuit in post #14.
Yes, substituting open collector comparators for the 3 2N7002 seems like a good plan, All in one package devices should be quite similar. Four 14 pin ICs and really not that many discreet components, and no diodes or transistors to get inserted wrong. A quite good design.
 

Thread Starter

Electric-Gecko

Joined Dec 10, 2016
56
Thank you for simulating this for me. It looks like it mostly works as it's supposed to. You connected the MOSFET gates differently than I did, but that's fine if it still works.

Are the duty cycles accurate? Ideally, with the reference voltages you provided, Y3 should get half the duty cycle, as 3/(1+2+3)=0.5.

I imagine that the duty cycles may end up being more uneven than ideal because with the rather low voltage used to charge the capacitors, the charging current wouldn't be constant, but would slow down as the capacitor voltage reaches the charging voltage. I can think of 4 changes that can be made that may improve the accuracy of the timings:
  • Option 1A: Put a current limiter on the VCC pin of the SNHC02 to limit the current at which the NOR gates charge the capacitors. However, this would lead to the voltage across this IC fluctuating at a high frequency. I'm not sure if this would interfere with it's proper functioning, given how unusual that is. The current limit shouldn't be set too low, as we want the IC to stay within it's recommended operating conditions. 2 to 6 volts is recommended in the datasheet.
  • Option 1B: Like the one above, but instead of current limiting the NOR gates through the VCC pin, the capacitors would be charged using a current-limited buffer with a higher supply voltage. I don't know if this should be an IC or made of individual transistors.
  • Option 1C: Like the above, except that instead of a digital buffer, we use a 9V opamp to charge the capacitor with a diode connected from the capacitor to the noninverting input to limit the current. There are a few methods I have in mind to get 9 volts into the opamp input even when the SN74HC02 only outputs up to 6 volts. I can post a picture if this idea is liked, but it's more complicated than the option above.
  • Option 2A: We go back to my previous idea of making the charging times inversely proportional rather than proportional to the input voltages. The overall goal is to have each duty cycle equal to it's associated reference voltage divided by the sum of the three voltages. In this case, each capacitor is charged though two resistors connected to the other two reference voltages. Because this method allows the capacitor to be charged with voltages higher than 6 volts, it may be possible to get more accurate timing than Option 1A. Here is the what this option looks like:
    alternative-oscillator_cropped.png
    In this version, when all the reference voltages go up, the frequency of the whole cycle increases. The versions that put the reference voltage on the inverting input of a comparator instead have the frequency go down with increases in voltage.
  • Option 2B: Like Option 2A, except that current mirrors are used to for constant charging currents. This would require the current mirrors to be balanced. I'm not sure if this is feasible though.

Tomorrow I'll be back in my home city, and I will buy some components to attempt to breadboard multiple variants of this.

I've also thought about trying a version that only has one capacitor charging and discharging, but with different reference voltages being switched on and off. However, I probably won't attempt that unless the other ideas don't work well enough.
 

Attachments

Top