Most of the applications for LEDs I’ve run into require a lower than supply bias voltage for the LEDs. This situation is fairly easy to deal with, you can use a current limiting resistor, a linear regulator, or in high power applications, a step-down or buck converter.

However, occasionally, it may be beneficial to have a rather high LED bias voltage, even with a low supply voltage. For example, in small battery powered applications, rather than run your LEDs in largely parallel configurations (which has many drawbacks), you can string the LEDs together in a large series string, and then parallel those strings if need be.

Enter the TPS61040 from Texas Instruments. The TPS61040 is an integerated high efficiency step-up or boost converter. It is a integerated converter rather than a controller, because it contains both the power switch and the feedback circuitry. This means a very simple design is all that’s required to make it work – and in my opinion, the smaller the part count, the better.

tps61040 step-up boost converter smps led driver

There is my schematic, which provides for a variable voltage constant current “LED Driver”. LED current is programmed by resistors R1 and R2, which are connected in parallel. Inductor L1 is a small 10uH inductor, and D1 is a ‘standard’ schottky diode. C1 and C2 are low ESR ceramic capacitors, with an X7R rated dielectric. The chip itself, IC1 is an amazingly small SOT23-5 package surface mount IC. The rest of the components are also surface mount, both for space savings and laziness, as I hate drilling holes. I was out of SMT schottky diodes at the time I drew this, so D1 is a 2.8mm by 7mm DO41-7 package. C1 can be a 10 or 16 volt cap, C2 should be rated at the output voltage plus a safety factor (for dealing with ripple). L1 should be sized to handle the current demands of the circuit – I just went with 1.6 amps since it was cheap.

tps61040 pcb layout artwork

The layout is about 20mm square. My intended application is for lights inside a “shadowbox” style picture frame. I want a small string of white LEDs powered by some cheap AA batteries. I’m out of PCB developer right now, so no PCB fab this weekend. Once I get some more in, I’ll share the finished product with everyone, as well as some pictures of my cheezy art project.

If anyone should want full resolution layout or pcb artwork, just hit the contact justdiy button, over in the right hand sidebar.

Touch Sensing Building Blocks I

The “core” building-block I mentioned in my last post is nearing completion, at least, the software.

I have my microcontroller handling “switch emulation” tasks. It can emulate either group of momentary switches or a group of toggle switches. Response time is real good in a dimly lit room, and it works decently well even with the overhead fluorescents turned on.

Right now I’m working on a basic keypad PCB I can throw together, for a ‘proof of concept’ prototype. The first keypads will likely only support 6 keys, and I’ll build from there. Six keys requires twelve LEDs, six of them need direct and discrete anode and cathode connection to the microcontroller. The other six LEDs are providing bias light for the sensors to “see”.

I should have a video up tomorrow of the breadboard in action, and hopefully some pcb’s by next weekend.

Shameless self promotion

Sorry if I interrupted anyone’s reading … don’t you like my shoot from the hip method of working on live site code, instead of some backup / test site?

I have added a link to the end of each posting, allowing readers to easily bookmark posts they would like to share with the community.

LEDs As Sensors: Revisted

Thanks to the folks at Make: and Hack A Day, my research into the area of using LEDs as sensors has been receiving a lot of attention. With this attention comes questions. I like receiving questions. Only thing I don’t like about answering questions in the e-mail is the knowledge is locked up. Sure I could repost the e-mails, but it is sometimes difficult to follow the context after the thought train has left the station. With my rekindled interest, I wanted to take a short moment and summarize a few things.

These are just my opinions – and I welcome debate and feedback on them – I especially welcome anyone to be challenged by them enough to prove me wrong. LEDs as Sensors offer at least two avenues of usefulness; communications and interface. I haven’t dipped even a toe into the communications side of the pool – all my work has been on interface.

These are the applications I feel LED Sensors are a poor fit to replace:
#1 – The touchpad on your notebook. Seriously, no one but a geek would enjoy having 128 or more bright LEDs glowing continuously to replace the little capacitive discharge pad that is used 95% of the time today.

#2 – The keys on your keyboard. LED sensors are pretty slow, even a modest typist would be hindered by the response time.

#3 – Any application that needs to work outdoors. LEDs and the Sun do not get along.

These are the application I feel LED Sensors may work well in:
#1 – Keypads and interactive displays used for Art and Music. These applications fit the ostentatious nature of the interface, where the controls are as much a work of art as a functional device.

Yep, that is it… that is the only application I think LED Sensors offer any strength in.
Here is an example – Musician / DJ sound effects tablet:

Imagine a thin tablet like device, glowing brightly with powerful LEDs in an otherwise darkened club / dance hall / etc. The tablet accepts an ordinary 8×11 sheet of transparency film. Printed on the film are the names of pre-programmed effects / samples /whatever. Under the film, evenly spaced trios of LEDs are used to detect the presence of a reflective object. The tablet connects into the rest of your system using regular MIDI or whatever other interface one can think of. This tablet is no different than boxes hobbyists and musicians have been building or buying for years, except, the mechanical switches have been replaced with eye catching LEDs.

Here are a few other questions that have been raised:

Q: Do I have to use red LEDs?
A: No, technically any LED color works. Red is the cheapest and that is what I use. Along with yellow, red is almost the most sensitive.

Q: I tried IR LEDs and they seem very sensitive, why not use those?
A: The point of using LEDs as Sensors is to have an ostentatious interface. It’s not going to be very showy if the light is invisible. If you want to use infrared LEDs, use one emitter and one photodiode / phototransistor – it is a LOT easier.

