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.
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.
Tip 2 years ago
The way you connected the two capacitors is a bit useless in my opinion. Ok, we are speaking about very small currents, so even one is fine, but if you want to use both of them you can try putting them "more correctly", considering you have a lot of space there.
IMPORTANT: I'm not an expert in this field, I'm just applying some notions I got in different places. If someone has different ideas feel free to comment; I'm also here to learn ;)
As for the circuit, I'm speaking about separating the VCC and VM (removing the red crossed wire), and extracting the VCC directly from the capacitor (light blue track), so that the Vcc is drawn directly from the capacitor. Then I'd make the green path a bit larger, but again the current is quite low...
Finally I prefer to have the power to go first to the "high" power part, so the noise generated by the motor does not have to "transit" in front of the digital power supply, but can flow away. In your circuit, this can be achieved by swapping GND and VCC (so letting the power path go to the right). This is a preference, though, so if you have other constraint (e.g. fixed pinout of the breakout board) you can also ignore this
2 years ago on Introduction
I don't think you actually need an H-bridge circuit to do this. Just put a light spring behind the part that moves. Activate the coil to pull the moving part in, then deactivate to allow it to go back out. A simple transistor switch will do this. But, your solution makes the mechanical design simpler, and the H-bridge chips are relatively cheap, so it's still a nice solution.
Reply 2 years ago
Actually, spring was the very first thing I thought. But the magnetic force produced by tiny coils is very weak, just enough to lift the segment and magnet. It won't be able to overcome the force of a spring.
2 years ago on Step 3
What is the reason, that you did not choose the TB6612FNG (1A) H driver, already available on breakout boards https://www.sparkfun.com/products/14451?
Best Answer 2 years ago
Size. He want's to make the design smaller, presumably small enough that the TB6612FNG would be too large to use.
2 years ago
Thanks for writing this, I’m probably going to experiment with some tiny H bridges for one of my next projects and this was useful to read!
2 years ago
This is an awesome project. I am horrible with electronics so it's almost like magic to me.
Reply 2 years ago
Thanks a lot!