Gas station without pumps

2015 July 27

Arduino as ISP

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

For the LED lamp projects, I’ve been using ATtiny13A chips for the dimmer board, programmed with the Arduino IDE and an Arduino board as an In-System Programmer (ISP).  The Arduino code is too big for an ATtiny, so I’ve been using a version of the core13 stripped-down system.

I got rather tired of wiring up the 6 wires for the ISP, checking to make sure that each one was correct.  What I wanted to do was just plug in a standard 6-pin cable from the Arduino board to the ATtiny board, but the ISP header on the Arduino board has the Arduino reset line, not the reset line that has to go to the ATtiny board.

I decided to modify a standard cable to do the right thing, separating the reset line from the rest. The reset line is on pin 5, so on a standard ribbon cable, it is the fifth of the six wires.

First I carefully cut wire 5 near one of the plugs with a razor knife, peeled it back and spliced on another piece of stranded wire:

The blue wire and wire 5 of the ribbon cable were soldered together and covered with heat-shrink tubing.

The blue wire and wire 5 of the ribbon cable were soldered together and covered with heat-shrink tubing.

I taped the soldered joint to rest of the ribbon cable for strain relief, and added a crimp-on female header at the other end. (I prefer female crimp-on headers, because they are more versatile than male pin—I can stick in a double-ended male header pin to convert them to male connectors when needed.)

The electrical tape stabilizes the splice and the crimp-on female header allows connecting to male or female headers on the Arduino board. Here there is a double-ended male header pin in the female header, to convert it to a male header.

The electrical tape stabilizes the splice and the crimp-on female header allows connecting to male or female headers on the Arduino board. Here there is a double-ended male header pin in the female header, to convert it to a male header.

Here is a Leonardo board being used to program one of the dimmer boards:

With the new cable, it is easy to unplug the cable after programming to test out the system, then plug it back in with the right orientation (I used a shrouded header on the dimmer board) when reprogramming is needed.

With the new cable, it is easy to unplug the cable after programming to test out the system, then plug it back in with the right orientation (I used a shrouded header on the dimmer board) when reprogramming is needed.

Note that the reset line for the ISP cable connects to pin 10 of the programming Arduino board, which would be connected via a USB cable to the laptop that has the Arduino development environment on it.

I’ve seen several kluges on the web for connecting up Arduinos as ISPs, but none were as simple as and easy to use as what I did here, so I thought I ought to share it.

2014 December 28

Desk lamp

Filed under: Uncategorized — gasstationwithoutpumps @ 18:47
Tags: , , ,
Side view of the desk lamp, showing the pair of pipes tilted down, to keep light from shining in my eyes.

Side view of the desk lamp, showing the pair of pipes tilted down, to keep light from shining in my eyes.

In Summer Project and Summer Project 2, I introduced the project I’ve been working on all summer: a “kit” for making dimmable LED lamps, and I showed the custom desk lamp I made for my son and the table lamp I made for my sister. I’ve finally gotten around to making a desk lamp for myself (I’ve spent most of my “free time” this quarter grading or doing administrative paperwork). The desk lamp is similar in spirit to the one I made for my son, but a bit larger and sturdier.  Instead of using 10-gauge wire to support the LED boards, I used ¼” copper pipe, squeezed flat and drilled where contacts are needed.

I’ve currently populated it with 5 LED boards, but there are holes drilled for 6. I had planned to populate all 6, but I damaged two of the LED boards in assembling the lamp, scraping off a diode from one board, and both a diode and a resistor from the other. Clearly, if I plan to make the LED boards a hobbyist tool, they’ll have to be a bit sturdier. I may need to look into how difficult it would be to pot the component side in an epoxy resin.

Looking at the light from below, you can see the five populated spaces and the one empty one.

Looking at the light from below, you can see the five populated spaces and the one empty one.

Based on the measurements and calculations from the data sheets I did in LED board I-vs-V curve, I should be able to get up to 75 lumens per board, for a maximum output of 375 lumens (450 lumens if fully populated).  The lowest setting on the dimmer should be around 9–10 lumens.

