3 Phase Controller V0.1
I won't cover too much of the early development as it mainly consists of me learning EAGLE and reading about STM32s and the DRV line of chips, but I will give brief overview of the layout and intent of the board.
Schematic View
Top of the Board
Getting the boards in the mail was very exciting for me (first time!) and they came out identically to the render on JLC's website. One interesting thing upon initial inspection is the board house didn't do anything about ill-placed labels on my silkscreen. I had heard that technicians would move labels around and avoid any pads and vias, but some labels are visibly cut off. Not a huge deal.
Back of the Board
Two shunt resistors are the only SMD components on the back of the board.
DRV8302 Aligned on its Footprint
This was my first time working with surface mounted components and such small pins on the DRV8302 (TSOP-like package). Luckily for me, the Invention Studio just got a new microscope with an attached camera that can stream to a display at 60Hz and 1080p.
Solder Paste Dispenser
This method worked fine and is documented below, but in subsequent builds of this board, I switched to using a soldering iron and flux pen for the small leads and that was far quicker and more accurate.
Board Close-Up 1
Here is the board under the microscope highlighting a decently close via and trace. You can also see that the holes, copper, and solder mask are all a bit misaligned from one another, but not too badly. I would consider this quality extremely acceptable as 5 boards were $15 (shipping included).
Board Close-Up 2
Solder Paste on Board
Soldering in Process
Here the rightmost three pins have been soldered successfully with hot air. The small pellets around the other leads is the un-melted solder suspended in flux, an agent that helps liquid solder to flow.
Workstation
Microscope (right), soldering iron and hot air station (left), and we got a fancy Weller fume extractor that you can see the beginning (lefter).
Cool Pic, Post-Soldering
Buck Converter Works
All I could think about right before giving the board power for the first time was all of the unfortunate op-amps that met their demise in my care during electronics lab and the distinct smell of defeat that accompanied them. Luckily, everything went well! No major errors at this stage and the LED and accompanying resistor seem to work well together. I forgot to take a professional looking video of this stage, so this portrait 4am snap to my brother will have to suffice.
Board Built for 1 Phase
Next on the to-do list is to check that one of the phases worked. The way I have it configured, the DRV8302 takes in a PWM signal for each phase and modulates the state of the phase in the same manner. The PWM and phase signals should look identical, just with different amplitudes, thus the DRV8302 is really just acting as an amplifier in this mode. This is a significant simplification over what I would have to do to control discrete gate drivers and the DRV8302 comes with amplifiers to assist in measuring phase current and a 3V3 buck converter to boot.
I was initially testing the high-side FET alone on phase A which is why I have the pull-down resistor to ground there.
Phase A Working (even more obnoxious video)
And it worked! Well, for the most part... running at 1kHz there was some inconsistency in the phase A waveform that just got worse as the frequency increased.
Testing at 1kHz (input PWM in YELLOW, phase output in GREEN)
Here is a snippet of the 1kHz waveform. It appears as though every few output pulses is nearly perfect, but the ones in between are not. It looks like they follow some pattern, with the shortest pulses occurring before the perfect ones. Just by the look of it, it appears as though there is some part of the circuit that is cycling at a frequency lower than 1kHz, seemingly taking a couple of cycles to charge to a desired state and then producing a nice output pulse and resetting its state. I tested at a few other landmark frequencies to make sure that this wasn't some odd resonance issue.
Going down to 500Hz seemed to fix the issue; the output is almost picturesque. This may be a low operating frequency for low-inductance motors, but it should still acceptably high for testing purposes.
Doubling the frequency presented the same problem, though not well-illustrated by this picture. Here I took a photo of the scope with my phone without pausing the captured waveform. You are actually seeing overlapping on and off waveforms, which is why both the top and bottom of the waveform are illuminated at the same time during each input pulse. The following signals are captured properly.
It becomes increasingly hard to see the shape of each individual output pulse, but the problem generally appears the same. Also of note, the frequency at which 'good' pulses are output remains the same. The period appears to be about 800us which comes out to 1250Hz. Why is this happening?
According to the data sheet, the DRV8302 can supply up to 30mA of current to a single transistor at a time, allowing for a transistor with a gate capacitance of 25nC to operate at 200kHz. The FETs I'm using have gate capacitances of 51nC, only around twice the that value, so they should be able to be driven at a much higher frequency than 1kHz. I made sure that the power supply wasn't current limited and I had decent capacitance between GND and power when I put the large electrolytic caps into place. Perhaps the traces are too small to support the current required to drive the FETs or maybe the DRV8302 has a poor connection to the ground plane (this was hard for me to check).
The answer, unfortunately, is I don't know. I was unable to do any significant testing/debugging as well because of what happened next.
Mostly-built Board
After being unsuccessful in resolving phase A's problems, I built the other two phases to see if the problem was consistent across them all. This is the part of the story where I learn several valuable lessons regarding electronics. There was probably a 20 hour time period between when I tested phase A and when I was ready to test the other two phases. In this time, I assumed that no one had used the function generator that I was using to create the PWM input. All it would have taken for me to realize otherwise was a quick glance at the waveform parameters, but I did not do it. Never make assumptions when you don't reasonably have to. This seems like a stupid application of this rule, but it would have saved me a lot of (ongoing) pain. So, instead of oscillating between 5V and 0V, it was 9.5V and 10V for some reason. The max the logic on the chip can take is 7V and he was never the same again.
Ok, stupid mistake, but simple and very learnable. I purchased enough components for 3 separate boards, so I moved on to the next one. Once that one was built, I again tested it. This time, however, I used a function generator that I had never used before. I gave it 5V as my peak-to-peak voltage and plugged it right in. Nothing. Not even the messed up output that the last board gave. Naturally, I checked all of my inputs. The PWM was 10Vpp. I was quite angry that the function generator had given me twice of what I specified and killed my second chip. I simply blamed the device and moved on, still not putting a lot of thought into it.
Well I'm not going to make that mistake again! Third build done. It's 4am again. Testing time. I go back to the same type of function generator that I was using originally and get to work. This time I check my inputs with the scope before feeding them to the board. 3.3Vpp specification and I see 3.3 on the scope. I begin testing and I get the results I got with the first board. At least it's something. Go to bed. The next day, I build the rest of the phases and move on to testing them. This time (in the middle of the day) someone is using the station that I was on the previous night so I use an identical function generator one bench over. I boot it up, set it to 3.3Vpp and check it again with an oscilloscope. Now it reads 6.6Vpp again. A doubled output like the dissimilar function generator was giving me. I am puzzled, but I just compensate by halving the output. It is at this time I realize that the output is centered at 0. I was so focused on the peak-to-peak value that I did not check where the waveform was with respect to 0V. The DRV8302 has very little tolerance for reverse voltage on logic and is only rated up to -0.3V. I then realize that I had made the same mistake the previous night and must have overvolted the chip then. True enough, after configuring a proper input to the IC and starting it up, the outputs looked good for a few seconds and then died. The chip had tolerated the bad input the previous night, but it had been damaged. Letting it sit and then running it again pushed it over the edge, even with proper input.
And then I was out of DRV8302s. Thanks to the global silicon shortage and the Texas power crisis which reduced TI's throughput for a time, I cannot get any more, despite them still being 'in production'. I barely got the ones I have, marked-up on Mouser (Digi-Key was already out), and now the stock is fully depleted. I really wanted to spin a motor before moving on to the next design of the controller, but that is no longer an option. The only way to move forward at a reasonable rate is to start designing the next version immediately. If the 8302s become available again before I order the next boards, I can continue on where I'm leaving off here. Otherwise, there are plenty more DRV ICs out there to build a controller around.
All Boards (oldest left, latest right)
Function Generator Parameters (the top, YELLOW box)
I have also nailed down the output-doubling issue I was running into earlier. Above is a picture of the function generator I was using during my first bout of testing (when I was being moderately successful). You see, function generators have an internal impedance of 50Ohms, in series with whatever load it is driving. Under standard operating conditions, the function generator assumes that the load that it is driving also has an impedance of 50Ohms (this value is just an accepted convention and 50Ohms was chosen because it is convenient). So, in order to realize a voltage drop of X volts across the given load, a voltage of 2X must be applied initially. However, the 'load' that I was trying to drive wasn't really a load. The DRV8302 has an incredibly high impedance across its logic and ground, which is what the function generator was hooked up to. So, instead of an impedance of 50Ohms, the load impedance was actually orders and orders of magnitude larger. This makes the voltage divider unbalanced and the driven load observes a voltage drop that is nearly 2X instead of what you told it dang it!
Well, there is another mode of operation to deal with these kinds of high impedance loads. It's called high impedance mode and is signified by the "HiZ" on the tabs of the parameter boxes on the function generator. This mode of operation just assumes an arbitrarily large load impedance and thus halves it's output initially so you get what you want.
I paid a high price for the errors that I made, but I am still undeniably progressing which is the real goal. Stay tuned for the next iteration of the 3 phase controller (I've already started on the control side of things).
Bonus video I recorded after learning how to use the microscope camera to record a video to my computer over USB (30Hz and 1080p):
Comments
Post a Comment