Scott's Build Log

After a long hiatus, I am back with a few projects in mind. Here’s the first one! It’s just a very simple battery light with 18650s. My bathroom is dark and the only light is tied to a fan, which can be very loud in the morning

I wasn’t sure how I wanted to lay out the LEDs and if I wanted to do some in series and or parallel. The schematic has space for 6 LEDs all in parallel, but I’m thinking about changing up the setup based on some of your feedback.

The design is a very simple linear regulator. The question I have is should I do two LED is series and with two 18650s in series, or should I do LEDs in parallel and two batteries in parallel. I’m not sure what would be more efficient. I’m thinking that parallel batteries would be better since there should be less voltage overhead for the FET to deal with when the batteries are full.

I still need a case for it, which is something I’m not sure how to do best. Some form of opaque lens would be great, and something to hold the PCB in place. I’ve ordered the PCB already with two sets of mounting holes. I did order one box, but I’m not sure if it will work out now that I see it.


Now that I’m looking at it, I forgot to include pads for a switch! :flushed:

Forgot to mention that I built a small prototype to confirm that the circuit would work as intended and also see if there was anything wrong with the LEDs position. The current locations are the same as the PCB. Overall it seems okay, Fairly bright, but harsh. A lens should help with that and currents might need to be tweaked to make it better.

Scott, glad to see you’re building again! Getting one’s hand’s “dirty” is a great feeling.

Just a quick thing. I’d recommend trying out the translucent cover over the LEDs ASAP. Putting LEDs in parallel like that can lead to some being brighter than the others due to voltage mismatch. I’ve seen it where if you have just the bare LEDs, they all look matched, but when you put a diffuser on it, the mismatch pops out like a sore thumb. For really bright LEDs, a piece of paper does a surprisingly good job (in case you don’t have a diffused translucent piece handy).

It is nice to get back to it. There’s a few things I want to do, although I never know where to start.

That’s a good idea @seth.kazarians and something I completely forgot about. Balancing resistors would be a good idea. I’ll have to see if I can bodge some in when I get the PCBs in. Gonna add them to the schematic and PCB now though just in case.

I’m still on the fence about series vs parallel, but I moved to parallel wiring… for better or worse in this revision.




The 3D view has come in handy a few times for me. While I knew I had the battery holder on the bottom, I didn’t know exactly where the holder would be. It was nice to confirm it’s exact location and see how everything fits.

That should work. Hopefully the PCB you ordered is useable.

About series vs parallel, I’ve always made that decision based on the power source. Seeing as your input voltage is 3.7 and you don’t have a boost converter, you can only go with parallel. Stacking the cells or adding a boost converter would complicate the project a decent amount, so that’s your call if you want to tackle that.

I was thinking if I went with series batteries I would also change the LEDs to be paired up. The LEDs are typically 3V, so paired is 6V, and a max of 8.2V on the batteries isn’t horrible in that case. Parallel is a max of 4.2V, so the overhead on the FET is lower (which has to be good, no?).

So 6 LEDs at let’s say their rated 150mA is 450mA draw. Otherwise, if I do parallel there is 900mA draw, but twice the battery capacity to balance that out.

I would say parallel is better overall, but idk, I could just be misunderstanding something.

I agree that stacking the batteries in series would allow you to stack the LEDs as well. The max voltage of the batteries is 4.2V/cell, but they also go down to 3.7V/cell closer to the end of their charge, and start to drop off after that.

I hate to point this out, you might not actually be getting 150mA through each LED. I’d recommend measuring the voltage across the 15 Ohm resistors. Assuming the batteries are at 4.2 volts and the LEDs are 3V, then they would be at 1.2V. With 1.2V across 5 Ohms, that would be 240mA total. This is ignoring the contribution of the FET, the schotky diode, and the BJT. So each LED would be getting 240mA/6 or 40 mA through each.

With the schematic as it’s drawn and from my back of the envelope calculations, the total current through the LEDs is 140mA. You may want to use a lower value resistor for R3/R2/R4 to get the full current through. Albeit, if it’s bright enough for your use, then just leave it be.

Oh! I know that the LEDs aren’t getting the full current. I think right now I have a pair of 5.1 ohms down there and on my bench power supply that’s something like 240mA total at ~4v. I also only have 4 LEDs on my test board. So my numbers up there are totally just for easy math in a way.