From above, the heat sinks are clearly visible. At the low light setting I expect to use most (around 20 lumens per board), the heat sinks aren't needed, but at full intensity they might get warm.

From above, the heat sinks are clearly visible. At the low light setting I expect to use most (around 20 lumens per board), the heat sinks aren’t needed, but at full intensity they might get warm.

I set them on full for a few minutes and measured the temperature of the heatsinks with an infrared thermometer. This is not a very reliable measurement, since the heatsinks are a tiny target, but I got a peak measurement of around 57°C. At those temperatures, it is clear that the heatsinks are needed, as the case temperature of the MP3030 LEDs is limited to 80°C.

Inside the box is just the dimmer board, a barrel jack, and the nuts for the screws holding the copper pipes to the box.  These cheap wooden craft boxes (intended for découpage) make good project boxes for electronics—they look better than plastic boxes and don't cost any more.

Inside the box is just the dimmer board, a barrel jack, and the nuts for the screws holding the copper pipes to the box. These cheap wooden craft boxes (intended for découpage) make good project boxes for electronics—they look better than plastic boxes and don’t cost any more.

The photos were all taken in my breakfast room, since my desk is far too messy to clear in a reasonable amount of time.

My next lamp project will be a hanging light fixture for the breakfast room. That is somewhat more ambitious project as it means rewiring part of the house—I don’t want to run the 9V DC in the same conduits or junction boxes as the 110V AC. Unfortunately, the junction box in the attic above where I want the dimmer to be is a nexus from which several AC runs fan out. I’ll have to reroute a lot of that wiring to a new junction box, which means pulling some new wires (the wire in the conduits in 65-year-old solid copper with cloth insulation).

2014 October 19

Summer project 2

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

In Summer Project, I introduced the project I’ve been working on all summer: a “kit” for making dimmable LED lamps, consisting of

  • a dimmer board that reads a potentiometer and converts it (non-linearly) to a pulse-width-modulated 9V output signal and
  • LED boards that hook up to the two wires of the PWM input signal, and that can be run in parallel,

and I showed the custom desk lamp I made for my son.  That was a fairly quick build, because it needed to be functional, but did not need to be very pretty—my son likes the exposed-wire look.  I asked him today how the lamp has been working out for the past week—he almost always uses it near the lowest setting, since he is either just filling in some shadows in an already lit room, or he is working at his desk while his roommate is sleeping.  In both cases he doesn’t need or want much light.  I suggested unmounting some of the LED boards, to get more control at the low light levels he needs.  Based on the measurements and calculations from the data sheets I did in LED board I-vs-V curve, he should be getting a range of  10–375 lumens from his desk lamp.  With only 3 LED boards, he would have a range of 6–225 lumens. But he likes having 5 shadows, so he turned down the suggestion. I considered changing the firmware for his lamp, to provide lower levels (has has all the equipment and software needed to reprogram it), but it is hard to get a duty cycle lower than 0.2% from the PWM controller.  If he really wants to go to low light levels, he could replace the 9V power supply with a 5V one, but then he’d have a range of 0.008–0.3 lumens, when what he probably wants is 1–40 lumens, which would need a 5.5V supply (not a standard size).  I think that he’ll sometimes need the 200–375 lumen range for task lighting when he is working with something fiddly late at night, so he is probably best off keeping with a full-power lamp.

The other project I mentioned was making a prototype table lamp for my sister, which needs to look a bit nicer, since she is considering making a series of table lamps using stiffened-silk shade.  I’ve now finished a prototype to send her, pictured below:

Here is the lamp, turned off.  The base is a wooden bowl from the thrift store, sanded so that it sits flat.  The upright is a standard brass lamp pipe, and the shade is just folded out of a 0.5m square of paper (the most common fold for making a paper cup).

Here is the lamp, turned off. The base is a wooden bowl from the thrift store, sanded so that it sits flat. The upright is a standard brass lamp pipe, and the shade is just folded out of a 0.5m square of paper (the most common fold for making a paper cup).

When turned on, the lamp produces a modest downward light and illuminates the shade.

When turned on, the lamp produces a modest downward light and illuminates the shade.

