Ian's Build Log

I have fallen into the JLC trap. The boards are effectively free, you just pay for expedited shipping. That gets 2 layer boards here in about a week, 4 layer in about 10 days. I have also used a range of the other PCB houses in Asia, to varying levels of success.

Another EU based supplier is Ragworm

And I always recommend comparison shopping on a site like PCBshopper

A daunting task in the best of times. The real answer is most people go with what they know. So as you’re building that out, you’ll have to figure out what works. I think pilfering from other schematics you find of devices you’re using also helps, though that usually leans more towards simple OSHW type designs. After that, I like going to app notes before I go into datasheets. And for power stuff, I’m a bit of a convert to tools like WebBench and other tools.

This was a big swap for me, I used to think this was “cheating”. But now I know it’s just a best practice and it’s usually the first thing I seek out. It has saved me many times now.

And now I’m noticing you link PCBshopper, so please ignore that :smiley:

That makes a lot of sense. I hadn’t thought of looking at OSHW designs, but that’s a good idea. (I watched one of Phil S’s videos yesterday, which was really good and very practical, going through a lot of details of a design of his, and I should look for more of that.)

I’ve been reading a lot of datasheets, but I should start collecting app notes too. I guess there just is no substitute for reading as much as you can. It would sure be nice if app notes came with a difficulty rating though, so you’d know to steer clear of the double black diamond ones until you have a bit more experience. There’s certainly no lack of things to learn from anyway. I really like it that all of the major manufacturers have these enormous libraries, almost all of it available for free.

I need all the help I can get, so anything that involves “cheating” to make life easier is A-OK with me!

Boards ordered from Aisler. I like their board viewer. They’re confident enough in it that they offer a free respin if the boards you get don’t match their render. And they have a nice thing where you pay the same price for 2-day turnaround with less fine design rules and HASL and for 5-day (?) turnaround with finer design rules (including slots) and ENIG. This board has a USB Micro-B socket that has some little plated slots, so I went for the 5-day service.

The only downside is that the soldermask is green…

This was a fun board to lay out. It’s designed to screw to an 80 x 80 mm computer fan, hence the funny shape. There are clips for an 18650 Li battery on the back. And the battery charger IC and the boost converter both had layout guidelines, so I had lots of fun drawing copper pours and making vias (so so many vias).

Ordered all the parts as well, so hopefully next weekend will be assembly time!

Finished the solder fume extractor fan. Battery charging works. The fan spins. Solder smoke is sucked away and absorbed quite nicely. I rate that a success. I learned a bit about batteries and battery charging, a bit about power conversion, got some more KiCad practice, and ended up with a useful little tool.

Only made three mistakes (that I noticed), none of which were more than slightly annoying:

  • Tried to share a resistor between two back-to-back LEDs on the status output of the battery charger. That’s fine when the status is low (charged) or high (charging), but connects the two LEDs in series between the positive rail and ground when the status output is in a high-Z state (which it is if there’s no battery connected). Workaround: only populate one LED. Lesson: it’s called tri-state logic for a reason – think about that other state!

  • No soldermask over the stitching vias on all the copper pours. Didn’t notice at all when I was doing the layout. Kind of silly, but no consequences for me for this project. Lesson: inspect the Gerbers carefully!

  • No thermal relief on any pads connected to the (numerous) copper pours. This was the most annoying, because it made soldering anything to the board challenging. (Some components ended up being less than perfectly placed…) My thinking on this was that all the copper pours were there for thermal reasons, so who would want to thermally relieve the connections to them? Turns out that’s not such a smart way to do things, especially for hand soldering. Workaround: solder really hard… Lesson: learn how to deal with thermal relief in KiCad properly, and think carefully about the balance between thermal conduction and manufacturability (and repairability, as @rich pointed out!).

1 Like

After a long wait, I got my Teensy Load boards, assembled one last weekend, and just had a testing session. Some things work, some don’t. The most critical thing (current limiting) doesn’t work, which is a bit rubbish, but it’s a chance to do some troubleshooting and work out what’s wrong. (This is the first project I’ve had that didn’t work first time, so I’m due some learnin’.)

