9 - TUTORIAL - This transistor can switch 70A motor currents at 12V

Video: https://youtu.be/bbg6NELeI9o?si=SmWA6jcI-dgy3iYJ

#Robotics #Drones #Arduino #Hardware #Teensy_4

Full code and manual on GitHub
Quadcopter frame PCB on OSHW lab

🔙 Previous Part | Next Part 🔜

↩️ Go Back

Table of Contents:


A) Introduction to Battery Management (Transitor)

We’ve arrived at the ninth video in our series, where we will explore a special transistor that enables active battery management.

As you’ve likely noticed, the quadcopter has a slide switch that allows you to turn it on.

This switch is connected to a transistor capable of switching off high currents. In this video, I’ll demonstrate the use of this transistor with the motors at full throttle and discuss its capabilities, which will help you take your quadcopter's battery management to a new level.


B) The problem of SoC Estimation using the Voltage Method

Remember the relationship between battery voltage and remaining battery lifetime that we discussed in the third video?

The Battery Discharge Voltage Curve (SoC Estimation - Voltage Method):

Read more: 3 - TUTORIAL - Measure battery lifetime with a voltage divider

A linear regression of the middle part of the voltage graph allows you to estimate the remaining battery life.

However, under heavy loads—like increasing motor speed—the voltage can drop significantly, even though the battery level hasn’t decreased.

This makes it difficult to accurately monitor the remaining battery life using voltage measurements alone.


B.1) Measuring Current with a High-Side Power Switch

The solution to this problem is measuring current. To achieve this, we’ll use a special transistor called a High-Side Power Switch.

Two high-side power switches are available for this project:

  1. A switch with a load current of 37 amps.
  2. A switch with a load current of 70 amps.

Both switches have 7 pins with identical functions and a large tap to connect high currents.


B.1.1) How to connect the Power Switch

To conduct high currents, the positive side of the battery needs to be connected to the tap of the power switch.

The current flows out of the switch through pins 1, 2, 6, and 7 and continues to the load (in this case, the ESCs and motors).

The transistor is switched on when a small current flows between pin 3 and the ground,

which is controlled by a slide switch.

When the slide switch is turned off, the voltage between pin 3 and the ground is almost equal to the battery voltage, causing the transistor to block the load current.

B.1.2) Monitoring Load Current and Voltage

Pin 5 is essential for measuring current. It outputs a current proportional to the load current, with a ratio of 14,000:1. This means that a load current of 14 amps corresponds to a 1 mA current from pin 5. Since your microcontroller (Teensy) cannot measure current directly, you can use a resistor to measure the voltage drop instead.

For example, using a 510-ohm resistor, a current of 1 mA will produce a voltage drop of 510 mV, which is measurable by the Teensy. The voltage drop over the resistor is proportional to the load current, and the relationship is:

VoltageDrop=LoadCurrent×0.036

However, be careful: in case of a short circuit, the current can exceed 180 amps for a few seconds before the transistor switches off, which could result in a voltage of over 6 volts—higher than the Teensy can handle.

Protecting Your Circuit with a Zener Diode

To protect the Teensy from potential damage, place a Zener diode in parallel with the resistor. The Zener diode has a fixed voltage, called the Zener voltage, and will only conduct current when the voltage exceeds this value. In this project, we’ll use a Zener diode with a Zener voltage of 2.4V, which is safely below the Teensy's maximum input voltage.

The final schematic shows the voltage over the resistor being measured by Teensy pin 21.

Additional Protection: Normal Diode

A regular diode is also placed before the circuit because the Zener diode does not protect the Teensy when the battery is accidentally reversed. The diode prevents negative voltages from damaging the Teensy.

Installation and Soldering the Power Switches

The power switch with a 70-amp load current has curved pins that can easily be inserted into the upper quadcopter frame. During installation, solder the tap to the correct area on the frame. The 37-amp switch has straight pins, which need slight adjustment to fit the quadcopter frame. Unfortunately, these power switches cannot be tested on a breadboard, as they require soldering.

Code for Battery Management

Next, we’ll discuss the code necessary for managing the battery. First, declare the variables needed to monitor the battery’s lifetime. The battery used in this project has a capacity of 1300 mAh, meaning it can sustain a current of 1.3 amps for one hour. In Part 3, we learned how to measure voltage; now, we will also measure current.

The default resolution for analog reads is 10 bits, meaning a voltage of 3.3V corresponds to a digital value of 1023. Since 1V at Teensy pin 21 equals the load current multiplied by 0.03, the current flowing through the power switch is calculated as:

[
\text{Current} = \text{Digital value at pin 21} \times 0.089
]

Initial Battery Level Check

In the setup part of the code, you will determine the initial battery level when the quadcopter motors are not running. Illuminate the red LED and check the battery voltage. If the voltage is greater than 8.3V, consider the battery full (1300 mAh), and turn off the red LED. If the voltage is lower than 7.5V, consider the battery empty, and leave the red LED on. For all other voltage values, calculate the remaining battery level using the equation provided in the earlier video.

Looping: Continuous Voltage and Current Measurement

In the loop section of the code, continuously measure voltage and current. The current consumed can be calculated by adding the current consumed in the current iteration (k) to the current from the previous iteration (k-1). Each iteration in the final flight controller will take 4 milliseconds.

If the battery capacity drops below 30%, illuminate the red LED again to warn of low battery.

Bypassing the Power Switch

You can choose to bypass the power switch entirely, as shown in the schematic. You won’t have the advanced battery management features, but this method is simpler and more common in self-made quadcopters. In this case, the code for monitoring the battery is basic: the red LED will turn on when the voltage falls below a set threshold, like 7.5V. However, be aware that this method is less accurate and can trigger the red LED early during aggressive motor activity.

Conclusion

Thank you for watching this video! Please subscribe if you’re enjoying the series, and I’ll see you in the next video, where we’ll begin constructing the actual quadcopter.


🔙 Previous Part | Next Part 🔜

↩️ Go Back


Z) 🗃️ Glossary

File Definition
Uncreated files Origin Note
High-Side Power Switch 9 - TUTORIAL - This transistor can switch 70A motor currents at 12V
Load switching with a MOSFET 9 - TUTORIAL - This transistor can switch 70A motor currents at 12V
Next Part 🔜 9 - TUTORIAL - This transistor can switch 70A motor currents at 12V
Next Part 🔜 9 - TUTORIAL - This transistor can switch 70A motor currents at 12V