The lamp is done except for a knob for the potentiometer for controlling the dimmer. The only knobs I have are too large and industrial looking—I’ve ordered some smaller metal ones via Amazon, but they are being shipped from China, so I’ll probably have to mail my sister the lamp before the knobs get here. It turns out that if you want decorative, rather than ugly plastic, potentiometer knobs, the best source is companies that provide guitar parts.  The knobs for controls on electric guitars come in a wide variety of styles, some of them quite elegant.  (But guitar parts are also a fairly expensive way to get knobs, so make sure that you really like them!)

When I first assembled the lamp, there was a rather nasty flaw in the design, resulting in unintended shadows on the shade:

At first there was an extra shadow in the middle of the shade that I did not like.

At first there was an extra shadow in the middle of the shade that I did not like.

With the shade off, it is easy to see where the extra shadow come from—it is the knurled nut connecting the up-facing LED board to the power wires.

With the shade off, it is easy to see where the extra shadow come from—it is the knurled nut connecting the up-facing LED board to the power wires.

The fix was easy—I just put the screw in from the top of the board, so that there was no large assembly to cast shadows:

Here is a closeup of the top part of the lamp, showing the top LED board facing up with the knurled nut on the back of the board. The two end LED boards face down, again having the knurled nut on the back, along with the heat sink.  I had originally planned to support the shade with the same 10-gauge copper wires that power the boards, but I realized that the cooper would corrode in a humid atmosphere, which might stain the shade, so I made a support out of 1/8" 316L stainless steel welding rod, using a little hot-melt glue to attach pony beads to the ends, so that the rods wouldn't poke holes in the shade.

Here is a closeup of the top part of the lamp, showing the top LED board facing up with the knurled nut on the back of the board. The two end LED boards face down, again having the knurled nut on the back, along with the heat sink.
I had originally planned to support the shade with the same 10-gauge copper wires that power the boards, but I realized that the cooper would corrode in a humid atmosphere, which might stain the shade, so I made a support out of 1/8″ 316L stainless steel welding rod, using a little hot-melt glue to attach pony beads to the ends, so that the rods wouldn’t poke holes in the shade.

The shadows cast by the LEDs with the corrected orientation of the screws is much cleaner than before.

The shadows cast by the LEDs with the corrected orientation of the screws is much cleaner than before.

I still have to write artist-level instructions on how to put together the electronics for a lamp. That will probably require a few more closeups of the lamp (with better lighting), which I’ll take during the week, before shipping the prototype to my sister.

2014 October 15

LED board I-vs-V curve

Filed under: Data acquisition — gasstationwithoutpumps @ 21:27
Tags: , , , , , , ,

I earlier did simple go/no-go testing for a bunch of the LED boards that I designed for lighting fixtures (see Summer project), but I thought it would be interesting to characterize at least one of the boards more thoroughly. So last night I wired up a little circuit to control the current through board to plot an I-vs-V curve:

The transistor is a 1W transistor with a DC current gain of about  120, so this circuit can sink up to about 300mA with Vss=9v.

The transistor is a 1W transistor with a DC current gain of about 120, so this circuit can sink up to about 300mA with Vss=9v (as long as the voltage drop across the LED board keeps the collector voltage down low enough).

I measured the voltage across the board and the current through it with multimeters (using the better multimeter for the current measurement). I was expecting a constant current when the voltage was high enough, then a linear decrease in current as the voltage was lowered down to a cutoff threshold. That is pretty much what I got:

The constant current was set at about 118mA (I had intended 130mA), and the linear region corresponded to 10.6Ω.

The constant current was set at about 118mA (I had intended 130mA), and the linear region corresponded to 10.6Ω. (Click to embiggen)

The constant-current region was not as crisply defined as I had expected, and the current was lower than I had intended.  The 10.6Ω impedance in the linear region initially came as a bit of surprise, but when I added together the resistance of my current sense resistor and the dynamic resistance of the LED in the relevant region it seems about right.

The measurements were hard to make, because the current did not remain constant, but tended to drop as I was measuring, particularly in the high-current regime. I believe that this droop is due to thermal effects—the current drops as the board warms up, and I did not wait for the board to reach equilibrium temperature.  The lower-than-expected  constant current is probably also due to thermal effects, since it was based on scaling up tests done at low currents, where there would have been no significant heating.