Q: Does this work with organic / flexible LED displays?
A: I have no idea. Those displays are largely theoretical and prototypical in nature – maybe in five years when I can buy one for a few dollars, I’ll experiment with it. The organic compounds used to manufacturer these displays also have big problems with humidity and overall short lifespan – neither are very positive traits.

Q: Can you send me your ASM code for such and such?
A: No, no I can’t. I do not have any ASM code – I do not know how to program in assembler. I have code written in Proton Basic, which I will happily share.

Q: I want to get started with microcontrollers?!
A: Excellent – I’m not going to help you. There is a huge learning curve involved – a lot of it can be skipped by spending money (on proton basic). Check out and for good microcontroller stuff. Check out for tons of info on learning microcontrollers.

Q: What microcontroller do you recommend?
A: I like the new PIC16F690 family from Microchip. It is a small inexpensive package that offers many features only found on larger processors (like dedicated i2c hardware). It also sports at least 10 ADC ports.


In closing, I would also like to share some basic info on what I’m working on at the moment. My current project is to get a stand alone system worked out for emulating mechanical switches. I consider this a valuable “core” building block behind the technology. I have momentary switches partly working, after that, a toggle switch shouldn’t be much harder. As a future goal, I would like to get “cores” built to emulate sliders and knobs. Those three elements should cover a great deal of the artistic / musical needs that I feel this technology is well suited for.

Thank you for visiting and I welcome your comments. My gmail is gordonthree – feel free to contact me about anything.

Water Filter Controller

The old adage “measure twice, cut once” has a realitve in the field of electronics engineering; “measure twice, design once” … ok, well maybe that’s a bit corny but anyway.

Turns out the controller I designed for my water filter is pretty much useles. My filter’s pump is not the 12vdc that I imagined it to be, instead, it is 24vac. So the two smt mosfets which I soldered to my pcb with generous amounts of solder, are not capable of switching AC. Worse, I had planned to power the controller itself off the psu for the pump, so the 7805 vreg I’m using will not appericate AC on its input terminals either.

I plan to salvage this situation however… using relays, either mechanical or electronic, as well as a separate power supply. So, I will use a ~12 volt unregulated supply to power a pair of mechanical relays, one for the pump, one for the valve, which in turn will be switched by the mosfets. Or, I can desolder / destroy / jumper over the mosfets, and run a +5v control signal to my outputs, for control of a solid state relay.

I need to price out the cost of mechanical vs solid state …. probably solid state will win, I think I can build a triac based ssr for under $2.

Temporary Lights

Another of my hobbies is keeping freshwater tropical fish. Ever since moving into my new house, and building my electronics lab upstairs, I haven’t been too interested in the fish. I give them more water when they need it, feed them on occassion, and do minimal basic maintainence.

The 55 gallon tank has gotten quite out of hand. A single variety of cryptocorne had gone on a killing spree, and had consumed the entire floor of the tank, wiping out every other plant that was in there. After it had consumed all there was to consume, fate turned the tides, and algae began to consume the crypts. So, with much disgust, I threw away all the crypts (mostly all covered with algae)… along with them went most of my substrate, entangled in the massively thick root balls of the crypts. So now my 55g sits empty – except for the fish, some huge snails, and the ugly life support equipment.

The tank normally has 108 watts of T5HO lighting (excessive for fw) , however, without any vegatative competition, algae would quickly rule the roost had I maintained normal lighting. So, I thought this would be a good application for LED lighting. The weak, sickly glow from “white” piranha leds will give me enough light to see my fish, and keep them accustomed to a day/night cycle, but not enough for algae to survive on.

piranha superflux LED strip

My solution involves 24 white piranha leds, with a color temp somewhere around 5000 kelvin. The 24 leds are broke up into four strips of six, those four strips wired in parallel across the power supply. The power supply is a LM317T wired up as a constant current regulator.

piranha superflux LED strip

The strips are designed with basic thermal management in mind. Since I am running the piranha at nearly 150mW, they generate a fair amount of heat. Therefore, I designed the strips with a maximum amount of copper possible, to act as heatsink and radiator.

pcb artwork superflux LED strip

All together, the ‘fixture’ consumes a little over 4 watts of energy. Here is the basic schematic of how things are wired up. This design is not very ‘safe’ … should an led strip fail as an open, the regulator will provide too much current to the remaining strips. The addition of a transistor and resistor to each strip would help combat this problem, by switching the current programming resistor in and out of the circuit… but this would require me to re-draw everything, make new PCBs, etc etc. This solution only needs to last a few months, once warmer weather arrives, I’ll be mail ordering some plants and have the tank restocked and the main lights working again.

superflux LED schematic diagram

Organization Overload

The sidebar has been on quite a growing streak lately – first a bunch of new statistic driven links, and now many many new categories.

Since my post count is getting pretty big, I decided now would be a good time to organize it, rather than wait for it to get even larger. So I have gone back through every post, and further classified them into different categories.

It should make it easier to find things now, instead of it being all lumped under “Project”.

New Stats Tracking

I have added some new plugins for wordpress that lets me get a better idea of which posts are popular and which have never been read at all.

Readers, you will notice on the sidebar, there is now a “Most Popular” section. It will list out the overall most popular when viewing the main page or viewing individual posts / pages. If you go into the monthly or category archives, it will list out the most popular posts for that month or category.

Each post also has a popularity readout at the end of the post… this is probably going away, once I find where that little bit of code was added.

I have also added a plugin that lets me track referrers, links, enter pages, exit pages, etc. I don’t think the readers can see any of the stats it produces. I may make a stats page for everyone once I get to understand these plugins a bit better.

For post popularity I am using Alex King’s Popularity Contest
For the general http stats I am using Anders Holte Nielsen’s Counterize