0
\$\begingroup\$

I have to regulate a sinusoidal current in an inductor.

I have only a DC supply.

There are many ways to do it like using stepper motor driver to regulate step wise sinusoidal in 1/256th step mode.

For a specific application, I want to regulate the current by changing the duty cycle of the input PWM to a half-bridge.

If I can generate PWM pulses with a changing duty cycle in sinusoidal way then I'll be able to regulate the current.

I tried using a BeagleBone and an Arduino to generate PWM with a sinusoidal duty cycle, but wasn't able to do that. Mistakenly I had uploaded wrong drawing, now corrected.

enter image description here

I don't have waveform now to upload. But I can paste the beaglebone code I tried.

import Adafruit_BBIO.PWM as PWM 
import time
import math 

Ain1 = "P9_14"
duty=50 # initial value

sin_frequency=100
pwm_frequency=10000
pwm_period = 1.0/pwm_frequency
print("pwm period : ", pwm_period )

PWM.start(Ain1,0)
PWM.set_frequency(Ain1, pwm_frequency)
PWM.set_duty_cycle(Ain1, 0)

count=0
no_pulses=(0.5*pwm_frequency)/(sin_frequency)
print("number of pulses : ", no_pulses)
a=1

while True:
    duty= abs(10.0*math.sin((3.14*count)/(no_pulses)))
    PWM.set_duty_cycle(pin, duty)
    time.sleep(0.1*pwm_period)
    count=count+1
    print(duty)

    if count>=no_pulses:
        count = 0
        duty=0


PWM.stop(Ain1)
pwm.stop(Ain2)
PWM.cleanup()
print("Closed the pwm")
\$\endgroup\$
7
  • \$\begingroup\$ Why weren't you able to that ? Can you post the existing circuit and code as well as any wave forms captured in scope ? Your question contains too few details of things that are already setup and things that have already been tried and their results. Did the beagle bone and arduino setups fail in the same way ? If they did, focus your question to any one of them. \$\endgroup\$
    – AJN
    Commented Apr 25, 2021 at 7:54
  • \$\begingroup\$ Are you able generate a pre-determined steady current in the inductor with fixed PWM pulse width now ? Why are the inputs to the transistors labelled HIGH AND INPUT PWM ? Is the top transistor always ON ? Then you would be shorting the power supply when the lower transistor turns ON during the PWM pulse goes HIGH ? \$\endgroup\$
    – AJN
    Commented Apr 25, 2021 at 7:59
  • \$\begingroup\$ High mosfet is PMOS so that is always off. When low side NMOS is ON current will build in coil, when OFF current will circulate through the body diode and decay gradually. \$\endgroup\$ Commented Apr 25, 2021 at 15:52
  • \$\begingroup\$ What's the point of the PMOS then? \$\endgroup\$
    – Transistor
    Commented Apr 25, 2021 at 15:53
  • \$\begingroup\$ You are right. It doesn't need a PMOS. Only a diode would be enough. I am just using body diode of the fet instead of using a separate diode. Because in design a diode is nothing but body diode of a fet. Since it is PMOS I can tie its gate to supply permanently. \$\endgroup\$ Commented Apr 25, 2021 at 16:03

1 Answer 1

2
\$\begingroup\$

Your circuit won't work because you have a dead short across your supply: -

enter image description here

If you want to approach it this way you need to use a full H-bridge: -

enter image description here

Note that I haven't shown the flyback diodes on the right-side transistors because the bulk diodes in the two MOSFETs serve that purpose.

Of course, if you already have a sinewave signal you could use a PWM modulator such as the LTC6992: -

enter image description here

\$\endgroup\$
2
  • \$\begingroup\$ Thanks Andy aka, I'll try this IC and it should do the job. I didn't plan to use discrete components. Was trying to get it done with microcontroller. But this looks simple to me and hopefully would work. \$\endgroup\$ Commented Apr 25, 2021 at 15:57
  • \$\begingroup\$ You also should probably explain a little more about the application. driving a solenoid this way takes some care @AnandYadav \$\endgroup\$
    – Andy aka
    Commented Apr 25, 2021 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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