What does work:

  • Talking to the DACs from the Teensy over I2C to set current demand and voltage limit.
  • Measuring current and voltage using the Teensy ADCs.

What doens’t work is current limiting: the current gradually creeps up until the power supply I’m using for testing starts cutting out. The gate of the current control FET starts off around Vdd then ambles down to some intermediate value instead of going low to switch the current off. The current set point at the non-inverting input of the current control op amp is about 3 mV, and the voltage measured across the sense resistor at the non-inverting input creeps up to about 25 mV without the FET switching off. (I suspect that those stupidly small voltages are part of my problem…)

Anyway, it looks quite pretty. Here’s the scene in my shed this afternoon (confused looking Ian out of shot!):

and here’s close-up of the little thing. You can see the Teensy slung underneath the board, the weird looking sense resistor I bought, the two DACs for setting the current demand and voltage limit, and my high-class hardware store standoffs and improvised stabiliser (OSH Park send you three boards, so why not make use of them?).

Nice log! I might know about your FET gate current limiting drive problem, can you let me have the opamp model no, and its power supply arrangement. Schematic if its something you can share would be helpful. (I should add I checked up-thread, and want to confirm you used the tlv4333 and its power supply which isn’t super clear from the schematic. And the diode too.)

The opamp is the TLV4333 and it’s running from a single 3.3V supply (taken from the Teensy, which has a regulator that generates 3.3V from the USB 5V input).

The whole KiCad project is at https://github.com/ian-ross/teensy-load, but the relevant part of the schematic is this:

(The suspicious-looking FET_GATE signal goes off to the anode of a diode whose cathode is connected to an opamp that sinks current when there’s an overvoltage, which isn’t the case so far in the testing I’ve been doing.)

So I believe you are seeing a limitation of the TLV4333. The relevant bit of the spec is p8, where the output swing is listed as limited to 30mV typ, (max 70mV) of the opamp rails (if its fed from 0V-3.3V -> 0.07V - 3.23V), which rather mirrors what you are seeing in terms of voltage.

[On the input side the TLV4333’s inputs seem able to sense and operate +0.1V outside the rails, which is nice. Other opamps are not so nice.]

Neither of these limits are typically modeled in a circuit SPICE simulator or similar, except at a chip-design transistor level and they don’t share those spice models, and they require specialist SPICE, several GB of IC foundry data etc. to run at all!

Rail to rail opamps should have a * next to that statement, as they typically mean “close” to the rail.

I hope I am not leading you away from the truth, I should have a proper look at the whole design you have provided.

Thanks for the tip. Looks like you might be right. Damn. That will teach me to really look at the details, instead of trusting lovely phrases like “rail-to-rail input and output”. Section 8.3.4 of the datasheet has a method to get output swing right to the negative rail, but it requires another negative supply below the negative rail, which kind of misses the point of a single-supply opamp!

What is the best way to deal with this? It seems like the simplest solution is just to set things up so that the signals being compared are bigger. Now I look at the schematic again, an obvious way to do that would seem to be to take the output of the current sense amplifier (which I use to drive an ADC on the microcontroller I’m using) and use that as one of the opamp inputs. Then I can use the current set voltage from the DAC I use to set the current level as the other input. Both inputs to the opamp then have a full-scale range that goes from 0 to Vdd: no more tiny voltages.

It would look something like this (quick scribble…):

Does that make sense? I can’t see anything grossly wrong with it, but I did make the original circuit with the 3 mV signals everywhere, so I can’t really be trusted!

Yes, they actually sell tiny dc-dc charge pump supplies to get that -200mV rail just for this purpose!

Unfortunately your opamp inputs already work in the range you need, but the output can’t get any closer to ground than it already is so the design tweak won’t work, unless I am missing something.

I need to take a moment to understand the whole design to make helpful recommends, I hope you don’t mind?