The schematic is more for… Possibilities than anything else. Since I wasn’t sure what would look nice once it was in a case or maybe the brightness was way off or something, I gave myself some wiggle room in terms of layout and design. I could have made that more clear and I actually might toss that note on to my schematic later just so I don’t forget myself.

When I get the boards in I’m thinking I’ll play around with number of LEDs and the current some more. Since the idea is to have a nice looking light not just hitting some magic lumen output value.

I’m pretty stuck on that last part. Not sure how to best make a case for it. Mostly because a plain box won’t fly in the household. :slight_smile: think I can get some stuff that would be a nice diffuser, but not sure how to integrate that into a base.

So, like always, I’m not finishing a project all of the way (the LED light has stalled at the mechanical portion). And like always, I’ve started a new one that is easier to finish.

I found a blog post about a USB power distribution board that seemed really interesting. I’ve been wanting a USB power board for a while so I don’t need to use a battery based power bank. There were a few mods that I thought I would make to it though, so I went ahead and started on my own design.

I have a couple of questions, but otherwise, this went together fairly well (until you all tell me I did everything wrong! haha) USB_Power_Schematic_Rev_A.pdf (123.6 KB)

I did start from scratch with the design, so only the idea about what it is doing survived. The few questions I had are below:

  • Does the diode before the resistor feedback divider work? Aka, will I get 5V post diode opposed to 5V pre diode? My understanding is I would get 5V post diode
  • Does the 5.1V Zener and Current Sense circuitry play nice with each other? Or should I get a FET dedicated for the current sense shutoff?
  • USB D+/D-? Looking online it seems to say that they should be shorted for Charging only, which is fine as I don’t want to use these for anything fancy. they are mostly a dedicated 5/12V power supply that I will be able to play with. But I don’t want to accidentally shoot myself in the foot for a stupid reason.

The caps on the outputs for the USB and barrel jack I’m thinking are going to be fairly low (1uF or less) and the pot for the comparator was just going to be a 1 turn so I know where it is in the 1.5A range. Maybe I could put a dial on the silkscreen to help out!

Otherwise, any thoughts???

Did a first, second, and first and a half pass on the layout. I changed it once and hated what I did so I reverted the second pass to the first and then cleaned up my initial layout. I like it, I think it’s fairly well done.

Four layers is somewhat of a pain to get made, mostly because it’s expensive. While i don’t think I -need- 4 layers, I think it’s a good idea from an EMC point of view.

That looks great! What kind of part is RV1? Potentiometer? Any concern about the square annular ring around the circular drill?

Yes, RV1 is a 1 turn pot used for the current set. That is if I did the current set circuit correctly.

You know, I hadn’t actually looked at it properly. I thought it was going to be a square hole like it shows in the datasheet for the pot. Here’s the datasheet. Is there a good way of making squarish hole in KiCAD?

I decided to try the JLBPCB / LCSC combo order although I haven’t quite figure out how that exactly works.

Edit:

I decided to change the holes to be slots. That should be okay and I can always file it down by hand if I need to. Just trying to think if I need to update anything else, or if I should be good to send it off. Which is exciting but I don’t want to have to spin another board for a dumb reason.

Did a second revision. I was looking at where I could get the main driver and it wasn’t very easy with me getting parts from LCSC. So I found a new one (two actually since why not have a spare/backup with the same pinout).

The pinout was different and I had to redo it, but I think it’s pretty okay. I also added a new ceramic input cap.

Overall, I think it looks really good. Will likely order them soon.


Long post incoming!

I ordered the boards shortly after the last post. Finally got them in the mail yesterday and built of one them up! The yellow looks a little weird (especially because you can see the internal layers a little), but ah well.

It mostly works (which is a relief), but I need a better way of loading it for full testing. Any guesses what the next project is?

I have a few things I should note and one question for you all about the circuit.

The build went fairly well, I used InteractiveBOM and that was pretty nice. I need to update it though as I think there is now a progress bar. I did run into some issues though. I didn’t check the footprint of the USB connector that I purchased and I had to improvise a little. But it works good and seems to still have good enough strain relief. I also put the terminal block on backwards :upside_down_face: and I will have to bring the board to work so I can use the hot air station to remove it and flip it around.

I took some scope shots of the output at a few different cases. I’m pretty happy with the levels although I might add some more capacitance to the output. Not sure.

IMG_20190406_141717

IMG_20190406_141725

5V Output with no load:
5V_Out_No_Load

5V Peak to peak with 400mA Load:
5V_Pk-Pk_400mA_Load

