Maglite Joule thief

Joule thief circuit

The Joule thief is a really fascinating circuit, simple yet very intricate. Basically, it’s a step-up converted in its most elementary expression. I will spare you the theory since there is plenty of information on it on the web; rustybolt.info is a good place to start.

Joule thieves in all sorts of forms have been featured countless time on DIY websites and I felt it was time I build one. However, I did not want to leave the circuit at the breadboard stage because as it stands, the joule thief has characteristics that make it very attractive for all sorts of low power applications and I figured a flash light would be a very good home for a joule thief, where having the option of using dead batteries is certainly a big plus not to mention using less cells because the circuit steps the voltage up. Why dead batteries? Because a battery is never really dead, its voltage just falls down logarithmically until it hits a point where the device it was powering up stops functioning, which does not mean the battery is totally drained but rather that its voltage has fallen below a usable level. Since joule thieves are step-up converters, they can take that “dead” battery, and give it a new life by stepping up its output voltage to usable levels again.

The build

A 2 AA batteries Maglite

For my flashlight, I opted for a maglite body for its sturdiness and simplicity. I have been using those for years and they have served me well, but with traditional incandescent lamp bulbs (I do know they make LED versions now), they eat through batteries like crazy. So the challenge was to convert a 2 AA battery maglite so it could run off a joule thief circuit and a single AA but could easily get converted back to using a lamps(As I will tell later, the joule thief’s light output is not so strong … sufficient in most cases but not strong).

As I would be using one less battery, the trick was to use that space to hold the circuitry. I proceeded to cut a perfboard the size of an AA and soldered all the components on it with the heads from two nails as connectors. Inductors being already pretty hard to come around, one tailored to this application would be next to impossible to find so I had to hand wind one using 20 or so turns of 40 awg enameled wire (almost hair thin (also hard to find, look for it on ebay)) around a ferrite core to build the joule thief’s coil. Once everything was in place, I soldered the circuit ground wire, which when making contact with the flashlight’s body, would turn it on or off. That wire had to be routed inside the plastic insert that normally holds the lamp and its metal pad in place so that when you turn the head of the maglite, it screws up and presses the pad against the body, thus closing the circuit. In order to allow the maglite to be converted back to using a lamp, I just cut a notch under that pad so that pressure on it would contact the wire and ground it.

For protection and isolation, the circuit was wrapped it with acrylic tubing (some leftovers from the time my computer was watercooled) and inserted in the body. Finally, I installed the LED at the top, with its two pins bent to fit in the holes normally meant for the incandescent bulb. The lens fits perfectly on it; the only way to tell it’s a modified maglite is to look at the bulb.

The circuit being constructed.
The circuit being constructed.
Testing the circuit.
Testing the circuit.
Oscilloscope trace of a correctly working joule thief.
A correctly working joule thief.
The finished circuit in its protectective acrylic tubing.
The finished circuit in its protectective acrylic tubing.
The finished product.
It works!

Results

I will right away admit that I am a bit dissapointed with the light output of the circuit. Though I did expect it to be a whole lot less than the incandescent bulb, it is barely usable. The culprit is certainly the LED. At only 3mm, it can only do so much with that waveform going through it ; it’s rated for 20mA and its getting 12 so the circuit is doing a correct job keeping in mind that joule thieves are quite inefficient ( in the order of 30-40% judging by the duty cycle). Using a larger inductance is out of question because it reduces the frequency without modifying the waveform but using a larger wire gauge (thus lowering the resistance of the coil, see below) would probably help. What also does appear to make a difference is the type of transistor used, I noticed that the current draw of the LED was only 9mA with a 2N3904 while it jumped to 12 with a PN2222A. Both are general purpose NPN so maybe another type of transitor would do better. As a side note, the circuit will not work with FETs, I have found plans to build a joule thief with those but its much more complicated.

With a single battery at 1.435V, I got two days of continuous lighting, not bad. At that voltage, the current draw is about 65mA. I was not able to measure the pull of the standard incadescent bulb for comparison because the inline resistance of my multimeter was too consequent, but one interesting thing I noticed was that below a certain voltage, the light would start to flicker at hertz or so. Its hard to see in the picture, but I added an electrolytic capacitor for bypass; it could have something to do with that.

Even though I said that the light output was nothing to brag about, I did take the flashlights to many trips in the woods,  with some lasting a few days and it has held up perfectly. With your eyesight accustomed to the dark a bit, you can see at a few meters  and whatever task your hands are doing is lit well enough for comfort. With all this serious usage, I have not yet ran out that dead battery. Too bad, I wish I could have gone out asking my hiking buddies for dead batteries.

