1
\$\begingroup\$

For an electric car charger I need to design a square wave of ±12V at 1kHz [SAE J1772]. I would like to make this one with a adjustable duty cycle so that the charging current can be adjusted. I designed the following schematic:

schematic

simulate this circuit – Schematic created using CircuitLab

This design lets me adjust the on time vs the off time but not the duty cycle. Is there a way to realize this? maybe with a programmable IC because the 0-5V square wave will be generated by a micro controller.

\$\endgroup\$
0
\$\begingroup\$

If you use a microcontroller for your square wave, then simply generate your duty cycle from your microcontroller. Most microcontrollers have facilities to generate PWM signal at chosen frequency and duty cycle.

With MSP430, you would Configure your timer to some useful frequency superior to 1kHz. You configure the timer in up mode up to TAxCCR0 (capture compare). (count from 0 up to TAxCCR0 value repeatedly). Then you set to TAxCCR0 register to a value that will cause the frequency to be 1kHz. Typically, you want a clock of say 100 kHz. TAxCCR0 set to 100. Then you configure your TAxCCR1 register (second capture compare register) to some value between 0 and 100. This allows you to choose the duty cycle of your PWM between 0 and 100. You finally configure the timer to output TAxCCR1 to some pin in a way such that when timer value (TAxR) is between 0 and TAxCC1, the output is HIGH and when value is between TAxCCR1 and TAxCCR0, your output is 0.

You can change the values, but you get the idea. Other microcontrollers (AVR, PIC, ARM whatever) all have such timer modules. Registers just have different names and slightly different functionality.

Once you generate that signal, simply feed this to your circuit and it will work. By the way, instead of an operational amplifier, you should be using a comparator. It looks very similar, but operational amplifiers are designed for "analog" signals and are therefore usually slower than comparators of same cost/performance. Comparators are designed for digital signals, so they will more likely be "rail-to-rail" for a cheaper price and behave much better with sharp edges (square waves). Operational amplifier's slew rate (output rate of change) may well cause your signal to be distorted. Maybe this opamp you chose works at such low frequencies, I haven't checked at all.

If you want a more analog solution, then we need much more information about how you expect to "set/configure" the duty cycle.

\$\endgroup\$
  • \$\begingroup\$ I know how to create a pwm signal but the ±12V need to be the same duty cycle. So with a 10% duty cycle I thought that it was 10% +12V, 10% -12V and 80% 0V. \$\endgroup\$ – Dylan Mar 20 '18 at 20:26
  • 1
    \$\begingroup\$ You use your operational amplifier as a comparator. Comparators have only two states: HIGH (upper rail) and LOW (lower rail). The only case where you get something in between is for little voltage band were your input signal is almost equal to your threshold. If you feed in a square wave, this should last µs at most. You can completely avoid that using hysteresis, but honestly this won't make a difference in your case since you signal won't wander need that threshold at any point. \$\endgroup\$ – Mishyoshi Mar 21 '18 at 11:49
  • \$\begingroup\$ @Dylan What kind of signal do you actually need? +12V/-12V square wave or some other +12V/0V/-12V waveform? \$\endgroup\$ – JimmyB Apr 4 at 16:12
0
\$\begingroup\$

Do you have control of V9 and V5? If V5 is a constant triangle wave instead of a square wave, the comparison with with V9 will be a 50% duty cycle when V9 is 2.5 V. The duty cycle will increase as V9 decreases and decrease as V9 increases. A sine wave on V5 would also work but the duty cycle would be non-linearly related to V9.

\$\endgroup\$
0
\$\begingroup\$

1)

This design lets me adjust the on time vs the off time but not the duty cycle.

Well, no. The ratio of on time to off time IS the duty cycle. So it's not clear exactly what your problem is.

2) As shown, the duty cycle is fixed at 50%, since V5 is a square wave. If, instead, it's a sine wave, and V9 is variable, you'll get what you want. If your issue is that you can't get a duty cycle less than (or more than, depending on how you measure it) simply make V9 bipolar - that is, make it able to be plus or minus. Since you already have +/- supplies, that should be pretty trivial.

3) Most op amps which run off +/- 12 volts will not put out +/- 12 volts. Generally speaking, you'll need a +/- 15 volt supply. I assume that you did not realize that you can edit things like part numbers in the site's schematic editor, and that you'll actually be using something other than a TL081, but I could be wrong.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.