[Thoughts for next time I would actually suggest you look at the good old cap charge pump supplies to make a negative rail from your positive one for biasing. Here is an awful one: TC1044SCPA. However the noise rejection from power supply rails of modern opamps can be terribly impressive, and you can follow them with a linear to clean them up by another 20dB.]

Of course not! I’m in Europe anyway, so will be going to bed soon. I’m really grateful for your help!

That’s very useful to know! Here’s a TI app note that shows one way of doing it. (TI app note, but a Linear part for the charge pump… [Wrong. It’s a TI part. I thought LM… meant Linear.])

You could offset the sense voltage instead of a negative supply. A simple voltage divider and resistor to the sense resistor point can offset that by say 50mV (you now measure on a shifted voltage)

The input control voltage will be shifted also, so the DAC output voltage won’t current direct

… Won’t correlate to a current directly, but that can be calibrated out at regular intervals

Thanks, Klaus! That sounds like something that would work, and the DAC calibration would be easy enough.

Learning analog electronics is interesting. It’s been quite a while since I’ve started learning a new field where there are so many interconnected things to think about, and so many opportunities to make mistakes. It should be frustrating, but somehow it isn’t! (I do wish I’d started reading The Art of Electronics earlier though, since this project might be easier once I’ve read their opamps chapter.)

I think I might have found a little problem. It might not be everything that’s wrong, but it’s definitely a thing that’s wrong. Here’s a funny thing. If you’re in KiCad’s schematic editor, and you bring up the “add symbol” dialogue and search for “diode”, you get a symbol called “DIODE”. Which, if you’re me, you go ahead and use, assign a reasonable footprint, and you’re off to the races.

Unfortunately, a healthy dose of paranoia would have led to a careful reading of the small note that goes with that “DIODE” symbol, which says: “Diode symbol for simulation only. Pin order incompatible with official kicad footprints.” And indeed, every single two terminal diode footprint in the KiCad footprint libraries has the anode on pin 2 and the cathode on pin 1. This “DIODE” symbol has them the other way round. To be fair, the symbol is in a library that has “spice” in the name, but it seems a little unfortunate that the simulation symbols are different from and pin-incompatible with the “normal” symbols.

For reference, the right one to use is symbol “D” in the “Device” library.

Maybe I’ll try unreversing my diode tomorrow and see what happens…

I’ve been thinking about the problems I’ve been having more generally. I don’t think the output swing of the opamp is a problem: the threshold voltage for the FET I’m using is 1.7V, so the opamp only needs to bring its output below that to switch the FET all the way off. I think my tiny signals probably are a problem, and although I like the idea of using one of these charge pumps to fake up a negative rail (or doing the voltage divider plus opamp follower thing to make a split supply), I think Klaus’s suggestion of biasing the current sense point is what I’ll try. It has the great benefit of being something that can be bodged together with a few resistors. (Of course, I’m really hoping that putting the diode the right way round will make everything suddenly work, but it’s good to have an option to try if that’s not the case.)

There is an extra trick to get even better performance

You offset shift the sense voltage by say 50mV

That means the DAC has 0 current setting at 50mV, which takes up some of your DAC resolution

You can level shift the DAC output with the same resistance. The microcontroller is supplied from the same voltage, as is the level shifts. So it’s all ratio metric

For even better performance, use the same resistor array for both sense and DAC since the resistor values track almost perfectly, much better than 0.1% resistors

Thanks! I did wonder about offsetting the DAC output as well, but was worrying about matching the bias points. I hadn’t thought about a resistor array, but that’s definitely the right way to do it!

I think there will have to be a rev. 2 of this thing, even if I do get it approximately working with some bodging this time around. I’d like to have a “design to spec” success with it, rather than just a “limps along, sort of works” result. I’m learning a lot though, which is pleasing, even if the thing doesn’t work yet!

Trying out different ideas plays well with simulation so there’s no gotchas

But, just remember to sit down and look hard at your idea first. Just plopping stuff into Spice is not the way to learn, but can be tempting