Gas station without pumps

2022 October 27

LED board schematic

Filed under: Uncategorized — gasstationwithoutpumps @ 12:40
Tags: , , ,

I did a series of posts about the LED boards that I designed for lighting and strobes (starting with Summer project in 2014), but I just realized in going over the posts that I never posted the schematic nor explained how the board worked. I had to dig out the Eagle files on my old laptop to find the schematic, then redo it in Scheme-It to make it look reasonable.

Schematic for the LED board. This design is version 8, and is the one I actually had made.

The resistor R1 is a current-sensing resistor, measuring the current through the nFET Q2 and the LED. When the current is high enough, the voltage on the base of Q1 becomes large enough to turn on the NPN transistor Q1, lowering the gate voltage on Q2 and starting to turn the nFET off.  When the current is low, Q1 is off and the resistor R2 pulls the gate voltage for Q2 up, turning on the nFET more strongly. The Schottky diode D1 is just there to protect the LED from large reverse voltages if the board is hooked up backwards.

Power is dissipated in 4 places: the LED itself, Q2, R1, and D1. Based on the measurements in LED board I-vs-V curve,  the current is limited to about 118mA, so the voltage on the base is about 0.555 V when Q1 starts to turn on and R1 dissipates about 65mW. There is some current going through R2 and Q1 that doesn’t go through the LED (probably about 1–2mA), depending on the voltage applied to the whole board, but it is only about 1% of the total current, so I’ll ignore it—we may have another 30mW dissipated in R2.

I probably should measure the voltages across R1, on the base of Q1, on the gate of Q2, on the drain of Q2,  and across D1 to get detailed information about where the power is really being dissipated.  I think that the voltage across the LED should be about 6V when the board is fully on, and the voltage drop across the Schottky diode should be small (maybe 0.1V for 12mW).  For board voltages before the current limitation cuts in, almost all the power goes to the LED.  At higher voltages, the extra voltage drop and power dissipation is all in Q2, with around 700mW dissipated in Q2 when the board voltage is 6V higher than where the current limitation starts and 700mW delivered to the LED. That’s about as high as I’d be willing to go for continuous lighting, even with a heat-sink on the board.

I should be able to make the measurements fairly easily with the Analog Discovery 2, and I might do so later this week. One thing I’m curious about is whether the drop in current with higher board temperature is due to changes in the characteristics of the NPN transistor or the nFET.  The nFET is dissipating most of the power, so its junction temperature is probably changing much more, though the LED and the nFET together warm up the whole board, so the NPN transistor is getting warm also.

2018 July 19

Dropping old LED lighting project

Filed under: Uncategorized — gasstationwithoutpumps @ 14:28
Tags: , , , , ,

About 4 years ago, I started a project to replace the breakfast room ceiling fan (which my wife has always hated) with an LED fixture of my own design.  In order to do this, I designed some custom LED boards that could work over a range of voltages with PWM control of the brightness and I made some desk and table lamps using the boards, as well as a stroboscope (Summer project, LED board I-vs-V curve, Summer project 2, Desk lamp, Newer dimmer software, LED strobe using dimmer boardHalloween 2016, … ).

Although I have had the electronics done for the breakfast room fixture for about 3 years, I’ve not been able to come up with a mechanical design that I think will look good.  Also, the task of cutting the conduit in the attic to install an outlet for the wall-wart power supply did not appeal to me, so I kept putting off the project.

Last weekend, my wife, my son, and I went to the local Habitat for Humanity ReStore, ostensibly to look for cabinet handles and doors, but mainly just to browse. While there, we saw a used drum light ceiling fixture that was on sale for only about $16 (it is one that normally sells for around $120 new from Home Depot).  Since I had pretty much given up on coming up with a design using my LED boards that would look good, and my wife liked the drum fixture, we bought it and my son helped me install it.

The hardest part of the installation was probably pulling new wire through the conduit, since I did not want to use the old cloth-covered solid copper wire that was there.  I also added a grounding screw to the junction box for the lamp, since the old ceiling lamp had no ground connection.

Here is the “new” ceiling lamp in daylight.