Rise Time with no Load:
Rise_Time_No_Load

Rise Time with 400mA Load:
Rise_time_400mA_Load

I used an older phone and charged it with the board. Kinda… not great, not sure what I think about this.
Charging%20phone


And lastly, onto the issues with the circuit. There are two problems. Potentially related? The first problem is that the currently limiting doesn’t work correctly… Most of the time. What is supposed to happen is that the current is measured with the INA138 and the output is fed to a comparator (without hysteresis) to then control the enable pin. When it works as intended, there is a second issue. But onto that in a bit. The issue that I’m having is that the output of the INA138 doesn’t seem to be working as intended. I initially didn’t have the output gain resistor, but I put in a 100k before making the board. Thinking I didn’t have enough gain, I doubled it, but it still has some issues. The issue presents itself when I try to turn the current limit down to shut off the load. I am required to basically turn it all the way down as if the INA138 output isn’t working. Measuring it with a scope can either make the circuit work, or I measure negative voltage at the pin. After measuring it and it starting to work, it will work for some time afterwards, without the probe connected.

Some quick math, they list 100k as a gain of 20 in the datasheet for the INA138. I have a 0.068R sense resistor. Full scale of 1.5A means an sense voltage of 1.5 * 0.068 = 100mV (also the recommended level). A gain of 20 is a 2V output. I have a 0-4V pot range as the input to the comparator. I doubled the gain to 40 after doing some testing (I should have done this before building the board the first time!). So I should be able to have a pretty 1 to 1 relationship between the pot and the current output.

I currently have a 12 ohm resistor for a load. 5V / 12R = 0.41 mA. Moving on, 0.41 * 0.068 = 27mV. 27mV * 40 (Gain) = 1.1V. When I measure the pot when the circuit is working, I measure around 910mV. There’s some error there, but for the moment, that’s fine.

Away from the math now. Not sure why the circuit isn’t always working. Seems strange.

Lastly the circuit, when working, can get into a weird state, where the comparator is starting to assert, but then the current drops because the voltage drops and it turns back on. See trace below. I’m not sure this is something that I can solve without some more components, but what could I potentially do to solve it?
I’m not super concerned with this, but if there is a simple fix, that would be cool.

Inbetween_Current_limit_issue

Wow, I’m back after over a year! Time sure does fly. 2020 has been a crazy year so far, but at least it’s given me the opportunity to work on my own projects again. At least a little.

I started working on a Current Sink/Source (which was based on the CE course) a while ago and have recently come back to it to make some updates/fixes based on some new thoughts on how I should tackle it. I’ll spare you the long list of things I did/changed, but I’m pretty happy with how it’s turned out (in simulation and PCB design).

In terms of specs:

  • Input voltage: ~2.85 - 18V
  • Output voltage: 0 - 15V (with over voltage protection)
  • Output Current: 0 - 2A (Limited to 1A when powered off of a battery)
  • NTC monitoring of the heatsink to activate a fan when 12V is present

Now the important bits, things I have learned!

  • When using a linear regulator, check the power dissipation specs even for low power applications
  • When putting things in a set enclosure (off the shelf) think about:
    • Where the big items go
    • Mounting hole locations
    • PCB clearance for any internal features of the enclosure
    • Always double check the enclosure / PCB fit!
  • Before starting layout, think about what makes sense for each side of the PCB. What should be “visible” on the top
  • Try to simplify the design from your initial thoughts
  • Label everything!
    • I didn’t do this on my previous board and it’s a bit confusing now looking back at what some of the switches are for.

Question time:

  • The ground pour on the bottom layer, is it needed/worth it since I have a ground pour on top?
  • Maybe with some additional via stitching?
  • Are there any glaring issues/concerns?
  • HOW DO YOU KNOW WHEN TO STOP TWEAKING THE DESIGN???

The money shots:
Top of the PCB

Bottom of the PCB (This is the ground pour I’m curious about)

3D Render with the bottom of the housing

Hi Scott! Looks good!

I’ve been working on a vaguely similar thing (also based on the CE course). Waiting for boards right now.

I hadn’t thought of putting mine in a box. That would definitely look a lot more professional! And I like the heatsink fan idea. But it’s too late to tweak the design (again) once it’s been fabricated and is in the mail…

I don’t have any useful answers to your questions, and I also find the temptation of infinite tinkering hard to resist. It does seem though that you need to have physical boards in your hand to spot the last mistakes in your design, so too much extra tweaking might not help anyway.