To test this hypothesis, I set up a different experiment this morning, connecting the board in series with  a 20Ω resistor and connecting both to a 12V power supply, monitoring the voltage across the resistor (and hence the current through the board) using PteroDAQ on the FRDM KL25Z board.

The initial current was close to the 130mA I had expected, based on scaling up of experiments I had done with a similar circuit that had provided 13mA.  But as teh board warmed up, the current dropped substantially, down to around 116mA.

The initial current was close to the 130mA I had expected, based on scaling up of experiments I had done with a similar circuit that had provided 13mA. But as the board warmed up, the current dropped substantially, down to around 116mA.

So my “constant-current” circuit isn’t really constant current—it is very temperature dependent. The change in brightness is about the same as I would get from a 13° change in the position of the control potentiometer for my dimmer. I can live with that in the design, but it is a much bigger temperature dependence than I had expected.

According to my infrared thermometer, the heatsink got up to about 60°C at the end of the run, with 9.75V across the board and 0.116A through it, for a power dissipation of about 1.13W. If the room was at about 20°C, that means a temperature gain of about 35.4°C/W.

The LEDs get derated to about 93% of their room-temperature efficiency at 60°C, so when combined with the current drop to 116mA, I expect about 75 lumens for each board when it is fully on. Maximum efficiency would be at the knee of the I-vs-V plot, where the voltage is about 6.67V, getting 75 lumens for 0.77W, or 97 lumen/W.  (The temperature may not get as high at that voltage, since the power dissipation is less—the terminal temperature would probably be only about 48°C, which means the current would drop less and efficiency would be slightly higher.)  At my design voltage of 9V, the efficiency is only about 72 lumens/W.  The LED boards seem to be able to run at 12V, where the power dissipation would be 1.4W/board and the efficiency only 54 lumens/W.

One surprise for me in the testing was how low a current would still produce light. I observed dim light down to about 4µA, giving the LED boards a dynamic range of about 32000 in brightness (4.5 decades), while my PWM circuit only has a dynamic range of about 43 (1.6 decades).  The range on the dimmer is adequate, since even a night light produces about 15 lumens, and my dimmer goes down to about 2 lumens. But it is clear that one could design for a much wider dynamic range.

Redoing the I-vs-V plot to have a logarithmic scale for the current, we can see the whole dynamic range.

Like many semiconductor devices and circuits, the boards have an exponential characteristic for subthreshold conduction.

Like many semiconductor devices and circuits, the boards have an exponential characteristic for subthreshold conduction.

The LED boards could be operated at as low as 5V, but the brightness is very low at that voltage (about 0.15 lumens)—not suitable for a room light or even a night light. A 7.4V Li-ion battery pack would be a good match to the LED boards.  A $14, 2200mAh battery should be able to power the LED board at full brightness for about 10 hours, and at reduced brightness for another 8–10 hours. I’m not currently planning any battery-operated lights, but it is nice to know that they are doable.

2014 October 5

Summer project

Filed under: Uncategorized — gasstationwithoutpumps @ 19:06
Tags: , , , ,

I’m finally ready to reveal the project I’ve been working on all summer: a “kit” for making dimmable LED lamps.

The idea of the project is to have a flexible set of electronics modules that can be put together in various ways to get quite different lighting fixtures.  I ended up designing around a 9V power supply, and making two custom modules:

  • a dimmer board that reads a potentiometer and converts it (non-linearly) to a pulse-width-modulated 9V output signal.
  • LED boards that hook up to the two wires of the PWM input signal, and that can be run in parallel.

The key thing here is that the LED boards are designed to have roughly constant brightness despite variations in the LEDs or in the IR voltage drop of the wiring.  Each LED board has a constant current circuit and a little heatsink to keep the LEDs cool (they last longer that way, so I went overboard on the heatsink, keeping the LEDs well below their maximum temperature). The boards are designed to put out about 85 lumens of warm-white light at 130mA (dissipating about 1.17W on the board—with a 90% efficient 9V supply, the overall efficiency is about 65 lumens/W).

