Introduction: Tiny H-Bridge Drivers | Basics
Hello and welcome back to another Instructable! In the previous one, I showed you how I created coils in KiCad using a python script. Then I created and tested a few variations of coils to see which one works the best. My aim is to replace the huge electromagnets in the Mechanical 7-segment Display with the PCB coils.
In this Instructable, I will cover the basics of an H-bridge and show you how I will be using it to control the segments. Finally, I will introduce you to some of the H-bridges in tiny packages available in the market.
Let's get started!
Step 1: The Plan
In the original build I had made arrangements in such a way that when the coil gets energized, it opposes or pushes the magnet along with the segment. But when the coil is de-energized, the magnet gets attracted to the core of the electromagnet and thus the segment gets back to its original position. Clearly, this is not going to work as there is no core in the PCB coil. I actually had one coil with a hole in the middle for the core but it didn’t work.
Without the core, the segment will stay in its new position even though the coil is de-energized. To bring the segment back to its original position, the current through the coil must be reversed which in turn would flip the poles and this time attract the magnet.
Step 2: Basics of H-Bridge
The reversal of current required is achieved using a circuit that consists of 4 switches arranged in the shape of the capital letter H and hence the name H-Bridge. This is most commonly used to reverse the direction of rotation of a DC motor.
A typical H-bridge arrangement is shown in the 1st picture. The load/motor (or PCB coil in our case) is placed between the two legs as shown.
If switches S1 and S4 are closed, the current flows as seen in the 3rd picture, and when switches S2 and S3 are closed, the current flows in the opposite direction as seen in the 4th picture.
Care must be taken that switches S1 and S3 or S2 and S4 are never closed as shown. Doing so will short the power supply and could damage the switches.
I built this exact circuit on a breadboard using 4 push buttons as switches and a motor as a load. The reversal of direction of rotation confirms that the direction of current has reversed too. Great!
But I don't want to sit there and manually push the buttons. I want a microcontroller to do the job for me. To practically build this circuit, we can use MOSFETs as switches.
Step 3: Tiny H-Bridges
Each segment will require 4 MOSFETs. As you can probably imagine, the control circuit will become quite huge for 7 segments along with some other complimentary components to drive the gate of each MOSFET which eventually defeats my aim of making the display smaller.
I could use the SMD components but it would still be big and complicated. It would have been much easier if there was a dedicated IC. Say hi to PAM8016, an IC with all the previously mentioned components in a 1.5 x 1.5mm tiny package!
By taking a look at its functional block diagram in the datasheet, we can see the H-bridge, gate drivers along with short circuit protection and thermal shutdown. The direction of current through the coil can be controlled by providing only two inputs to the chip. Sweet!
But there’s one problem. Soldering a chip this tiny will be a nightmare for a person whose only experience with reflow soldering is a few LEDs and resistors. That too using an iron! But I decided to give it a shot anyway.
As an alternative, I found DRV8837, which does the same thing but is a little bit bigger. While I continued to search for more easy-to-solder alternatives on LCSC, I came across FM116B which is again the same thing but with less power output and in a SOT23 package that can even be hand soldered. Unfortunately, later I discovered that I was unable to order it due to shipping issues.
Step 4: Making Breakout Boards
Before implementing the ICs in the final PCB, I first wanted to test if I am able to control the segments as desired. As you can see, the ICs are not breadboard friendly and also my soldering skills are not that good to solder copper wires directly to it. That's why I decided to make a breakout board since they are not readily available in the market. A breakout board “breaks out” the pins of the IC onto a printed circuit board that has its own pins that are spaced perfectly for a solderless breadboard, giving you easy access to use the IC.
A look at the datasheet helps in deciding which pins should be broken out. For example, in the case of DRV8837:
- The IC has two pins for the power supply, one for load/motor (VM) and another for logic (VCC). Since I will be using 5V for both, I will connect the two pins together.
- Next is the nSleep pin. It is an active low pin i.e. connecting it to GND will put the IC in sleep mode. I want the IC to be active all the time and so I will be connecting it permanently to 5V.
- Inputs have internal pull-down resistors. So there is no need to provide those on the board.
- The datasheet also says to put a 0.1uF bypass capacitor on pins VM and VCC.
Keeping the above points in mind, I designed a breakout board for the ICs in KiCad and sent the Gerber files to JLCPCB for PCB and Stencil fabrication. Click here to download the Gerber files.
Attachments
Step 5: Controlling a Segment
Once I received my PCBs and stencil from JLCPCB, I assembled the board. This was my first time using a stencil and soldering tiny ICs. Fingers crossed! I used a cloth iron as a hotplate to reflow the solder paste.
But no matter how much I tried there was always one solder bridge under PAM8016. Fortunately, DRV8837 was a success on the first try!
Next is to test whether I am able to control the segment. According to the datasheet of DRV8837, I need to provide HIGH or LOW to pins IN1 and IN2. When IN1 = 1 & IN2 = 0, current flows in one direction and when IN1 = 0 & IN2 = 1, current flows in opposite direction. It works!
The above setup requires two inputs from a microcontroller and 14 inputs for a complete display. Since the two inputs are always complemented of each other i.e. if IN1 is HIGH then IN2 is LOW and vice versa, instead of giving two separate inputs, we could directly send a signal (1 or 0) to one input while the other input is given after being passed through a NOT gate which inverts it. In this way, we can control the segment/coil using only one input same as a normal 7 segment display. And it worked as expected!
Step 6: What's Next?
So that's it for now! The next and final step would be to combine the 7 coils and the H-Bridge drivers (DRV8837) together on a single PCB. So stay tuned for that! Let me know your thoughts and suggestions in the comments below.
Thank you for sticking to the end. I hope you all love this project and learned something new today. Subscribe to my YouTube channel for more such projects.