Here’s mine (the only slightly innovative thing is that it’s connected to a Teensy, so it’s programmable and you can collect discharge curve data):

Schematics: Ian's Build Log
Layout: Ian's Build Log

Interested to hear how your works once you get it made!

You had some nice ideas with your design. I had thought about breaking out some pins to send to a microcontroller, but decided that I didn’t need to do all of the things on this design.

It does seem though that you need to have physical boards in your hand to spot the last mistakes in your design, so too much extra tweaking might not help anyway.

It’s so true and painful. There were some things on the last board that I was like “Oh I should have done this or that” after I got them. But it’s just small things.

I hadn’t thought of putting mine in a box. That would definitely look a lot more professional! And I like the heatsink fan idea.

Oh don’t worry, it doesn’t -quite- fit in the case. I’m thinking maybe I’ll cut a hole in the top of the case for the heatsink, or I’ll cut down the heatsink to fit in the case since the fan can help with that higher power dissipation. But yes, I thought it might be a fun idea to try to include a case and a fan for that little bit of extra work.

I ordered my components for the CSOS and realized I had an issue I needed to solve: how to store all of these new components. After researching some and asking my wife for her idea, I went with film strip archival sheets (the wife’s idea). I finished it, and while I don’t know exactly how I’ll store it, I really like how much space there is for multiple strips of the same value!

It’s not organized by value or anything, but at least they are in a more easily browse-able format.

Now it’s time to wait for the PCB to show up (it shipped two days ago from JLCPCB)! I’m excited and going to think about what the next project will be!

1 Like

I got my PCBs! I soldered one up and wouldn’t you know??? It doesn’t work!

At least, that’s how I was going to start this post, but actually, after a few silly mistakes (bad job soldering some SOT-23-6 parts, blowing up a TVS, soldering the wrong value resistors in, and misunderstanding what the issue even was) the board works! I still have to do some deeper testing to make sure that there aren’t any issues that I can’t see with the eye. But the output is stable (per a DMM and the current reading on my cheapo PSU) and the features I’ve added all work (fan control based on the heatsink’s temp, switched max currents based on the input voltage). I didn’t make the voltage cutoff adjustable, but I might be able to hack that in pretty easily.

I need to put thermal paste on the FET and my NTC temp gauge to make better contact with the heatsink. In addition, I need to figure out what temps the fan is turning on at and how well it can keep it under control. Initial testing shows that it reaches equalibium for a 20W load at around 11.2V on the fan. I had thought I designed it to be a latching output from the op-amp, but clearly it doesn’t. But that’s actually nice as it means the fan can slowly ramp up in speed if the wattage is lower. The fan is driven straight from the non-battery input (so 12V in my testing). I also need to get scope readings of all of the major points and make sure nothing too bad is happening.

Overall, I’m very, very pleased with myself on being able to follow along with the course materials and also make some interesting modifications to the design… mostly because I could! The other thing I need to do now is to see if I can put it into a case proper. My initial case idea is a little jank and I’ll see if I can’t make one or buy a new one that actually fits the thing inside!

1 Like

Excellent stuff! Well done. Looks pretty serious too, with the big heatsink and the fan…

I got the boards for my current sink thing and soldered one up last weekend, but I’ve not had a chance to test it yet. Maybe later today? (I’m now feeling bad that I’ve not done it, since you managed to assemble and test yours since the last time you posted!)

Anyway, great job! What’s next?

1 Like

I was aiming for a 30W load sustained with the fan with a heatsink temp of around 50-55C. Didn’t want to make it to dangerous to touch. Not sure if I’ve hit that, but I also need to test the temps in general. The heatsink is rated for like 15W or so without active cooling for a relatively cool temp.

The next project is going to be an RGB panel driver board thing that can display some animations. I have the 32x32 display already and want to put it to use. I was reviewing the library that Adafruit wrote for it and am pretty confused by what they are doing. My hope was to dissect it into the bits that I care about and program the things I needed for a custom controller board for it. Something with a higher clock speed than an Arduino typically. But reviewing the code just made my little baby programmer eyes glaze over and is making me rethink my idea. I would still like to write a library from scratch so I could better understand it, but I’m not so sure that’s viable now.

As for your board, I’m surprised that you could solder it up and NOT want to test it right away and get it all working and fancy. But don’t feel bad that you haven’t been able to! It’s there waiting for you, whenever you are ready!