Here is the ceiling lamp with 3 2700K LED bulbs.

Lining up the screw holes of the fixture with the screw holes of the junction box was also a bit tricky—my son’s holding the fixture while I fussed with that was a big help.

The whole project cost under $30: $16 for the fixture, <$3 for screws and wire, $7.50 for 3 LED bulbs. The new lamp is not dimmable (because of the cheap bulbs I chose), but that feature was not really needed for the breakfast room anyway.

So I now have a lot of spare LED boards that I need to find a project for—I’ve used a few of the boards for the desk lamp and stroboscope projects, but I don’t really need another desk lamp or stroboscope.  Anyone have any ideas?

2016 July 30

LED strip power consumption

Filed under: Data acquisition — gasstationwithoutpumps @ 16:38
Tags: , , ,

I mentioned in LED lighting for bathroom that the LED strips I had bought from China were much yellower than I expected and were lower-powered than the seller claimed.  I believe that they sent me a different LED strip than what they had advertised (a cheaper product using 3030 LEDs instead of 5050 LEDs), but that is a risk one takes in ordering through AliExpress.  Although I could have started a claim against the seller, I had already cut up and installed the strips, so I did not feel justified in asking for a refund.  The amount was small enough that I just wrote it off and ordered another set of LED strips through AliExpress, making sure they were from a different seller and were well described on the web page.

The new strips did indeed use the 5050 SMD LEDs that both strips claimed to use—the LEDs were substantially larger, through the strips were the same size.  I installed the new strips alongside the old ones, and they are substantially brighter and whiter.  It is also clear that the old power supply I was using was not able to handle the load of the new strips, reaching a current limit of about 1.5A with voltage dropped to about 11V (though it claimed to be 12V 2A). I have ordered a new 12V power supply, Mean Well SGA60U12-P1J, which is a modern, efficient power supply and should be able to deliver 5A. Will that be enough?

Because my old supply was being limited by the current it could supply, I did not have a good estimate of the power needed by either the new or old strips.  In both cases, the seller had said 14.4W/m, which is 1.2A/m @ 12V.  I know that spec is wrong for yellowish lights (they are smaller LEDs than the 5050 LEDs I’d ordered), but I was curious what the power consumption really was.

So I decided to measure a 5cm length of  each of the strips (5cm is the smallest unit for the strips, standard for most LED strips).  The 5050 strip has 3 resistors in each unit, so consists of 3 copies of a 150Ω resistor in series with an LED module that internally has 3 LEDs in series.  The yellowish strip has only one resistor in a 5cm segment, so consists of three LEDs in series with a 100Ω resistor. I can tell the resistor values, because they are clearly labeled SMD parts.

To make the test pieces, I cut the strips at the 5cm cut line, then used a razor knife and a pair of long-nose pliers to peel away the waterproofing from the copper pads. I soldered red and black stranded wires onto the pads, then used some heat-shrink tubing to insulate and stabilize the connection, providing a tiny amount of strain relief.

The newer 5050 strip is on the top. The incorrectly shipped 3030 strip is on the bottom.

The newer 5050 strip is on the top. The incorrectly shipped 3030 strip is on the bottom.

I wanted to make I-vs-V plots for the LED strips using PteroDAQ, but the Teensy board ADC is limited to 3.3V, and the voltages I needed could go well over 12V (12V for the LED strip plus whatever I needed for the current sensing).  I could keep the voltage down for the current sensing by putting the current-sense resistor on the ground side of the LED strip.  If the 14.4W/m @12V figure from the seller is accurate, then I’d expect about 60mA for a 5cm section, so a current-sense resistor <55Ω would keep the voltage in a measurable range.  But to measure the voltage across the LED, I need a voltage divider.

My first attempt was to use a 62kΩ and a 15kΩ resistor to get a nominal divider ratio of 0.1948.  To check this ratio, I used the function generator to sweep over most of the 3.3V range, measuring the input and output of the voltage divider at each point with two channels of PteroDAQ.  I saw some weird non-linear behavior of the output of the voltage divider vs. the input, so I did a fit assuming that the ADC had a fixed offset voltage, besides the scaling of the voltage divider (this 2-parameter model worked better for tests that I’ll describe below than just a scaling by the voltage divider, so I used it for this initial test set also). Although I usually make PteroDAQ measurements in volts, I redid the measurements in raw ADC integer values, because the pattern of the values suggested a relationship to the binary encoding.

