# Motor Driver Project using 555 Timer PWM + 4N25 + 2N7000

I need to build a circuit that controls the speed of DC Motor using external potentiometer, here are the requirements of the project:

Power source: two 12V dc, 450mA power supplies

Motor: R140 Micro DC Motor

       Voltage Range: 3-12V

No Load RPM: 12000rpm (At 12V)


Circuit Input: a Potentiometer

Circuit Output: At no load, motor speed should change from 3000 rpm to 12000 rpm corresponding to the position of the potentiometer

the 555 timer generates 10KHz frequency, the project has two separate 12V power supplies in this schematic, one for control circuit, and the other is for power circuit. (It's a constraint for the design).

And here comes my First Question: I know that it's ok to supply 555 with 12 V (according to 555 datasheet), but is this a preferred option that my PWM signal is 12V? I mean I could use a voltage regulator to run the whole control circuit with 5V, but which option is preferred?

Then I connected 555 output to the input of 4N25 optocoupler using (660 ohm) to limit the input current to ~16mA, using this equation: $$\R = (Vin-V)/Iin \$$

Then, by knowing that the CTR of 4N25 is 20%, and I need 12V @ Emmiter, so I put a 4Kohm resistor (R2), according to that equation,(knowing that the current at the emmiter = 0.2*16mA ~ 3mA)

$$\V=IR\$$, V=12V, I=3mA, then R = 4kohm

Now, when it comes to driving the 2N700 MOSFET, I do have some questions...

-What should be the suitable value for Vgs? what is the criteria for selecting it?

-How should I calculate Rgate? and the corresponding Igate?

-Is the connection of the MOSFET and flyback diode right?

-Why is Qg(Total Gate Charge) not specified in the 2N7000 datasheet?

Here is the schematic using LTSPICE. note: I'm modelling the DC motor with equivalent inductor and resistor circuit.

I'm not so sure of how I do my calculations, so please if you see any part of the above wrong correct it.

• @All - Although well-intentioned, the long comment chain has exceeded what is reasonable for comments. Therefore comments so far have been moved to chat & should be continued there (see the comment below). || As this bulk moving of comments to chat can only be done once per question, any further comments posted here might be deleted without notice. Keep it in chat now, please! || All relevant improvements to the question decided during the chat, should be made via a question edit, not as a comment. When someone has got enough information to post an answer, please answer it as usual. Thanks Nov 11, 2023 at 20:38
• Comments have been moved to chat; please do not continue the discussion here. Nov 11, 2023 at 20:38

• Power source: two 12V dc, 450mA power supplies

Oh, that's interesting! It means your supply is inherently supplying less current than your motor might be able to sink.

This is relevant in this context, because if you leave the motor switched on for a long enough time while it still accelerates, the 12 V will drop.

That means that the motor wouldn't really "see" a reduced "on time" as something that drastically reduces its speed, because the longer the on-time, the less current flows, anyways. However, assuming your supply has some capacitor inside, for short on-times, the voltage will seem to be more or less constant.

Motor: R140 Micro DC Motor; Voltage Range: 3-12V; No Load RPM: 12000rpm (At 12V)

was hoping for a bit more detailed information (like the currents to expect), but OK

Circuit Output: At no load, motor speed should change from 3000 rpm to 12000 rpm corresponding to the position of the potentiometer

Oh! Nice problem.

So, first of all, this means you need to allow for (close to) 100% duty cycle, as well as for probably relatively low duty cycles. Which makes the 555 as the one generating the duty cycle a complicated and awkward choice.

A reasonable electrical engineer would just use a microcontroller here. (I'd strongly recommend that – use one ADC channel for the potentiometer's output wiper voltage, the other to sense the periodically changing current while the PWM is on, and a timer unit to generate the PWM and to trigger the ADC conversion). A very simple PID controller program would be used to adjust the duty cycle until you hit your target speed. This would in total need 1 potentiometer, 1 motor, 1 microcontroller, 1 decoupling capacitor for the microcontroller, 1 gate resistor, 1 logic level n-channel mosfet, 1 capacitor and 1 resistor to form a crude RC low pass filter for the ADC in the MCU to measure the voltage across the MOSFET's Drain-Source. Can't get much fewer components than that, especially not with a 555. And you'd get, for 8 components including the motor, a device that actually sets exactly the desired drive speed.

Now, barring microcontrollers, we need to be a bit smart. We'd want a frequency reading. And we'd want to compare that to our setting on the potentiometer, to determine whether the MOSFET should stay on longer or shorter.

So, how do we get a somewhat sensible frequency readout? Well, we can put a (low-value) resistor in series with the motor, and observe the current across that. It pulses twice per rotation for a brushed DC motor under no load. Sadly, that current also changes (quite abruptly) when we switch the MOSFET. We could, of course, also time our measurements such that we look when the transistor is conducting, but uhhh, we'd be building a quasi-time discrete system, and building something that is close to a digital controller isn't easier than buying a microcontroller that is one.

So, we instead would like our average current through the motor M1 to be proporational to a linear function of the potentiometer position. Fine!

simulate this circuit – Schematic created using CircuitLab

Now we go amplify that to have a useful voltage range. The voltages it takes will depend on your motor, so I don't have numbers for you on how much amplification you need. But, seeing that your maximum average current is 450 mA as per your supply specification, and 450 mA · 0.2 Ω = 90 mV, we'll need quite a bit of gain to get somewhere useful. As a design hypothesis, I start with a gain of 101:

simulate this circuit

You can use a trimmer (potentiometer that you just adjust and don't use to control) for R1-R2 to be able to adjust the gain as needed (the voltage gain of the non-inverting opamp configuration shown is $$\1+\frac{R_2}{R_1}\$$). As alluded to in the schematic, since the input voltage is so close to the negative supply, you need a rail-to-rail opamp – these are easy to get standard components, these days. If you can get a NE555, you can get an opamp!

Finally, we need to compare that Vamplified to the setting of our potentiometer. So, we need a comparator, the non-inverting input of which you connect to Vamplified (or, you add another RC low pass filter in between – it certainly doesn't hurt!) and the inverting one to the wiper of your potentiometer. The potentiometer is between ground and a resistor to supply voltage:

simulate this circuit

The 555 is pretty useless for this. You can use it as a comparator, but it's not really an interesting part for that, as it has problems going rail-to-rail.