• Sensor board re-designed

    Stuart Longland10/21/2018 at 03:15 0 comments

    So, I placed an order to Mouser the other day to actually get some parts into my hands so I can better design the boards.

    In that, I discovered the screw terminals I was planning on using, are discontinued.  So, I found something that was able to take the same gauge wire: Phoenix 1017526s.  Turns out, these will not fit along side the current shunts on the board as planned.

    There's just no way I'll be fitting these on a 5×5cm board and have room to spare for a shunt in between.  Since this is really application-specific, it might be better off board.  We'll put the INA219 and PCA9615 together on the board so we have a nice self-contained sensor board that can be mounted close to the current shunt, wherever that lives, and have nice noise-resistant links back to the controller.

    This does mean I can do things like put a current shunt in the fuse box where the solar panels connect, and run CAT5 down to the controller from there.

    To make routing easier, I've gone to a 4-layer board.  The board has solder-jumpers for setting the I²C address of the INA219, and I've documented all the termination and pull resistors.  I'm not sure what ones are needed yet, so there's space at every point where I could envisage one being needed.

    There's two power planes in the inner layers, one for VCC the other for 0V.

    Next step, I'll print out the board designs and test fit everything before ordering the boards, which I hope to have ordered this afternoon.

  • Sensor board designed

    Stuart Longland10/06/2018 at 11:48 0 comments

    So, I've designed the sensor board, this is basically a break-out of an INA219 coupled with a PCA9615, for extended I²C range.  If I was to use one of these on the cluster, it's theoretically possible for me to put one up in the fuse box on the back deck, and run CAT5e down to the server rack to help measure voltage drop across that long run.  Doing that with regular I²C would be insane.

    Again, I've gone crazy with pull-up, pull-down and termination resistances, not knowing what would be needed.  The schematic is nothing special.

    The board wound up bigger than I'd expected, but largely because it had to accommodate fairly heavy power traces.  I think I've got the footprint for the screw terminal blocks right.  I've managed to cram it onto a 5cm×5cm board (two layer).

    As always, you've got two ways of dealing with the current shunt, either hook one up externally, which means you don't bother with the beefy power connection footprints, or you fit a surface-mount shunt on.

    You've got full flexibility there, as well as what address to set the board to via the jumpers.

    I'll probably order some of the connectors and other parts in question, print out the board layout and test-fit everything.  I'm not happy about the fact that NXP only make the PCA9615 in TSSOP, but I guess I should be thankful the part has legs.

  • Driver designed

    Stuart Longland10/01/2018 at 06:23 0 comments

    So, I've done the driver board.  This is bigger than I thought it would be, at first I thought it'd just be the LVDS receiver, MOSFET driver, and a few capacitors/resistors, and the connectors.  Ideally I wanted something that could be slipped over the pins of the MOSFETs, allowing the drain and source to be connected to other connections which could take the current.

    I had just laid everything out on a 5×3.5cm board, two-layer (so dirt cheap).  Nice and tidy.  For the receiver I ended up using the DS90C402: it was already in Kicad.  All looked good, until I saw this in the datasheet (highlighting mine):

    In short, if the cable gets unplugged, the receiver will effectively drive both MOSFETs hard on 100%.  Kaboom!

    So, I had to introduce an inverter into the circuit.  A bit more propagation delay, and another component, it's the biggest part on the board (they don't make SOIC-8 inverters).  I've chosen a 74AHC family part like I did for the driver board so it should have the speed needed.

    I'm not sure if this is needed for LVDS, but I've added a number of pull-up and pull-down resistors as well as the 100R terminations.  These are underneath.

    Likewise, I realised I had omitted doing the same on the controller.  There were some for I²C, but I've re-located these to the bottom.  So I've made some room for them.  Better to do it now than find out I need them later.

    Like the driver board, I've documented resistors used for pull-up, pull-down and termination.  I'm not exactly sure which ones are needed or what values they should be, but fixing a silk-screen isn't a big issue.

    The LVDS outputs have resistors too, you can see those near the relevant sockets.  I suspect the answer is they are needed at the receiver, not the driver.

  • Controller designed

    Stuart Longland09/30/2018 at 10:36 0 comments

    So this is what I've come up with for the core controller.

    There's provisions for two versions on this board, one with an ATTiny861 which does high-speed (250kHz) PWM and can drive a buck, boost or buck-boost DC-DC converter.  It features differential I²C interfaces for the input and output INA219 boards, and LVDS for controlling the MOSFET boards.

    The other version is built around the ATTiny24A, and just features the ability to turn on and off MOSFETs.  It can drive two statically, or PWM one (at a much lower speed), with the user supplying the driver logic.  Due to the the fact that this device does not do high-speed switching, I've forgone the LVDS control over a simple current loop.  The I²C is still differential though as that could be some distance away and is still somewhat high frequency.

    The layout of the board is a small 5×5cm 4-layer PCB.

    I had to go 4-layer as I needed to route signals both sides and didn't want to interrupt the power planes.  The two inner layers are VCC and GND.  There's de-coupling capacitors galore, although the two power planes will probably function as a decent capacitor in their own right.  ICSP is via the interface header at the bottom.

  • Splitting up the project

    Stuart Longland09/30/2018 at 00:01 0 comments

    I was originally thinking of one monolithic board which would have everything it needed.

    There was provision for the lot, including a separate ATTiny24A so that you could omit all but one of the MOSFETs, swap the remaining MOSFET for a P-channel, drop the MOSFET drivers, one of the INA219s, and the ATTiny861, and you'd have just a monitoring board with a (low-speed) PWMable switch.  It'd plug into the same place and use the same host interface.  The one board could be made into just a boost, or just a buck.  Flexibility.

    There was just one snag.  That'll work for small power supplies with maybe up to 5A capability (~100W) but not for the 50A version.  The MOSFETs will fit, but the tracks will need to be huge, the board will be hideously expensive to make, and they don't make inductors big enough.

    Looking around for inductors, I did see these.  They're not massive like the 10uH one I saw, and they're not expensive.  The downside is they're about 10% of what I really need.  I guess I'll just make do.  They're also not PCB-mount (mind you, a 40kg inductor doesn't PCB-mount either).

    Thus, it may be more sensible to separate the MOSFETs and high-power stuff from the controller.  Now here's the rub.  We're dealing with sub-15ns pulses.  PWM.

    Years ago for my industrial experience, I did work on an electric harvester platform.  The system ran 48V.  The motors were rated at 20kW, and were made in house using windings wound from 5mm diameter enamelled copper wire and neodymium magnets.

    We had loads of issues with MOSFETs blowing.  The MOSFET driver was mounted close to the MOSFETs, as I'm proposing to do here, but between DSP and driver, was a long-ish run of ribbon cable.  @Bil Herd posted this article covering the challenges involving inductance on PCB layout.  That same problem applies to "long" cable runs too.

    10 years ago when we were working on this project, I remember asking about if we had considered maybe using coax cable instead of a ribbon cable.  The idea was rubbished at the time.  Given we were PWMing 400A, I think there might've been something in that suggestion.

    That ribbon (10~20cm of it) would have had a lovely inductance all of its own, and while I have no idea what frequency the PWM was running at (I might have the code somewhere but I can't be stuffed digging it up), and we were fundamentally driving a single-ended signal over a fairly long distance.  Yes, ground was close, but probably not enough, a twisted pair would have been better, but even then not perfect.  We blew many MOSFETs on that project.  Big TO-263s!

    An earlier article on differential signalling got me thinking: why not use LVDS for the PWM?  A quick search has revealed this receiver and transmitter (Mouser says two receivers on it, but I think that's a typo).  The idea being that I send the PWM down a differential pair using LVDS.  155Mbps should be plenty fast enough (the ATTiny861 can only do 64MHz) and these parts will run at the 5V needed for fast switching.  In fact they require it.

    Using twisted pairs, the inductance should cancel.  I'll make a MOSFET board that just has these signal pairs:

    • +12V (for the MOSFET driver) and 0V
    • +5V (for the LVDS receiver) and 0V
    • High side PWM + and -
    • Low side PWM + and -

    There's a ground-loop I need to be wary of between the 12V and 5V rails, really it's the same 0V rail for both.  I suspect they'll still need to be connected at both ends.  Add in more of those screw terminals to take the input and output power off-board, and I think we should be set.

    Similarly, the INA219 should probably be a separate board, with scope for having a chassis-mounted current shunt.  The connection to the current shunt's sense output is a low-power connection, so no issue there.  You want to keep it short for accuracy reasons, but a simple twisted pair will work fine.

  • PCB routing fun: something doesn't add up

    Stuart Longland09/29/2018 at 13:44 0 comments

    So, I was busy routing a board having come up with a basic schematic.  I wasn't going to order the board yet, I wanted to just play around with the design, see how compact I could make this.

    One thing that was niggling in the back of my mind, was how the traces would cope with the current.  I use 6AWG cable from the solar panels, and 8AWG from the batteries.  How wide should I make the traces?  One calculator reckoned I should make them about 7cm wide!  Another option was to use heavier gauge traces, maybe 3oz copper.  A 5cm×5cm 2-layer board would cost a staggering AU$263 for just the PCB!

    Okay, so I can work around this by fiddling the solder mask in Kicad and just solder some copper wire along the trace.  Not a show stopper.  I'll just make wide traces so I know where to lay the wire and have plenty of area to solder it.

    I was making the traces as wide as Kicad would let me, but something didn't seem right.  The inductor, just seemed so, small…

    When I did the search on Mouser, their interface allows you to pick a value, then hit the ≥ button to select everything "greater than".  What I missed, is the option right down the bottom:

    The "-" option, better known as "we couldn't be stuffed looking up what the real value is", is seen as "greater than everything else".

    A check of the datasheet itself, revealed the truth.

    In short, there is no way that little tiddler is going to manage the current I was contemplating throwing at it!

    What's the biggest I can get that will handle that current?  Well if I take the "-" option out of the equation, they suggest this monster.  It's 10uH instead of 33, so my ripple voltage will increase.  At $837.84, it is also a rare exception to the free shipping over $60 offer.

    I might need to go play with some numbers to see what I can get away with.  The good news is that discontinuous output is not a show stopper for a battery charger.  I might have to make do with nanohenries of inductance instead of microhenries.

  • Connectors

    Stuart Longland09/29/2018 at 04:18 0 comments

    So, a thing that will make or break this project, will be the connectors that feed power in and out.

    My existing system uses the larger 50A Anderson connectors.  These are big and chunky, not really appropriate for a PCB.  The 30A version would be okay size-wise, and I use these on the bike, but 30A isn't sufficient.  That's about my cluster's peak current draw, and I want a 50% safety margin.

    Thinking about it last night… 20V at 50A… that's a kilowatt!  Pales into insignificance when you compare it to the 48V 400A electric harvester I worked on years ago (and blew many a MOSFET on, not to mention boiling electrolytics with ripple current), but it's still a decent amount of power.

    There's the XT60 and Deans connectors, however the problem with these is they aren't all made equal, there's some slight variances in the tolerances, thus you can buy two "XT60"s or two "Deans" connectors and find they won't mate.

    I see no problem in a short flying lead that connects to screw terminals.  Take the flying lead, wire it up, then connect it to the connector of your choice.  That's how the solar controller I was using connected up, and I don't think its problems were with its connectors.

    The conductors I'm using are 6-8AWG.  Whatever I use, must be able to handle that.  There isn't a lot out there for off-board connectors, and even the XT60s are a wee bit small.  I did find these terminal blocks.  Supposedly good for 76A, that's enough safety margin for me, and Phoenix Contact aren't known for producing crap.

    The spade lugs used on the HEP-600C I'm using for charging my batteries would be smaller than this, and so far I've not seen any fires.

    I might be able to put a few different footprints down on the PCB, we'll see.  I plan to design the PCB so there's nice wide areas so you can drill your own hole and solder whatever you like there.  Likewise for the inductor and capacitors, this will be a board that aims for flexibility.

  • Researching designs

    Stuart Longland09/28/2018 at 15:10 0 comments

    So, I've been pondering doing a more capable power controller for the purpose of enhancing or even outright replacing the solar controllers I have now on the #Solar-powered cloud computing cluster.

    The idea started as a straight DC power meter with a Modbus interface, as there's pretty much nothing on the market.  Lots of proprietary jobbies, or display-only toys, but nothing that will talk an open protocol.  I started designing a circuit.  I thought: it'd be handy to have digital inputs and outputs.

    Lots of mains energy meters have them, and they're handy for switching loads.  My remote reset facility when porting the mainline kernel to the TS-7670 was a digital output on the CET PMC-519.  If I crashed the TS-7670, I basically fired up ipython, loaded pymodbus, connected to a Modbus/TCP gateway, then issued a few write-coil commands to power-cycle the TS-7670.

    Often the digital inputs are hooked to water or gas pulse meters to meter usage: you get a pulse every N litres of water or every N cubic metres of gas.

    A meter with digital I/O that's programmable would be just perfect for the job my little power controller is doing.

    I could make the channels PWMable, thus be able to step down the voltage.  Put an INA219 on there, and I'd have current measurement and power control.  The idea evolved to putting the INA219 and a MOSFET on a board, so it was a separate module: just to make board layout easier and to reduce the size of the boards.

    For a buck converter, you just add an inductor and a few smoothing capacitors.  Better yet, two INA219s and a MCU would let me measure power in, out, and have localised brains.  Thus the idea of a separate, smart module, was born.  For kicks, I'm also adding the ability to boost as well by tacking a boost converter to the end.

    The principle is really quite simple.  A buck converter has this topology (source, Wikipedia):

    If you swap out that diode for another MOSFET, you get a synchronous buck converter, which looks like this (same Wikipedia article):

    It's worth noting that a MOSFET switch has a body diode that might be exploitable, I'll have to check.  You drive the two switches with complimentary outputs.  Both these circuits will step down a voltage, which is what I want to do 99% of the time, but it's also useful to go up.  A boost converter looks like this (source: Wikipedia):

    Again, that diode can be replaced with another MOSFET.  This will step up a voltage, but not down.

    There are a few options that allow going both ways:

    • Flyback: which uses a transformer and provides galvanic isolation.  The downside is the secondary must take all the output current, and finding a transformer that can do 50A is EXPENSIVE!  So scratch that.  (And no I am not winding my own transformers… tried that back at uni when a lecturer asked us to build a flyback converter.  Bugger that!)
    • SEPIC is basically a boost plus a buck-boost.  Efficiency is not their strong suite apparently, although there are ways to improve it.  I'm not sure the added complexity of two boost converters sandwiching a buck converter is worth it.
    • Ćuk is no good here because it inverts its output, unless you want an isolated one, which is going to be $$$$ because of the transformer needed.  Yes, I'm chickening out!
    • Split-Pi looks real interesting, in that it's bi-directional.  In the event I ever decide to buy a front-wheel motor for my bicycle, I could use one of these to do regenerative braking and save some wear on my brake pads.  I haven't seen many schematics for this though, just generalised ones like the one above.
    • Zeta also looks interesting, but it's pretty unknown, and has a higher parts requirement.  It could be worth looking at.  It's a close relative of the SEPIC and Ćuk.

    The route I'm looking to try first is the 4-switch buck-boost, which looks like...

    Read more »