The error in the output voltage measurement shows a distinctive pattern, corresponding to the high-order bits of the ADC value.

The error in the output voltage measurement shows a distinctive pattern, corresponding to the high-order bits of the ADC value.

These results were unexpected, so I decided to explore further, replacing the 62kΩ:15kΩ voltage divider with a 10kΩ potentiometer and using it at various settings.  It was with this data that I decided that a constant offset was needed to get the voltage divider fits to work well:

With the 10kΩ potentiometer, the patterning of the errors is barely visible, and the errors are much smaller than with the 62kΩ:15kΩ voltage divider. The offset was chosen for the d=0.0581 divider, but worked well for all the dividers.

With the 10kΩ potentiometer, the patterning of the errors is barely visible, and the errors are much smaller than with the 62kΩ:15kΩ voltage divider. The offset was chosen for the d=0.0581 divider, but worked well for all the dividers.

Given that the patterned errors were now much smaller than the random noise (which I had already minimized by using 32× hardware averaging), I suspected that the problem was not an inherent non-linearity of the ADC, but poor behavior of the ADC due to the high impedance of the source.  I tested this two ways: first, by adding a resistor between the voltage divider output and the ADC pin (which should increase the source impedance without changing the voltage being measured) and second, by using a unity-gain buffer to provide a low-impedance source for the ADC pin.

With a 15kΩ resistor between the potentiometer voltage divider and the ADC input, I got patterned errors similar to what I first observed with the 62kΩ:15kΩ divider, but the offsets needed to get good fitting did vary a bit with the divider ratio:

The problems with the 62kΩ:15kΩ ADC measurements were caused by the high-source impedance, since adding extra impedance to the 10kΩ voltage divider created similar problems.

The problems with the 62kΩ:15kΩ ADC measurements were caused by the high-source impedance, since adding extra impedance to the 10kΩ voltage divider created similar problems.

I also tried 62kΩ added between the voltage divider and the ADC pin, but that caused huge problems with reading the value.

Adding a unity-gain buffer between the voltage divider and the ADC pin cleaned up the problem, though there is still a little patterning of the error.  Here I modeled the offset as occurring in the unity-gain buffer, so that the offset is just on the divided-down channel, not on the other channel.  This has exactly the same fitting power as a model that provides the same offset on both channels, but this model is more explicable, since op amps are known to have input offset errors, and the 580µV error estimated here is well within the ±4.5mV spec for the MCP6004 op amp.

The divider ratio of 0.1942 is for the 62kΩ:15kΩ divider, which has a nominal ratio of 0.1948.

The divider ratio of 0.1942 is for the 62kΩ:15kΩ divider, which has a nominal ratio of 0.1948.

So I was finally ready to measure the voltage and current for my LED strips. I put the LED strip in series with a current-sensing resistor, measuring the current-sense voltage with channel A0 and the divided-down and buffered LED+current-sense voltage with channel A1. Because my function generator is not capable of generating a 12V output, I put it in series with a 9V power supply, so it only had to generate -2V to +4V.  Of course, since it has an output impedance of ~50Ω, and I was asking for up to 60mA, the function generator needs to generate higher voltages at the source, to compensate for the 3V IR drop.

At 12V, we get 55.2mA/5cm or 1.1A/m for the 5050 warm-white strip and 18.1mA/5cm or 362mA/m for the 3030 yellow-white strip.

At 12V, we get 55.2mA/5cm or 1.1A/m for the 5050 warm-white strip and 18.1mA/5cm or 362mA/m for the 3030 yellow-white strip.

Note that for the 5050 strips, about 3.05W/m (of the 13.2W/m, so 23%) is wasted in the current-limiting resistors, and for the 3030 strips, 655mW/m (of the 4.34W/m, so 15%) is wasted.  These losses are normal for LEDs with current-limiting resistors, which is why higher-power LED lights use switching regulators to control the current through the LEDs, rather than current-limiting resistors.

