Connecting High Power LED to Arduino

Arduino digital can only drive a few milliamps and up to 5V only. You can’t use it to drive a high power LED directly. If you want to drive a high power LED using Arduino, you need to use a driver.   There are 2 options, 1 is to use a transistor driver or use an IC driver. A transistor driver is the easiest option, it will only require 3 components(2 resistors and 1 transistor). The transistor is either a MOSFET or a BJT.

Figure 1 – Driving LED using BJT

In the example above, we are using a NPN transistor for driving a LED. R1 is used to limit the current coming out of the Arduino. Without R1, Arduino digital pin might got damaged due to high current sinking from the output pin. The output voltage of the Arduino will be limited to the Vbe(base-emitter voltage) of Q1 without R1. While R2 limits the current for the LED.

R2 = (VDD – VLED – VCEsat)/ILED
where:
VLED – voltage of the LED
VCEsat – saturation voltage of the Q1 at ILED current
ILED – current of the LED at VLED
VDD – supply voltage(in this example: 5V)

  • Note: You do not need R2 if VLED is equal to VCC. For example if voltage of the LED is 12V and your supply is also 12V, R2 will be useless.

Minimum value of R1:

R1 = (Vout – Vbe)/Iin
where:
Vin – output voltage of Arduino (usually 5V or 3.3V)
Vbe – base-emitter voltage of Q1(usually around 0.5 – 0.7V)
Iin – Max output current of Arduino ( ~10-20mA)

Max value of R1:
this is a little tricky so let’s derive the equation, shall we?

IC = Ib * β
replace Ib with equation from the circuit:
IC = ((Vin – Vbe)/R1) * β
IC = ILED
ILED = ((Vin – Vbe)/R1) * β
ILED/β = (Vin – Vbe)/R1
R1/β = (Vin – Vbe)/ILED

R1 = ((Vin – Vbe) * β)/ILED

where:
β – transister beta or HFE
ILED – LED current
Vbe – base-emitter voltage of the transistor
Vin – output voltage of arduino
IC – Collector current of the transistor

If you have computed lower maximum resistance than the minimum resistance then you should consider changing your transistor with higher HFE. You may consider using  a darlington transistor or a MOSFET.



LED Driver IC

LED driver IC is a bit expensive but it has some advantage. It can supply a constant current which leads to more constant brightness especially if you are using multiple LED’s at a time. It also has some sort of overload protection. It is also more efficient and very ideal for battery powered applications which will have longer battery life. It is not usually simple because it is usually using switching power supply topology.

 

Figure 2 – LED driver IC

Dimming LED with Arduino

Dimming is done by using PWM or Pulse Width Modulation. PWM works by rapid turning on and off of the output. The brightness of the LED is controlled by controlling the ratio of the on versus the off state. PWM is easily done with Arduino, thanks to its very simple library.

Sample code:

int ledPin = 9; // LED connected to digital pin 9
int analogPin = 3; // potentiometer connected to analog pin 3
int val = 0; // variable to store the read value

void setup() {
    pinMode(ledPin, OUTPUT); // sets the pin as output
}

void loop() {
val = analogRead(analogPin); // read the input pin
     analogWrite(ledPin, val / 4); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
}

 

Note: analogWrite command only works on PWM pins. 

 

-tataylino.com

Digital Audio Mixer Project with ADAU1701

It has been my long desire to design a digital audio mixer but there a too little resources regarding digital signal processing. While researching I stumble upon this little chip from analog which don’t require DSP knowledge. It is program using a software called sigma studio. There is no programming language, you just need to drag and drop modules. I am still on learning process, and this is just a test of what can I able to pack on a cheap ADAU1701 DSP. Considering the price of this DSP and the size of its memory, these modules that I was able to put was amazing.

