I’ve gone circuit board crazy this past month, working on several potential designs to succeed Lepton Deku mod for the next version of my robot bird, and watching hours of Robert Feranec videos on youtube to learn the finer points of PCB design. This is the first one to reach completion, and my first 4-layer board after being convinced by those videos that it’s well worth the small price increase for the reduction in potential noise problems. The inner layers are only used for ground, no signal routing. Each signal via has a nearby ground via to provide a path for the return current when changing layers. I still have a lot of parallel tracks (potential crosstalk), but I’ve tried to keep the digitals away from the analogs at least.
Compared to Lepton Deku mod, this one is 3PWM to reduce routing congestion and MCU pins, and is designed specifically for using two linear hall sensors for motor position sensing (technically you could use SPI sensors since there is a set of MOSI/MISO/SCK among the encoder pins, and enough others to serve as the CS pins).
I’ve incorporated the buck converter from Valentine’s Mosquito, edited to output 5V and then regulate to 3V for cleaner analog supply, and more current than Lepton to power so many hall sensors.
The price for 5 is $78, which comes to about $4 per motor. $13 for MCUs, $10 for drivers, $17 for mosfets, $8 setup, 14 extended parts fee (MCU, driver, mosfet, buck, inductor).
Board size is 44x48mm. It’s designed to have two of them soldered back-to-back on a single set of copper bars, and have the encoder connectors and motor pads accessible on the back side of the downward-facing board, after removing some material from the edges of the upward-facing board.
Yep, using the LinearHall class and custom ADC code due to analogRead slowness.
The main loop will just run motor.move and loopFOC for each motor sequentially, and receive angle targets from an external board via that 3 pin port on the side. Four 8-bit target values at 30Hz should be plenty, so I don’t expect any difficulty getting that much information across a single wire, either digitally or using analog. For more complex communication, use the USB pins on the programming connector (which also are CAN pins).
The external board will handle wireless communication with the controller. So far I’ve been using Arduino Pro Mini and NRF24, but I want to try ESP32 for even greater simplicity, and DAC for the analog target communication idea.
The controller makes use of the two linear halls technique as well
Very impressive and small footprint!
I’m not sure if I could master the copper bar soldering.
Would it be possible to clamp the PCBs down on a watercooled aluminum heatsink instead?
The Fets are rated 30V/20A max. It will be interesting to see them in RL conditions.
I think of a 3DOF robot arm, where two motors are coupled for heavy lifting (shoulder) and one each for waist and elbow.
Where did you see 20A max? The SE3082G datasheet claims 80A continuous, 170A peak, but that must be under extreme cooling conditions. I killed one with a hoverboard motor after 5-10 seconds of oscillating while tuning the PID, and calculated afterward that it was probably 40A. They run cool at 10A even on 7.4V which isn’t enough to fully open the gate, so at least 20A should be fine without cooling, and probably 30-40A with.
The voltage on this board is limited by the 20V max of the drivers and gates. It would be tough to squeeze in another power network, and would need a separate supply wire or space for a 10-12V buck converter. I’m running on 4S LiFePO4 (13.2V) so I didn’t want to bother with it.
The heatsink idea should work well. With 4 layers, the conductor cross section is already twice that of Lepton, so the copper bars are overkill. Mostly helpful in terms of form factor this time, with my plan to join two boards back-to-back.
You’ll need to grind the programming connector pins flush on the back so they don’t touch the heatsink. Use the outer edge encoder connectors. Probably the ideal heatsink width is 36mm so it can fit between the mounting screws and leave enough edge exposed to solder power wires, capacitors, and the aux connector (just barely… I’ll move it a touch closer to the edge for this potential use case). Or maybe you could solder power wires on the top side if you extend the copper fill out to the edge and add vias. That would be especially helpful for multiple boards side-by-side on a single heatsink, since you could solder bits of copper to join the power rails without interrupting the smooth back surface. I’ll give that a try too (EDIT: Not enough room for ground solder pad on top left and bottom right. Could run the VMOT line under the unused mosfet pin 1 to get it out of the way, but then the exposed mosfet pin would be a danger to the very-close-by ground wire).
Joining two stages for double the current is something I hadn’t thought of, but would be fun to try. The timers will have to be very closely synchronized to avoid switching time overlap. With 3PWM, deadtime is fixed by the driver at ~215ns, which is about 36 CPU cycles at 170MHz. Ideally the writes to the timer control registers should be consecutive instructions (2 cycles/11ns apart), with interrupts disabled to ensure nothing happens between the two writes.
I just picked the first datasheet that had SE3082G on the title, but there were …GA/GB/GC subtypes, IIRC. I might have taken the wrong reference.
For dual power axis’ I’d choose two motors and sensors on one shaft.
I hope I can get away with it. I’ll have to find and hardcode the sensor angles before coupling them, but that’s OK.
That could work. Or maybe use two motors and one set of sensors. Tighten the rotors onto the shaft in reasonably close alignment, let them pull the loose stators to where they’re happy, and then tighten them down.
With separate sensors, it’s possible the motors will fight against eachother when near the target. The two linear halls technique is much better than digital halls, but still not super high precision. Near the sine wave peak, the change in value per change in angle is very little, so noise is proportionally larger.
It should be possible to improve it by using 3 linear halls positioned same as digitals and calculate angle using park/clarke (or is it alpha/beta? I’m not so good with the transforms) followed by atan2. You might get even better precision by discarding the reading nearest to its sine peak and calculating it from the other two. Gooser doesn’t have enough analog pins to do that on two motors though, and with two motors on a single set of sensors I don’t think it’s necessary.
My next masterpiece is complete! Gooser now has ACS711 current sensors (two phases per motor), and soldering heavy copper bars is optional. However I did remove the buck converter for lack of space and its relatively high cost with two extended parts fees. Mid voltage for the LDO must be supplied via the aux port (which now has two GPIO pins, which are CAN/USB, though I would have preferred analog or I2C since CAN needs a transceiver and USB is high frequency and would probably have noise problems due to the long traces between the MCU and connector).
The capacitors for the current sensors are on the back side, so you have to solder them yourself. They could fit on the top side, but would be at high risk of damage when soldering motor wires.
As usual, the routing ended up being tighter than I’d like, with many traces running in close parallel lines which will result in some crosstalk (not the current sense lines though, they’re just interspersed with ground lines in the probably-false hope that it will provide some shielding from noise). I did still manage to adhere to the rule of placing a ground via near every signal via. I used the Inner2 layer for most of the signal routing, with bottom as its ground plane to better utilize the heavier outer copper for conducting motor current. I had to use Inner1 for routing in a couple spots, but avoided cutting across any top layer traces, so it shouldn’t cause any noise problems.
A common way to put tall bulk capacitors is to solder them, while they are bent down to the PCB and held in place by glue afterwards.
But the way you’ve place the vias, it is difficult to bend them along the X-axis. ( where they would fit the best)
I know, that bothers me too. I considered having the input rails overlap eachother (top two layers positive, bottom two negative) with + and - inputs one-above-the-other (same X position, different Y positions), but the copper cross section would be dramatically reduced there they each cross around the other input terminal, and it would reduce the flexibility in terms of copper bars and stacking. As it is now, you can have U-shaped copper bars the whole way around, and stack boards back-to-back, face-to-face, or back-to-face. With the input terminals one above the other, you could only stack back-to-face. Though I am leaning toward using that arrangement anyway.
Do you think that’s the way to go, or can you think of any other possibilities to get power from the terminals to the horizontal rails while allowing one-above-the-other capacitor holes? I am going to attempt another version with the buck converter added back in, so I could change the rail configuration while I’m at it.
EDIT: Upon further consideration, the terminals won’t cramp the cross section nearly as much as I originally thought. I’ve pushed everything 3.5mm to the right since last time I considered it, so there’s actually plenty of room for the + current to go around the - terminal even if I go back to the original 2mm-narrower board width. And the bottom ground layer is such a wide open field with the currents traveling across the middle of it, the + terminal shouldn’t really obstruct anything. Actually the programming connector is the biggest obstruction…
Eliminating the exposed + rail on the left side will also restore the ability to join unlimited boards side-by-side on a single set of copper bars. And I can add an exposed area on top for a vertical + bar (with curve around the terminals).
Thanks for prompting me to think about this again!
You´re welcome!
The thing with PCB routing is: I´m never satisfied and want to change things over and over again.
How would you solder copper bars on the back, when there are the thru-holes for capacitors?
Would you even use the thru-holes or solder the caps onto the bars, where ever it’s convenient. Would be the best choice for glueing them down.
Other option are flat/big diameter capacitors. They become more and more popular, but stocks are limited (as always )
There’s room for the capacitor holes above and below the input terminals if I put the negative capacitor terminals in the mosfet pin exposed copper areas (which increases the difficulty of soldering copper disc current boosters on them, but no problem if using solder blobs).
If I put both vertical copper bars at the left edge of the board (one on top, one on bottom), I can reduce the width by 1mm, but then the bars get in the way of the battery wires unless they come in from above or below. I think I’ll stick with the 46mm width since it has the added benefit of more copper cross section without bars, and the bars can go around either side of the input terminals on the back. That leaves the top clear for screwing down lug connectors or soldering an XT30.
In the end it’s not much different aside from making it easier to bend capacitors over, and not having the bars cross over the input terminals (which is probably a good thing).
Yeah, it still needs some finishing touches. I’ve been playing with the buck converter version today, which is not looking terribly hopeful, but I haven’t thrown in the towel yet.
LCSC is out of DRV8300 so it’s not possible to order immediately, but I think it’s fairly popular so hopefully they have more on the way already.
EDIT: Ok, here’s a more polished version with wider positive rail on the lower layers and stitching vias added back in. I also tried it with the programming connector turned 90 degrees thinking that would open up more ground plane area, but it actually made it worse due to vias blocking the way.
I think I’ll remove the back side edge connectors next version since they were mainly for the now-impossible back-to-back arrangement. Two of the regular connectors are vertical near the edge anyway so I can use right-angle connectors on them for the bottom board in the stack. That leaves only two that will need cables, so not too cluttery. Removing them will free up space for another capacitor in the bottom right corner, so each motor will have nearby power, and all ends of the copper bars will be pinned for mechanical strength and easy positioning when soldering. Plus it will allow loosening up the routing some.
Here is the result of today’s efforts. Routing is much cleaner, capacitor for motor 2 added, board is 1mm narrower (45x52mm now), connectors are all grouped and oriented the same way, and joining side-by-side no longer involves sanding any material off the board edge. I shuffled the pins around a lot, so hopefully I didn’t make any mistakes on the silkscreen (I’ll need to update the schematic too).
It’s frustrating that if I use a 4-pin aux connector, the encoder connectors intrude on the exposed ground rail area. Joining side-by-side with copper bars will require filing notches in them to squeeze around the connector pins. But it’s nice having fewer different parts to buy, and with 2 GPIO pins you can do bit-bang I2C. In my case 1-wire protocol would work too, but I’m not joining side-by-side so I can just cut my copper bars a bit shorter.
I’m tired of messing with the buck converter for now, so I think this is the final version. All pin assignments double checked for errors, and only minor edits from yesterday. I nudged the connectors a bit farther from the edge so side-by-side boards should fit just right, and changed aux to an optional 3-pin or 4-pin connector so the encoders could get out of the copper bar area. 4-pin can fit on the back, or you can solder wires to the pads. 3-pin can fit on top between the encoder connectors.
DRV8300 is back in stock, so I’ll place the order tomorrow if I don’t think of any more edits to make!
EDIT: Yikes, I almost blew it! Thanks to more obsessive checking, I just discovered that this whole time I’ve had the pin assignments on the current sensors mirrored. Must have done it in the beginning when I was going to put them on the back side of the board. Unfortunately this will require a fair amount of editing to fix…
EDIT2: Ok, sensor pins are fixed. The new via placement cuts into the V+ rail by about half a millimeter, but I couldn’t find any way around it, and it’s not enough to quibble over.
Being tired of messing with the buck converter only lasted until morning. I saw a potential way to squeeze it in by utilizing the sparsely populated areas below and to the right of the MCU, and couldn’t resist trying it.
Routing is all bunched up again, of course, but not as bad as I expected. I only had to use Inner1 in two more places. One hall sensor line in the most crowded area to the right of the MCU, and one transistor gate toward the upper left where the buck converter IC is too close to the exposed ground circle and couldn’t fit the both lines through the gap. I’m not happy that it cuts the ground rail, but being free to cut through that area with a high voltage and 3V line solved some other problems too, so I’ll accept it as a worthy sacrifice.
Other minor changes:
Added some exposed copper areas on top, which enables joining side-by-side without copper bars. Thin rectangles of copper on both sides of the board will make a mechanically strong joint.
Traded some positive rail area for more ground rail area. I’m just eyeballing, but ground still looks like the more constricted of the two due to so many vias everywhere.
I wasted some time thinking I’d make a panel with both versions and assemble them myself to save money, but it turned out it would have been more expensive if anything, on top of being more work.
I went with the buck-less version, with some edits to make it more user-friendly for my particular situation.
Two motors have 31 amp current sensors, two have 15-amp, because my smallest motors use <5 amps so resolution would have been poor.
The motor wire pads are extended out by 2mm for easier access to the bottom board (after trimming them back on the top board).
The encoder connectors were going to be messy nomatter how I oriented them, so instead I’m going to solder the wires directly to the pads. I added back in the extra set of connector holes along the edge, sort of fanned out so the wires can come in at an angle, plus a row of holes to join all the necessary signals between the two boards (either using pin headers or just solder short wires and cut them if I ever need to get the boards apart)
It will look something like this, plus a cable dangling out somewhere for the bottom board’s programming connector.