I have 1.92.9m of each type of strip in the bathroom cove, so the total current needed is about 2.794.25A, well below the 5A limit of the new MeanWell power supply, but large enough that the power-supply will be in regulation and efficient (efficiency of the power supply is claimed to be about 88%).  Assuming that the efficiency is as claimed, the new LED lighting should take about 3851W, considerably less than the 120W of the fluorescent fixtures that it replaces, but with about the same effective brightness and a more pleasing color.

The nearly straight lines for the I-vs-V plots can be approximated as a resistance and a threshold voltage, which works well for higher voltages, but underestimates the current for low voltages:

The simple resistance models are within measurement accuracy above 10V—measurement accuracy is limited by the changing of LED characteristics with temperature.

The simple resistance models are within measurement accuracy above 10V—measurement accuracy is limited by the changing of LED characteristics with temperature.

2016 July 4

LED lighting for bathroom

Filed under: Uncategorized — gasstationwithoutpumps @ 20:52
Tags: , , ,

I’ve been making a project of replacing all the fluorescent lights in the house with LED lights. For the compact fluorescents, this is easy—when a CFL bulb burns out, I replace it with an LED bulb of similar brightness. The tubular fluorescents in the kitchen, the bathroom cove lighting, and the dining-room cove lighting are more of a project.

This weekend I finally got the fluorescent lighting in the cove around the skylight in bathroom replaced with LED strip lights. Unlike the kitchen LED lights, I did this project entirely myself.

First, I removed the old fluorescent fixtures (2 40W and 2 20W fixtures) and replaced them with an outlet in the corner of the cove. Those fluorescent fixtures were 24 years old, from the 1992 remodel of the bathroom, and I’d never really liked them much—the ballasts tended to hum, and the bulbs needed to be replaced every few years.

I then cleaned and painted the interior of the cove to make it more reflective (it had just a thin coating of primer before).  It was a bit awkward working at the top of the ladder, and I managed to get a couple of smears of the semigloss paint on the walls of the skylight, not matching the previous matte white walls.  Luckily they’re not too visible unless you are looking for them.

I measured lengths of LED strips to fit the cove, cut the strips with wire cutters, shaved off the silicone waterproofing where I needed to make connections, soldered on flexible wires, and covered the connections with heat-shrink tubing. I also made a little barrel-connector-to-screw-terminals board to distribute the 12V power to two strips, with each strip connected to a different pair of screw terminals.

Here is the outlet in the corner of the cove—because the cove was deep enough for the old fluorescent fixtures, it was deep enough to conceal the outlet box mounted vertically. The 12V wall wart connects to two LED strips, each of which covers half the perimeter.

Here is the outlet in the corner of the cove—because the cove was deep enough for the old fluorescent fixtures, it was deep enough to conceal the outlet box mounted vertically. The 12V wall wart connects to two LED strips, each of which covers half the perimeter.

The strips have adhesive on the back, so I just stuck them to the middle of the cove.

The strips have adhesive on the back, so I just stuck them to the middle of the cove.

At two corners of the cove, I used flexible wires to connect separate straight strips.

At two corners of the cove, I used flexible wires to connect separate straight strips.

From below the light is a soft glow—there is additional separately controlled can lighting over the mirrors and over the shower stall, so the cove lighting around the skylight is only to provide diffuse ambient light, not bright task light.

From below the light is a soft glow—there is additional separately controlled can lighting over the mirrors and over the shower stall, so the cove lighting around the skylight is only to provide diffuse ambient light, not bright task light.

I bought 5m of 60 LED/m strip lighting from Aliexpress and used 3.9m of the strips. I measured the full 5m length as taking 1.13A at 11.5V (13W). I had expected the LED strips to take much more power, since the seller advertised them as 14.4 W/m, but that seems to have been a mistake (or a lie).

The 3.9m I used should take about 10.1W, but the wall wart is using 20W, so it is only about 50% efficient.  I may want to get a smaller, more modern wall wart, to get higher efficiency. There is a little less light from the 20W of LED lighting than from the 100W of fluorescent lighting, but not as much less as one might expect, and the soft yellow light is plenty for night-time trips to the bathroom.

