Help with verifying ESP32 2ch high side IC switch?

Hello,

I am hoping that someone wants to look over my circuit and lend another set of eyes and perspective. I am exhausted, out of time and concerned that I may get this wrong.

I am working on a project that requires a two high side switches to independently control two small 5vdc motors with an ESP32. I have only delt with high side switching when the switched voltage was the same as the controller voltage or lower, so this is the first time I have needed to look at doing a push pull NPN/PNP circuit because of a lower control voltage. The project must be very compact, the components need to cheap yet reliable, and the circuit needs to be robust against ESD and overcurrent on the last leg to the motors as the cables are led out of the enclosure and will be unplugged on a regular basis.

I am using JLPCB for PCB's and assembly, so I am trying to limit the components to what they have in stock.

I found an IC that looks pretty promising with a NPN and a PNP with specs that look appropriate:
Diodes Incorporated MMDT2227-7-F

The motors draw 85ma but I want the ability to use larger motors up to about 200ma at a later point if I decide to swap them over availability issues.

I am stuck with high side switching because I am stuck with three conductor cables and I also need to supply a different voltage to another independently controlled component at the end of the cable, so I need a common ground, leaving me with two positive conductors.

Thanks for reading this far:).

It shows, get some sleep :sleeping_bed:
You need time to fix this.

Do you have a cable with three wires to two motors ? and you want to control the speed of the motors independently ?
Then why must you use a common ground ?

What is that other secret mysterious component ? Do you have a cable of three wires and do you use a chassis for the GND ?

The normal way would be a single fuse at the 5V power and that towards the motors. Two n-channel mosfets with two resistors at the gate each. A fly-over diode over the motor. With PWM you can control both motors.

Your circuit itself is not a push-pull circuit. It has no fly-over diodes. The resistor R1 is not okay. Driving a motor of 200 mA with a transistor of 600 mA has no meaning. Do you know the stall current of the motors ?

1 Like

Thanks for looking this over Koepel,

I am heading to bed now but I thought I would respond a bit first. I did not explain clearly - clearly...

I have two pairs of three conductor cables, each cable supports one motor and the mystery component - is simply a buzzer. So, two pairs of cables, each with one common ground, one positive conductor for the motor and one positive conductor for the buzzer. The motors and buzzers turn off/on at different times. I don't need to be able to PWM the motor and the buzzer does not need anything special.

I went overkill with the 600ma transistor because I have had issues with an older version that was too tightly engineered and saw a higher failure rate then I liked. The motors can be hard to come by, so I also want to oversize it in case I someday need to use a differnt model motor. I put the fuse on the motor side to protect the entire circuit from a stalled motor - which is my second biggest concern after ESD, but maybe my logic is unsound.... It's cheap and easy for me to replace a burned out motor from stalling or otherwise, it's not cheap to replace the primary PCB. The motor has a stall current of 95ma.

Okay, now I am going to bed and I will check replies as soon as I wake up.

The stall current is all that matters. You can drive 95 mA with a 600 mA transistor :smiley:
A good quality motor of 500 mA can have a stall current of 5A. Then the circuit should deal with 5A, and the 500mA is a useless number.

Is that a piezo buzzer ? Or does it buzz when a DC voltage is applied to it ? Can an output pin of the ESP32 drive the buzzer ? or perhaps via a resistor ?

When I write down what you have, then I don't see a common ground:

I changed your circuit, to fix the R1 problem:

For two motors, you need two circuits like that, and only the fuse can be combined.
Sometimes a capacitor is added over the motor, parallel with the diode.

[EDIT] I made a bad mistake in the schematic, I have updated it.

Thanks again for your time Koepel, I redrew my circuit with your suggestions:

It all makes much more sense, especially after some sleep:). Of course, the fuse needs to be on the source side... And since both motors will not be running at the same time, one fuse of the same size will suffice. I also have a 2 amp fuse for the entire board. After considering your flyback diode, I think I still need the ESD diode to cover lower voltage spikes but maybe it's overkill? The flyback I spec'd for the purpose of availability and economy has a 1000v reverse voltage. I did have plans for a cap on the motor and have drawn it in.

How does this look to you?

The buzzer is an active DC magnetic type that I am powering directly from the pin via a 100 Ohm resistor with a ESD diode to help protect the pin (DESD3V3E1BL-7B). Testing on my current prototype shows a 18mA draw.

I call those "TVS" diodes: https://en.wikipedia.org/wiki/Transient-voltage-suppression_diode
They are usually for hundreds of volts. They do no harm, but you don't need them.

When the transistor turns on, a voltage is suddenly applied to the motor. Nothing bad happens.
When the transistor turns off, an inductive load will continue with the same current, causing a negative voltage. The fly-over diode takes care of that. It is a safe circuit. The fly-over diode can be for 50V, even a slow "rectifier" diode is fast enough, it can be a 1N4148, if the motor is 100mA, it can be a 100mA diode. That's all okay, it will work.

When the motor is running, it can create sparks. That injects noise into circuit. However, when the transistor is fully on, it connects the 5V to the motor. That is enough to avoid damage to the circuit.
It is still safer to add a capacitor for that. I was thinking about 10nF. With 1µF, you can not control the speed with PWM, because the transistor has to blast current into the capacitor.

The 18mA should be okay for a EPS32 digital output pin. Do you have a TVS diode there as well ? That is not needed.

Tip:
Can you draw the GND at the bottom and not half-way in the circuit ?


And R10 and R11 could point upwards.
I think it is even better if you make a circuit for one motor, and then make a copy of that for the other motor.
You don't have to make a schematic compact, the schematic should show what it does at the first glance.

Hi Koepel,

I am sorry for my delayed reply, I sent the boards off to prototyping as soon as I saw your reply but I did not have time to reply until now.

You are correct in your guess, the buzzers also have TVS diodes, my shop is very dry and I have had issues with static, (even with a good ESD mat/wrist bands) so I have started using TVS diodes on everything that is lead off the boards. It seems to have helped significantly but I am sure you are right and that they are overkill.

It makes sense that the 1uF caps will prevent PWM, I am not currently planning on using PWM but it would be nice to have the option. I am making note of it and I will swap to 10nF on my final run.

I am from an industry where extremely detailed and tight blueprints are the norm and I have had a hard time switching gears to schematics. Thank you for your suggestions, I will attempt to re-wire my brain a bit in this area:).

I really appreciate all of your time and help, it gave me needed support when I was/am overwhelmed with tight timelines and work. Thank you.

The humidity in my room is now a nice 60% :droplet:
Does your shop have enough plants :potted_plant: :potted_plant: :potted_plant: ?

As long as something is soldered to the circuit, that keeps a lot of trouble away.

If you have a connector between the circuit and the motor or the buzzer, and you can connect and disconnect it at any time and there are long wires, then you might need extra components. If it makes you happy to use them, then use them.

A good multimeter has a good input protection. They can take a high voltage spark at the pins without problem. But they use MOV, not TVS diodes. I don't know why, that is beyond my knowledge.

If you have long wires (a few meters) to the motor, then you could add a fly-over diode at the motor and at the circuit. The wires are also a inductor.

The Arduino input and output pins are not protected. That is not safe for an industrial environment.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.