20 Band Audio Spectrum Analyzer
October 2nd, 2010

LM317 constant current source

Recently a friend of mine asked my help about replacing some 12V light bulbs with LED’s for longer battery life. After doing some searches the cheapest solution was to use a bunch of 5 mm white LED’s powered from a constant current source. A constant current source is not cheap to buy and since were in the spirit of making why not make that also. But where to start ? there are voltage regulators that you can turn into constant current sources, dc-dc converters that you can turn into constant current sources or you can choose a specialized circuit designed exactly for powering LED’s. Obviously the first option is the cheapest and simplest to implement but it comes with its drawbacks.

Anyway, I had everything needed on hand so I proceeded and designed a PCB in Eagle. I used two LM317 voltage regulators because I want to power two sets of LED’s. Each set of LED’s is composed of 28 LED’s tied in parallel. I’m gonna set the current on each LED to 20 mA so that is 560mA for each set of LED’s. I wanted to spread all that load on two LM317 so I used two.

28 x 5mm white LEDs wired in parallel Dual LM317 constant current source schematic

The PCB were easy to route and ended up like this:

28 x white LEDs in parallel PCBDual LM317 constant current source PCB

Kind of small and nice looking. The LED pack could of been smaller but since LED’s don’t spread light on a wide angle I decided to spread the LED’s a bit to spread the light. The LM317 board was designed so that it would fit perfectly under a heatsink I had around. Actually the heatsink is from an old video card I had in my junk box; its nice to reuse these things, its like recycling.

old video card ripped out of heatsink

I proceeded and used my DIY photo etching method but something went wrong and I messed up all of the PCB’s, they ended up looking like this:

messed up PCB

The thing is I stopped using ferric chloride a while ago. Instead I turned to ammonium persulfate which comes as a white powder that you need to dissolve in watter. The watter stays clear, it doesn’t smell and it doesn’t stain (not checked yet). It only catches a blueish color after you’ve used it and copper accumulates in it. The only disadvantage for using ammonium persulfate is that it etches slower than ferric chloride, other than that is great. The problem with mine is that it was mixed with water more than 6 months ago and it turns out it doesn’t last that long when mixed with water, so keep it as powder and only mix it when you need it. Unfortunately I couldn’t get more of it locally so I had to return to the good old ferric chloride. I did all the process again and the boards came out great this time.

The assembled LED packs look like this:

Assembled 28 led packsAssembled 28 led packs back

and the assembled LM317 board look like this:

dual LM317 constant current source assembleddual LM317 constant current source assembled

Notice how I designed the board to fit just over the raised part of the heatsink? its the little things that count :-) (and I’m not referring to the heatsink as you will read next). The LM317 pair was mounted on the back so that it sits firmly attached to the heatsink transferring all that heat.

here’s a photo between the heatsink and the pcb:

LM317 constant current source - between heatsink and pcbLM317 constant current source - between heatsink and pcb

I was pretty happy with the overall result until I actually run it. The heatsink got very hot pretty fast and it was clear it was not dissipating enough heat. With 12 V in, LED Vf of 3.4V , 560mA and an ambient temperature of 28 degrees C, the heatsink reached almost 80 degrees C. It turns out The LM317 is not very efficient in this setup and together with the sense resistor has to dissipate allot of heat. And a simple calculation would of shown this from the beginning if I paid attention to it.  (Vin-Vf.Led-Vadj)xIo => (12V-3.4V-1.25V)x0.56A= 4.116 W for each regulator, double that and the heatsink is just too small to dissipate that kind of heat. Not to mention the poor efficiency of the circuit. Its the little things that count , I would of done that calculation earlier I wouldn’t of made that circuit just to realize that is not good for my setup.

At this point I knew this option is not good and I had to find something else to power the LED’s. I could use a specialized circuit like the LM3406 which would give me the best efficiency but I would have to wait for delivery and get some more parts, or I could use a dc-dc converter modified as constant current source which would give me decent efficiency and I could build it with parts that I already have. I decided to go with the dc-dc converter modified as constant current source. I already have the TPS54232 from another project of mine; the TPS54232 is a 2A, 28V, 1MHz, step down SWIFT™ dc-dc converter. Now its time to design a new PCB for the new power source but more about this in the next article.

Downloads:

September 17th, 2010

ATmega168 external interrupts

atmega168 external interrupts

Daniel Garcia from Protostack, the guy who sent us an ATmega8 dev board a while ago for review, wrote a tutorial on how to use the atmega168 external interrupts. The tutorial is quite nice and you should know the way around external interrupts at the end of it. The general principles apply to other AVR microcontrollers, but the specific vary greatly. Remember that we also have a tutorial about I/O handling on their dev board.

ATmega168 external interrupts: [Link]