What I was able to get with the limitation of ADAU1701:

  • 8 input channels
    • all have 3 parametric equalizer
    • all have compressor
    • all have volume control
    • all have 1 pre aux
    • all have 1 post aux
  • 4 output channels
    • 2 as main output with 6 band equalizer
    • 1 as pre Aux output
    • 1 as post Aux output

That’s about it. Adding more modules will prompt an error that you are out of memory. Considering what most 8 input analog mixer are offering on the market, this features are better. This project can be further improved so I have uploaded the project file on my download page so you can edit it yourself.

Sigma Studio Project

Main Schematic

Channel strip

These controls can be accessed through a microcontroller connected to it via I2C. The microcontroller can then be connected to user interface such as buttons and displays like LCD.

10 Channel variant

I have tried to use the maximum possible inout of the ADAU1701 which is 10 inputs but simplifying the schematic and removing the compressor on channel 7 and 8. The 2 additional channel can be used for bluetooth audio. I was able to achieve the following:

  • 10 input channels
    • Channels 1-6 has HPF, 3 band Parametric EQ, Compressor, 2 aux sends
    • Channels 7 and 8 has 3 band Parametric EQ and 2 aux sends
    • Channel 9 and 10 has 3 band EQ
  • 4 output channels
    • 2 main out with 10 band graphic EQ
    • 1 Pre Aux out
    • 1 Post Aux out

I think that is the best I can have for ADAU1701 DSP.

Multi-track Recording

This is the biggest challenge for this project, for now I don’t have any idea on how can it be done and how it can work with the ADAU1701. What’s clear for now is that the ADAU1701 DSP can’t be used for this purpose. I know it can be done using the XMOS chip but the development board is too expensive for me.

Conclusion:

The ADAU1701 is a powerful DSP for audio application. It can surely be used for digital audio mixer application with limited input channels. 8 channels maybe the most channels you can have for this application. You can have as much as 10 total inputs but you need to limit some functions like compressors to be able to use all the 10 inputs or else you will ran out of memory and the project will not compile at all.

Notes:

  • ADAU1701 only have 2 ADC channels build in, you need an external ADC to be able to add 6 more inputs.

I have yet to build the actual hardware but I am not sure when I can do it. When I got the fund and time for sure but I am not sure when.

Downloads:

Download page

Arduino Controlled Bass Mid Treble and input selector

My LC75341 project was a bit of a disappointment. It was working ok but it only offers bass and treble controls. The frequency response is not that good. It has very limited controls. I decided to stop that project because it is not what I am looking for. Now after lots of research, I stumble upon this digitally controlled bass mid treble IC from ST. What is great is that it has 7 band spectrum analyzer feature and a differential input. Plus it also has Q and frequency control and a subwoofer output. This is almost exactly what I want to do.

Continue reading “Arduino Controlled Bass Mid Treble and input selector”

2 Way Active Crossover with adjustable frequency

Most of the schematic design of active crossover on the internet are mostly with fixed crossover frequency. Here’s an interesting circuit that I found on Elliot Sound Products website. I learned a lot on this website when I was just a student. If you love to build sound products such as amplifiers and tone controls, you may already know about this website.

Continue reading “2 Way Active Crossover with adjustable frequency”

Passive tone control circuit

If you are looking for a passive tone control for bass and treble control, here’s a simple one. Take note that because it is a passive circuit, it has no capability to boost signal. This circuit can only be used for high level source like car stereo speaker output. For headphone output, you may need to change some resistor values to decrease the attenuation of the signal. This will also modify the response of the circuit.

Continue reading “Passive tone control circuit”

Simple USB powered Guitar Amp

Here’s a simple guitar amp that is USB powered. It only has gain control and nothing else. The amp is based on LM386 IC and can only give up to around 200mW when powered via USB. But you can get as much as 700mW when powering it with 9V and using an 8 ohm speaker. There is no volume or tone controls to make the circuit simple but I am planning to to design a USB powered guitar amp with tone controls in the future. But for now, here is the simple version.

Continue reading “Simple USB powered Guitar Amp”