With LED flashlights being quite effective, I can’t vouch for the potential of this circuit for such applications. Certainly, using dead batteries is a plus as they are relatively easy to come by, but the low light output would certainly be a killer for most of us because when it comes to photons during a moonless night in the woods, more is just better.

Still a very fun build…

On rustybolt.info’s post about my joule thief

According to rustybolt (thanks), my coil is mainly to blame for my poor performing Joule thief. The wire used is too thin and has a consequence opposes too great of a resistance ( I should have tought about that) to the current, thereby limiting the LED’s brightness. There is a very clear article on Joule Thief coil selection on his site.   He also points to the transistor being responsible for the loss of efficiency. Next time I get my hand on that maglite (I’m travelling right now so it’s an ocean apart from me), I’ll revisit the circuit.

Partitioning an Ipod to FAT32 and ext3

I recently inherited my sister’s “defective” (but fixed for 5$) 120GB Classic Ipod and managed to partition it the way I wanted. It was not a trivial process so I tought I’d share my experience with the web so others can benefit from it.

My music library is far from being 120GB so even if I feed the Ipod all my tunes, I’d still have a lot of free space on it. Granted, you can mount the Ipod as a mass storage device and stuff the rest with anything, but here’s the catch: Ipods will only format to FAT32 or HFS+ file systems if you use iTunes. As a consequence, if you pick HFS+, you will not be able to use them on windows and some *nix (if they lack the HFS+ support module) and if you choose FAT32, backup solutions such as backtintime will not work (they need a journaling file system).

So I took to partitioning my Ipod with two different partition using a different file system for each, FAT32 and EXT3. I tough it would be a simple task, but turns out that it wasn’t. Just formatting the Ipod and letting gtkpod rebuild it did not cut it; the device would stutter, only play the first few seconds of each track and give off artifacts while displaying the CD covers. And when plugged in iTunes, the software would report the device as corrupted and offer me to reset it. I thought that gtkpod must be missing on something so I should use iTunes instead yo rebuild it, but iTunes would still ask me to reset my iPod. Here is what worked after a fair amount of tinkering:

  1. Reset the iPod with iTunes (on a different computer since this tutorial assumes you are using a *nix).
  2. Plug it on Linux and run the following command on the user partition. My Ipod is a 6th generation classic, there is no partition for the firmware, it sits somewhere on the MCU flash, but it appears that older Ipod use a firmware partition so leave it alone. Paying attention to that particularity, here is the commands you need to run:
    1. Unmount the plugged int Ipod with umount  /dev/sdXY Where X is the device letter of your Ipod and Y is the partition number.
    2. dd if=/dev/sdXY of=ipod.bk bs=512M Where X is the user partition of you Ipod and Y is the partition number. This will effectively copy 512MB of raw bytes from you Ipod partition and save it to the ipod.bk file.
  3. Next, take your Ipod and format it the way you want using fdisk. If you have a firmware partition, do not destroy it! Keep the following points in mind:
    1. Use a Master Boot Record (MBR)
    2. All partitions should be primary
  4. Finally: dd of=/dev/sdXY if=ipod.bk bs=512M Where X is the user partition of you Ipod and Y is the partition number. This is going to copy back that 512MB file we extracted earlier from the Ipod, setting that partition the way it was before the repartitioning.

Voilà! Plug your Ipod in, upload music with you favorite app and do backups with your file system of choice. Mine is happily working with that setup: Ipod stuff on FAT32 and backintime on EXT3.

The quirk I got with this technique was that both iTunes and the Ipod report the full size of the internal hard drive as being available for music while in reality its not; it looks like the firmware keeps a record of the empty space withing the files of the user partition (why it is not computing it is anyone’s guess). You should probably be careful not to fill it up to a point where the two partitions would overlap (although that should not happen if the firmware is paying attention but then again, not tested).

Enjoy!

Climate change (again)

Posted here: http://climaterealityproject.org/2011/08/26/what-climate-change-deniers-and-carbon-dioxide-have-in-common


Friends!

I think we let ourselves carried over by the first’s commenters’s misconception about CO2. The debate (if there is to be one) should be about the post and in there, it’s indicated verbatim that CO2 isn’t toxic to humans and that it’s the greenhouse effect that is potentially harmful for the earth as a closed system.

Climate change is in my opinion part of a bigger issue: one of resource management. The earth can certainly afford a bit fossil fuel burning and resource usage as anyway, it will one day be engulfed by the heat of the sun as it expands towards its red giant state.