inside of a SONY brushless dc motor

Inside of a SONY brushless dc motor

For an upcoming project I’ll be needing a brushless dc motor controller so I had to choose between purchasing one (more than 4 actually) and adapt my system around those or design&build one that would best fit my system. Obviously I went with the second option for 2 reasons : I like making stuff & it’s cheaper to make than to buy. After I finish it , this project will be open-source and I hope people will contribute by making it better.

Brushless DC motors (BLDC motors, also known as electronically commutated motors) are electric motors powered by DC electricity that have electronic commutation systems. Usually the electronic commutation system is external and this is our case also. A BLDC motor is constructed with a permanent magnet rotor and wire wound stator; This type of construction offers many advantages including more efficiency and torque per weight, reduced noise, reliability, longer lifetime (no brush erosion), elimination of ionizing sparks from the commutator, more power, and overall reduction of electromagnetic interference (EMI).

There are 2 main methods for controlling a BLDC motor one is with the use of hall sensors for sensing the position of the rotor and the other one also called sensorless driving involves sensing the rotor position by measuring the back EMF (electromotive force) feedback from the motor instead of external sensors. I’m gonna focus my project on the sensorless method, the advantage being the ability to use any motor no matter if it has the sensors fitted or not.

I’m gonna post updates as I make progress on the project, but first here is the documentation that I’ve read so far:

  • wikipedia on BLDC motors
  • Microchip AN857 – Brushless DC Motor Control Made Easy
  • Atmel AVR444 – Sensorless control of 3-phase brushless DC motors
  • Atmel AVR443 – Sensor-based control of three phase brushless DC motor (although I’m going to use sensorless control its good to know the difference between the two methods)
  • Atmel AVR194 – Brushless DC motor Control using ATmega32M1

These documents cover the basics and the actual control of BLDC motors so I suggest you start by reading these.

The Youritronics electronics lab has a new look: 2 new benches and shelves all of them hand-built. When space is an issue you really have to make the most out of it. One thing is sure, I need more Ikea plastic boxes. On the first bench I do most of the electronics stuff while on the second one I do all the other stuff like assembling - disassembling or breaking stuff. Also on the second bench you can see my DIY reflow oven.

youritronics electronics bench 2

BlueRover

The past few months I’ve been working on the project for the Digilent Design Contest so I was quite busy. Together with my colleague Dragos I worked allot on this project but the results were great, our project the BlueRover won the 1st place so I say it was well worth it. First of all Digilent provided most of the parts needed for the project like :

  • 1 x Cerebot 32MX4 dev board
  • 4 x dc motors
  • 4 x HB5 motor drivers
  • wheels, metal pieces to put everything together

Besides these we also used:

  • 1 x LiPo 2S battery
  • 1 x 5V dc to dc converter
  • 1 x 6v dc to dc converter
  • 1 x BTM222 bluetooth module
  • 1 x MQ6 LPG gas sensor
  • 1 x MQ7 CO sensor
  • 1 x TMP275 digital temperature sensor
  • 1 x MMA7455 digital 3 axis accelerometer

The idea of a remote controlled rover excites almost every electronics student and when we heard about the Digilent contest we realized that we have the possibility to make such a project real. We decided to build our own remote controlled rover but it had to be different from what we’ve seen before. We came up with the idea that we could control the rover by using accelerometer data and that we could use a second accelerometer placed on the rover to sense the driving surface.

I handled the Rover with the sensors and my colleague took care of the control unit which is a Nokia E55 smartphone running a custom application in Python. The principle is simple the control unit sends acceleration data to the rover every 100ms thus controlling the movement of the rover. The rover reads data from the on-board sensors (CO, LPG, Temperature, Accelerometer, and Battery) and sends it to the control unit every 100ms. The control unit receives sensor data from the rover and reacts according to the rover accelerometer by vibrating on each bump sensed by the accelerometer. At the same time the control unit displays sensor data on screen.

I’m not going to go into details about the source code or the specs of all the boards we used in this project but you can find those in our report which I’m linking at the end of this article. I would like to add that Digilent RO did a great job in organizing this contest, it was a really great experience to be there and I’m sure we’ll be there next year too.

You can watch photos from the contest here: http://picasaweb.google.com/digilen.ro

Now I’ll leave you with a demo of our project captured right at the contest presentation:

You need to a flashplayer enabled browser to view this YouTube video

Downloads:

This article will be followed up by one dedicated to the BTM180 and BTM222 bluetooth modules from Rayson. Due to the lack of documentation on this module it was really difficult to get them working and I would like to share my experience for those who are facing the same issues.



© 2007-2011 YourITronics | Any logo, trademark and project represented here are property of their respective owners | Wordpress | Privacy Policy    RSS