The amount of light from the cove is much less than the light from one row of the LED puck lights in the kitchen, though the power consumed is similar (20W for the bathroom, 22W for one row of the kitchen lights). The differences are

  • direct illumination by the pucks vs reflection off the skylight walls for the cove lighting,
  • 3000K for the pucks vs. very yellow light for the cove, and
  • efficient modern wall wart for the pucks vs. old, inefficient wall wart for the cove.

My wife rather likes the warm yellow light, so I’ll leave it alone for now.  If I get irritated with it, I can always rip out the LED strips and put in new ones (the cost of the LED strips is < $20).

2016 May 11

Don’t put pulse monitor first

Filed under: Circuits course — gasstationwithoutpumps @ 21:25
Tags: , , ,

In Revised microphone pre-amp lab too long I said,

I think that the soldering lab should not be the first op-amp lab, but I still like the idea of the students having to solder up their microphone preamps. So I’ll have to do a major reorganization of the book this summer, to move a different lab into the first position.

Currently, I’m thinking that the transimpedance amplifier and pulse monitor lab would be a good choice as the first op-amp lab.

After a rather rough start in the first half of the transimpedance-amplifier lab yesterday, I no longer think that is a good idea. The instrumentation-amp lab went much smoother, so may be a better first choice.  Among other advantages, the instrumentation-amp lab with the pressure sensors has no analog filtering and simpler sensor sensitivity calculations.  One disadvantage of moving away from the mic preamp is that the microphone and loudspeaker characterization in the first half of the class would be separated from the audio amplifier design in the second half—not a problem in a single quarter class, but potentially a bigger problem in a two-quarter sequence.

I’m not sure why the transimpedance amplifier lab went poorly yesterday, and I’m hoping the second half will go smoother tomorrow.  It may be that prelab was not a good match for the lab this time.  Or it may be that over a third of the class didn’t do the prelab this time.  (I’ve threatened the class with a quiz worth as much as a design report if they don’t shape up by next week—I’m carrying around enough redone reports to grade that I really don’t want to do more grading, but I’ll follow through on the threat if so many students continue slacking.)

It turns out that I had several errors in the draft of the book that the students were using for the prelab exercises for the optical pulse monitor.  I’d decided in the summer or fall to switch to a new 700nm LED, but I’d only updated about half the scaffolding for the sensor sensitivity, so there were still a number of things that were only accurate for a 623nm LED.  Also, I’d been using a datasheet for the WP3DP3BT that I’d gotten when I first started using the part, but Kingbright has improved their datasheet a lot between V3 (which I had) and V5 (the current one), so there is now a spectral sensitivity curve on the datasheet, and the spectral sensitivity is quite different from what I was expecting.

I’ve started editing the book to correct the errors, but even after I fixed everything, the estimates for the current from the phototransistor were about 5% of what students were measuring in the lab. The model I had created, which worked fairly well for the previous LEDs, does not seem to work for the longer wavelength of the new LED.

I’m considering simplifying the model by eliminating the modeling of scattering, to see how well that works.  I should check the model with at least 3 different LEDs: the current 700nm one, the shorter wavelength ones I used to use, and an IR emitter.  If I can get the estimates to be within a factor of 10 of measured values for all the LEDs I have, then the model is good enough to include in the book.

I might also want to consider switching phototransistors to one with a wider spectral sensitivity, so that the estimation is not thrown off as much by the filter that blocks so much of visible light.  That would allow me to try a green LED as well.

I’m still thinking about doing a log-transimpedance amplifier as the first stage (not for the class, just for a demo unit) so that the pulse monitor can work in varying light levels up to full sunlight.  The fluctuation in light from the pulse seems to be about 1%, which should be a variation of about 850µV out of the logarithmic amplifier (based on the 9.8mV/dB I measured in Logarithmic amplifier again).  That’s a somewhat smaller signal than I’ve been getting with well-chosen gain resistors, but it may be worth it to get greater independence from the overall light level.

Next Page »