Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Modify duty at PWM signal

Status
Not open for further replies.

2PAC Mafia

Member
Hello everybody,

I need to create a PWM signal to control speed of a treadmill motor. The signal I need is 3,3V 20Hz and a positive duty from 18,8% to 19,2%. With this signal a microcontroller starts giving different signals on the board, without that exact signal the board is not enabled.

I have a signal generator and I can make this 3,3V 20Hz but the problem is the duty I can get is as a minimum 20% so microcontroller doesn´t recognize it. Can I modify that duty to get the exact positive duty percentage? Just 1% difference... Do you have any idea how to design that circuit if it´s possible?

I know with a microcontroller is possible to get it but I have not experience programming it yet, and no time at the moment to do it, I hope in the future I can start learning on that field.
 
Hi,

I made the circuit at protoboard, I used the first circuit posted. I put 2 potentiometers to get and adjust the output signal instead of R1. Right, everything worked at protoboard so I made a circuit at prototype board, everything soldered and using the same components. The fact is I have an output perfectly at pin 7 but is not switching my transistor to get final output PWM. I supply 9V for IC and 3,3V for transistor. I tested:

- Complete circuit is OK, in fact I have output at pin 7
- Use another transistor but same problem
- Change 555 but same problem
- Change power at both power supplies
- Use an external PWM signal generator with a 12V bulb and same transistor, just to check transistor working, it works.
- Connect pin 7 directly to gate instead of 330 ohm resistor I put, same problem
- Replace 1K resistor by 470 ohm resistor as a final load (instead of motor at scheme)

I don´t know why if I have a proper signal at pin 7 now I don´t get the transistor switching, it worked perfectly at protoboard (without soldering) so next step was to make the circuit soldered... It´s a mistery, maybe you have some new idea because now I´m blocked about this stupid problem.
 
You need to post a circuit schematic to show the transistor connection.
 
Exactly as the one you posted: **broken link removed**

Instead of motor 1K resistor and between pin 7 IC and gate 330 ohm resistor. Drain would be PWM output signal I need to connect at treadmill motor controller just to wake up a microcontroller.
 
Maybe the pins on the Mosfet are mixed up.
The 20Hz frequency is so low that the motor will make a loud hum and will vibrate like crazy. Use an ultrasonic high frequency instead.
 
Thanks, pins are like always 1-G, 2-D, 3-S, correctly connected.

The signal I have to get of 20Hz is to connect at treadmill controller board just to recognize a PWM start signal, then the treadmill controller board is in charge of giving voltage to the motor and manage all functions. The signal I create with this circuit is going to the treadmill connector, to an optocoupler and from it to a microcontroller. It seems the 555 timer output is not enough powerfull to manage the optocoupler, that is the reason why I had to use a transistor. With this circuit I emulate the signal which should come from the user console.
 
The strange thing is that I saw it working, even tested OK with the treadmill board and starting the unit, after that I decided to make the circuit more safety soldering the components and since that I don´t know why the transistor doesn´t switch the PWM signal...
 
The pin 7 of a 555 is the collector of the discharge transistor that goes to ground when it turns on. The resistor from pin 7 to the positive supply pulls it up.
Your circuit had a 10k resistor so with a 9V supply the current from pin 7 to the LED in the opto-coupler was only 0.8mA which is almost nothing. Try 1k.

You do not need a 50A Mosfet to turn on the 10mA LED of an opto-coupler. But actually the Mosfet does not turn on the opto-coupler, the resistor at its drain does that. The Mosfet turns off the opto-coupler. But you tried a 1k resistor then a 470 resistor and both should have worked.
 
You were right!!! I put a potentiometer between voltage and pin 7 so finally with 8,4V and 1,1Kohm I got the signal properly without the transistor and the treadmill board recognized my signal. I don´t know why with the transistor was not working but anyway if it works like this is enough so thanks a lot for your help.
 
Hi,

I have connected two potentiometer in serial to get the value I need for frequency signal (R1 total value) so I needed 200K + 50K. Adjusting 50K I get the 20Hz signal and adjusting 200K I can change the duty. The problem is when I change 200K potentiometer value I can see how frequency is also changing a little bit when duty is changing, so finally the processor is only recognizing a range of speed, as soon as it goes out of the tolerance (in example 22Hz) the board can´t control the speed.

What can I do to stabilize those 20Hz PWM signal to be a fixed value?
 
You need two 555 ICs or a 556. The first one is a 20Hz astable oscillator and the second one is a monostable that makes each pulse.
 
You could try using just the 200k pot for R1 (duty cycle control), then connect the 50k pot as a rheostat from pin 5 to ground as a secondary adjuster (which affects both frequency and duty cycle). You might need to increase C1.
 
Last edited:
Hi,

You need two 555 ICs or a 556. The first one is a 20Hz astable oscillator and the second one is a monostable that makes each pulse.

Thanks, do you have a circuit for that? Anyway I would like to solve it with this circuit as I already have the board prepared and values for that.

You could try using just the 200k pot for R1 (duty cycle control), then connect the 50k pot as a rheostat from pin 5 to ground as a frequency adjuster. You might need to increase C1.

Thanks, the total value I need for getting 20Hz signal is R1 = 242K (this means 200K + 50K connected as a rheostat is serial). If I change those values I get another frequency output. So do you think if I connect a rheostat at pin 5 to ground I will get frequency control too? At the description is saying that pin is for voltage control to affect the timing...
 
The datasheet for the 555 shows that if you change the voltage of pin 5 (with a resistor to ground) then it makes "Pulse Position Modulation" which changes both the frequency and the pulse width of the oscillator. But you want the frequency and pulse width adjustments to be separate.
 
Hi,

I have another idea, I have a frequency generator which goes as a minimum to 20% duty but I need around 19% to wake up the processor. From this generator duty signal, can I make a circuit to modify only the duty? In example I get the output from the signal generator at 20Hz 50% duty, then I would like to have a circuit which modifies the duty up to 10%.
 
A conventional monostable circuit triggered by the frequency generator could do that.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top