So far I’ve wired up two of the dimmer boards and tested them at currents of up to 4.8A—the transistors on the board don’t get hot (not even up to body temperature).  I don’t have a dummy load for testing at higher currents, but the board was designed to be able to handle at least 6A.  I paid extra to have the dimmer boards fabricated with 2oz copper (through ITEADstudio), both to reduce resistance on the board and to provide better heat sinking.  I want to be able to use the board in enclosed cases, and I don’t think that there is will be any trouble with that.

I’ve also tested 36 of the 100 LED boards I had made. Because the LEDs are surface-mount devices with big pads, I paid Elecrow to assemble the boards for me.  Their prices came out a little lower than Smart Prototyping for this particular board, but the difference in pricing schemes could make either one be cheaper for a given design. So far 34/36 work (~95%), which is a somewhat lower yield than I had expected for such a simple design with large-pitch components. I’ve not reworked the bad boards yet, but I did a little testing, and the problem seems to be a damaged transistor rather than an obvious soldering problem such as a short or open. I wonder if they were careless about their anti-static protocols, or whether the transistors were damaged before they installed them.

My original goal was to make an LED lighting fixture to replace the old ceiling fan in my breakfast room (using 10–20 of the LED boards, to get 850–1700 lumens), but I’ve not gotten that one done yet, because I got sidetracked into two other related projects:

  • Making a custom desk lamp for my son.
  • Making a prototype table lamp for my sister.

Originally, my son was going to design his own desk lamp to sit on a shelf above his desk, based on the desks we had seen in the dorms at orientation.  But when he moved into the dorm last weekend, he found that the desks in this dorm had no book shelf over the desk. But he really needs a desk lamp, because he lofted his bed over the desk to make more space, so the desk is quite dark.  I decided that I would make him a desk lamp as quickly as I could, designing it on the train home, and sharing sketches with him by e-mail when I got home.  This weekend I threw the project together as quickly as possible, so that I could ship it to him on Monday.

At the back of his desk is a 1″ thick wooden brace for the lofted bed, so I designed the lamp to hook over that brace, with the control box over the desk and LED lamps about 50cm above the desk on 10-gauge copper wire. The LEDs are light enough that the wire alone is enough to support them, though a thicker wire would be a little less wobbly.

Here is a side view of the desk lamp showing the hook for sliding over the bed rail.  I've only populated 4 of the 5 positions for LED boards.

Here is a side view of the desk lamp showing the hook for sliding over the bed rail. I’ve only populated 4 of the 5 positions for LED boards.

Front view of the desk lamp, as it would appear at the back of his desk.  The knob controls the dimmer, and a 9V wall wart provide power on the right side.

Front view of the desk lamp, as it would appear at the back of his desk. The knob controls the dimmer, and a 9V wall wart provide power on the right side.

Because I had to throw this thing together in a hurry, it has a very “homemade” look to it. The box is a cheap wooden craft box from the art supply store, the hook is a piece of masonite glued to a couple of  pieces of  scrap wood I had in the living room. I did not take the time to trim everything to perfect fit, nor to do more than cursory sanding.  I finished the box with Danish oil, but I only had clear oil, and one with a stain included would have looked better.

But the lamp works well. The vertical wires are attached to screws with knurled thumbnuts, and the LED boards to the wires the same way. These give the lamp a certain “steampunk” charm, though there should really be a big knurled brass knob instead of a plastic one to enhance that effect.

Next weekend I plan to try to finish a table lamp for my sister—it needs to look a bit nicer, since she is considering making a series of table lamps using stiffened-silk shades (she makes stiffened-silk bowls, and her customers have been telling her that she needs to make lamps).  I want her to see the artistic possibilities, and she isn’t into the rustic “homemade” look.  I’ll also have to provide her with instructions on how to put together the electronics for a lamp with artist-level instructions. I’ll have put the lamp together, but she’ll need to be able to figure out how to put the same electronics into a different base with different support for a shade. That means not just building the lamp, but explaining how it was built and why certain choices were made, so that she can do her own designs.

I’ll probably detail some of that build in a blog post here, so that I have a record as well as her.

« Previous Page

%d bloggers like this: