2

I am looking to turn a motor on and off at very fast speeds (relays won't work), which leads me to transistors. Consider this diagram of an NPN transistor:

enter image description here

Will the 12V 20A line harm the pi since it's grounded to the pi?

Edit

The Motor

As far as pulse rates go, I won't be sure how fast it will need to be until I start testing, but let's say we will be using pulse widths of 400 microseconds, spaced out at 400 microseconds. This is a total period of 800 microseconds (about the fastest you can do on a nema 17 with the A4988 driver).

The motor I am selecting is called the K2G20-12V-BR-04 (G20 is the maximum current draw). On that page, you will find a spec sheet, but take note of this graph:

enter image description here

For no load on the linear actuator, there is a current draw close to 20A. Here is how the motor is wired:

enter image description here

I talked to a representative for this motor on the phone, and he said that this motor will be able to receive PWM. I plan to have two transistors controlling the "extend" and "retract" switches shown in the above diagram. Sadly, I don't believe they provide inductance values.

The Transistor

This will be my first time working with transistors - mechanical engineer here :), so consider my knowledge to be naïve. I believe I have found a MOSFET here that will work. I say that it will work because in the datasheet, it says that it has a "gate source threshold voltage" between 3 and 5 V. The gate source threshold current is 250 microamps. So would the resistor value at the base not be 3.3/250e-6 = 13.2 kohms?

As far as kickback is concerned,

enter image description here

would this not be protecting it?

11
  • 1
    Does it need to be grounded to the Pi? Not that connecting the grounds does any harm.
    – joan
    Sep 9, 2022 at 19:27
  • @joan it has to be grounded to the pi in order to complete the circuit with the 3.3 GPIO Sep 9, 2022 at 19:35
  • 1
    Your question has lots of loose ends. Higher amperage/voltage indicates what? What is the current of the motor, you indicate 20A is that the motor or supply? What transistor are you looking at? You could be looking at 14 watts off the transistor at 20A. A MOSFET would be considerably less and if designed properly no heat sink. You say turning it on and off at very high speeds, what are we talking about? The Pi does not care how much current the supply can source it will take just what it needs. If the supply cannot supply that much you have problems. An opto isolator will eliminate ground.
    – Gil
    Sep 9, 2022 at 19:38
  • @Gil the 20A is what I am expecting the motor to draw from the 12V power supply. I'm not concerned with the kind of transistor at the moment. As for turning on and off, I'm talking controlling the dc motor with PWM around 800 microsecond periods (note this is not a stepper motor). I am not worried about the supply either. I'm just wanting to know if the ground pin on the pi can take the high amperage line. Sep 9, 2022 at 19:43
  • 1
    Where is the high amperage going to go through the pi coming from. Generally all grounds are connected and that for all practical purposes is the reference for voltage measurements. Your NPN transistor will need a positive voltage in respect to its emitter to turn on. Since the Pi is supplying it the grounds have to be connected. Be sure the emitter connection connects the power back to the supply not through the pi. If you go through the pi it will be smoke city. Remember ground is a reference for the pi, not a current conducting pin. Rule #1: "A Power Supply the Raspberry Pi is NOT!"
    – Gil
    Sep 9, 2022 at 20:44

1 Answer 1

1

Your circuit design will work, provided you make a few changes. As mentioned in the comments, switching 20A will be a challenge due to the RPi's wimpy output, but this can be overcome. Before we get into the details however, you need to provide a bit more detail in your question:

What exactly are very fast speeds?

In answering this question, please also explain what type of motor you are using; specifications on the motor will be useful.

Let's address your questions, and a few of the comments in a general fashion now - the details can be covered once you've provided the specifics.

Q: Will the 12V 20A line harm the pi since it's grounded to the pi?

A dc motor is an inductive load, and when you switch it off, it will generate a high voltage spike called inductive kickback. The magnitude of this spike is proportional to the inductance of the load and the rate at which the current is quenched:

V = L * di/dt

A fairly simple snubber circuit is typically used to limit the value of the voltage spike to a safe level, but there are tradeoffs between the shutoff speed and the magnitude of the voltage spike. This is one reason why it's important you define how fast.

The answer to your question is, "No, the 12V, 20A inductive switching will not damage your RPi if you design a snubber to limit the inductive spike to a safe value."

The MOSFET you linked in your comment is probably marginal for its current capacity. Also, to drive a MOSFET, you'll need to add a substantial buffer/driver interface between the GPIO and the MOSFET Gate. This due to the fact that fast switching and low switch resistance in a MOSFET requires much more voltage and current than is available from a GPIO. A Darlington Pair transistor may result in a simpler design, but it will still require a buffer/driver between the GPIO and the Base junction.

Something similar to the following may work. We'll assign values once you've provided your specifications.

schematic

simulate this circuit – Schematic created using CircuitLab

6
  • Thank you for your helpful feedback. I will accept your answer once you respond to my edits in the question. Sorry for not being more detailed Sep 10, 2022 at 17:14
  • @GabeMorris: Are you committed to using a MOSFET instead of a Darlington/bipolar device? Is it the cost of the device? I have another question: the schematic you added suggests your motor needs to "RETRACT" and "EXTEND" - you can't do that with a single transistor - you need an "H-Bridge" for that. Am I missing something? WRT my answer, you shouldn't accept it unless it works.
    – Seamus
    Sep 10, 2022 at 22:58
  • @GabeMorris: WRT your question re kickback & the MOSFET's parasitic diode: No - it's called a parasitic or body diode; it won't be effective at kickback suppression.
    – Seamus
    Sep 10, 2022 at 23:07
  • 1
    @GabeMorris: OK - thanks, good luck & let me know if I can help further.
    – Seamus
    Sep 11, 2022 at 2:32
  • 1
    @GabeMorris: I still don't know if you need to run your motor in one direction - or bi-directional, but: Catching up on my email just now & this was in my inbox - thought you may be interested. Also here's a search that may interest you.
    – Seamus
    Sep 11, 2022 at 4:17

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.