However, the alarming rate at which we are conducting those activities will very likely make us fall prey to Malthus’ law (population grows until ressources are all consummed, famine occurs and then population resorbs massively) very soon instead of us as a species living to see ourselves getting cooked by our star.
Technology (not policy) has certainly helped us averting that for while, but it won’t last forever if we keep consuming and growing like we are right now. As Carol Pullitzer clumsily suggested, it is not cars and industries that pollute and use resources, it’s humans; feel free to have you own conclusions about that, hers (birth control) is perfectly sound even if it is nowadays synonym with totalitarian policy.

And that is all simply because the earth is a closed system, and that  you cannot have infinite physical growth (economy of growth, yay!) inside a closed system. The earth is a balancing act, and we shall see return of pendulum sooner than expected if we keep going down that route.

A milestone

Too bad I work alone and mostly at nighttime. Otherwise, I would have some people around to share the sheer joy that I am experiencing right now. For a lack of that, I’ll turn to the web. Just an hour ago, I completed a major milestone in my main project line. I am ecstatic as with work of this magnitude, the light at the end of the tunnel is always months away( and right after, you get into another tunnel…) Here is the writeup on the situation.

I have had a fascination with oscilloscopes for a very long time. While being incredibly useful (for those who are into electronics that is), they have a mysterious sense to them that still gets me after all those years of hanging out with complicated machinery. I remember clearly seeing rows and rows of them during my first university year, having only a very rough idea of what they were for but still knowing, judging by their numbers, that they must be very useful for every electronics bench to get its own. They are what epitomizes the knobs and dials (screen in this case) strange and obscure apparatus of the modern age.

So much so that I decided to program one from scratch for my final engineering project; I had very ambitious plans for it. The electronics would be managed by a Microchip PIC18F4550 – a USB microcontroller – and the application on the host PC would be programmed in C#. Its killer feature would be that its display would be 3D, giving the user one more dimension for visualizing, combining and probing waveforms. Turned out implementing the USB stack was a major bitch (should have used Microchip’s ready-made one…) so I decided to get signals through the sound card input. No big deal, the main application was agnostic as to where its data came from. Then, the 3D part was a huge headache too (80% of the code, a primitive but complete 3D engine), but I got trough it and in the end it worked well enough for a public showing. I will post all its code and some screen shots when I find the motivation too, but for reasons that will be developed upon at this time, I decided no to further its development. Simply put, I had discovered the world of Open Source and realized that platform-locking my project (DirectX, .NET) was not inline with my philosophy of getting good electronic tools in the hand of the masses.

This new one is implemented on an OS of mine (Elements, but beware, the post is very outdated) and thus completely web oriented and RESTful. The user interface is described in XHTML, SVG and JavaScript with all of it getting served along with the oscilloscope function by an ATMega328p with 32kB of static EEPROM storage. That’s a web server, TCP/IP stack, a file system and oscilloscope running on 32kB of Flash, 32kB of EEPROM and 2kB of RAM embarked on a 16 MHz chip! It had been a web server for quite a while, but tonight, I got it to behave like a usable oscilloscope. I am a happy man…

The paradox of management

It recently occurred to me that the job of a manager (so often praised in our knowledge economy) is essentially a paradox, as its ultimate objective is to make itself obsolete.

A manager is essentially a problem solver. While the nature of the problems is certainly very vague, it goes from implementing a measure pushed down from higher up in the organization to dealing with a sick employee, but essentially, it all falls under the umbrella of problem solving because managers only have a very indirect responsibility on the product or service delivered by their organization.

It follows as a logical conclusion that a well managed entity will not have any problems, but that would be no permanent achievement to the manager as he knows very well that issues will soon reappear in the changing environment he works in. Incidentally, the best manager will not only have made his organization problem free, but will have implemented the mechanisms to solve them without any sort of oversight or implication on his part, since such are the characteristics of ideal processes. At this point, he will have fulfilled his role has a manager, he will be laid off or moved elsewhere, and the group of people he once led will continue to thrive and adapt without him.

Utopia aside, it feels to me like the most efficient, elegant and adaptable systems on this world always have an organic feel to them or are even naturally organic. Look at the web, look at social media, look at cities, look at society but most importantly, look at life around you.

There will always be a need for oversight and stewardship in the future, natural selection is too cruel for blunt application on human organizations, but I foresee that the current role of manager will redefine itself to that of an enabler, where the crux of the job is no longer to direct, but rather to create the conditions or more precisely, the ecosystem where an ideal can bloom, exist and subsist.

I ought to give credit to Matthew Crawford’s inspiring book, Shopclass as Soulcraft for an hint on this idea. In fact, it would not surprise me if he had thought of it before I did.