Relay in led driver circuit

Newbie to electronics here.
Referencing Allegro’s A6211 LED driver, I’m planning a circuit that uses the “typical circuit” example in the data sheets for both this IC and the IC evaluation board APEK6211GLJ-01-T-DK. Amazingly, the circuits in the two data sheets are pretty much identical, which gives me some confidence in the examples.

The environment: 1) DC power supply is 12.6V to 13.5V, typically the latter (automotive); 2) LED is Cree XHP70.2 with Vf of 11.6V and a max current of 2.4A: 3) R1, which controls the switching freq will be 240 KOhm to achieve a lower freq of 300 KHz; 4) Rsense will be .08 Ohm to achieve a 2.5A CC output: and 5) there will be a 5V relay between the power source and C1 (47uF 50V) that filters/conditions for Vin.


  1. this IC, of course, is buck topology - can I get 11.6V out of the 13.5 input? There is a graph in the DS that indicates that at the lower freqs (300 KHz), the output V can be as high as .9167 of the input voltage.
  2. reading the DS, I think the inductance value should be between 22uH and 33uH - what say you all?
  3. for the relay, was thinking of using a G5Q-1A4-EL2-HA-DC5 (not in DigiKey’s system) to enable blinking capabilities. What problems am I introducing to this circuit with this relay? Is there a better place to insert the relay? BTW, the relay will be switched by a PIC10F200 off of a GPI/O pin with a amp circuit to get up to the requirements of the relay.

Advance thanks to all that contribute.

Hello Larry,

You are indeed pushing the design to the limits. The chosen supply voltage does not provide much in the way of overhead. For a LED at full power, the duty cycle will dance around 100%. The driver MOSFET will have a small voltage as will the B560C-13-F Shottky diode. Together, their voltage drops represent the bulk of the 0.9 V you mentioned.

There is a relationship between the inductance and the PWM. May I recommend an empirical approach. Since the cost is relatively low, purchase 10, 22, and 33 uH devices. Conduct a few experiments with the inductor values and the R1 (master frequency). Use an oscilloscope to look for stable operation. Also look for best efficiency.

Finally, I understand you have a PIC10 and want to blink the LED. Instead of a relay, why not program the PIC to provide a PWM signal to the EN pin of the LED driver? That PIC10F200 is very hardware constrained. However, you may be able to form a PWM using an interrupt based routine fed by TMR0. With some care you may be able to bit-bang a PWM in the main loop. The good news is that it doesn’t need to be fast (100 to 2000 Hz).

Do you have any remaining I/O to control the relay? You may or may not want to add this functionality as a master-enable for the circuit. Your solution may depend on how it is integrated into the remainder of the automotive / boat systems.

Tech Tip: “Blinking” anything with a mechanical relay is asking for trouble. The circuit will certainly work at first. However, it’s only a matter of time before the wear and tear causes the circuit to malfunction. The supporting hardware for the armature may come out of alignment. Also, the arc associated with the contacts can cause a breakdown.

Best Wishes,


P.S. The PIC10F200 is still in production but Microchip lists PIC10F322, PIC10F222 as “Newer Products Available.” Depending on your needs, you may want to consider using the new parts.

1 Like

Thanks ADP - all of that is very good info - it’s going to improve my project results tremendously. Let me ask a question (or set of questions) and then after that I’ll give more background on the project design.

Back to the very first comment - I’m totally inexperienced in electronics. So lots of basic questions. Okay, pursuing the PIC generating a PWM signal, I believe that can be done on the programming side (there is a tutorial at The original plan was to program turning on output pins to energize the low side of mechanical relays for specific periods of time. Instead, the programming will send a sq wave signal and vary the duty cycle to achieve near 100% instantaneous dimming, as desired. So, please tell me how the electricity works for this appication:

PIC output -

  1. Vin can be 2V to 5.5V. If I understand the DS correctly, the PIC has an operating environment of 350uA @ 2V (not even a mA). But then it says that it has a wide operating range of 2V to 5.5V, same as the Vin range. Does that mean that it operates at whatever Vin is, so long as it’s in the range?

  2. again, if I understand the DS, the max output individually for the three GPIO pins is 25 mA and I presume that is at whatever the PIC is operating at voltage wise? The 25 mA should be enough for the needs of the EN pin, should it not?

A6211 input needs (EN pin) -

  1. the DS says Ven can be as high as Vin +.03V. No problem then, the PIC can send its PWM signal at 5V (I’m jumping to a specific answer to the above question, which just may not be true). For powering the PIC, I’m planning on doing a V reduction from 13.5V to 5.xV with a zener diode. So if the PIC is operating at 5V, would it not send the PWM signal at that voltage?
  2. in the DS for the A6211 evaluation board, there is a resistor and capacitor in the EN pin circuit. What conditioning of the PIC input do I need to do?

I’m glad to to leave the mechanical relay behind. And the SS relays are very expensive. So, if the above works, it will be an elegant solution to a pesky problem.

Need for analog dimming: With the duty cycle of the pulse wave being forced high and low by the PIC, that will appear to the human eye as being turned on and off (indeed, it will be on and off). There will be, on occasion, a need to reduce the lumen output during the “high sessions” to maybe a quarter or a third of the LED’s unimpeded potential. How would one do that? Would one place a potentiometer just upstream of the LED?

Summary of project: automotive voltage (13.5V) simultaneously feeding a PIC10F200 and three A6211 that will be driving three Cree XHP70.2 LEDs at 11.6+V and at 2.5A to each LED. The PIC has 3 output pins that will feed the EN pin individualy and separately for the three A6211 ICs and therefore the LEDs. This setup will enable unlimited variation in the “blinking” pattern. One unknown, the PIC10F200 is limited to 256 commands - maybe not enough to get the job done? If so, there are more capable PICs.

Final thought: I am amazed at how cheap the electronic components are. With the exception of SS relays, they are practically giving this stuff away!


Hello Larry,

Indeed, there is incredible power and flexibility in modern electronics.

Yes, the PWM is formed by software as the chosen PIC10F does not feature a PWM hardware peripheral. The good news about the PIC family is that it has been around for decades. The designers have maintained consistency with the hardware design. Consequently, there are many tutorials you can follow. Not all will be directly applicable to your particular model, but they will all follow a general plan.

BTW, have you found and used the MPLAB® Code Configurator? This tool (programming assistant) can help you configure the microcontroller peripherals such as I/O pins and the timer.

With regards to your questions.

  1. Yes, the PIC may operate within a range of voltages. The 2.0 to 5 VDC you mentioned is appropriate. However, do be careful as some microcontrollers do not operate at the full clock / peripheral speed at lower voltages. In your application this is likely not important.

  2. Relative to the PWM frequency you will be using, the R7 / R6 combination show in in the demo board schematic is invisible. The resistor is installed to limit the current should the microcontroller have a higher voltage than the Allegro driver.

  3. Recommend sending the potentiometer to a microcontroller Analog to Digital Converter (ADC). Unfortunately, there is no such hardware on the PIC10F200. However, the newer PIC10F222 does include this desirable feature. You then program the PIC to read the potentiometer and adjust the PWM duty cycle accordingly.

  4. The PIC family is vast with many members that will meet your needs. The PIC10F200 is one of the smallest. Sincer you are prototyping, you may want to move up to a model with more features such as this EV09Z19A development board. This would give you access to more I/O and features such as hardware based ADC and PWM. There are similar offerings from other manufactures. If you are curious, you may want to thread this article about low-cost microcontrollers:

Best Wishes,



Thanks again APD, terrific information. The “product” appears to be getting better as we go.

Regarding the MCU, I’m not in love with the PIC10F200, but it may be capable of doing what I need, so I’m going to keep it in the mix until it looks like it no longer makes sense.

PRODUCT SUMMARIZATION: The product is a constant current driver package that will individually drive 3 high-power Cree LEDs with 3 Allegro driver chips that will have a dual dimming capability that will be applied consistently to all 3 LEDs. One of the dimming methods (PWM) will, in fact, function at the extreme and appear to be a blinking of the LEDs (with unlimited variability) and the other dimming method (resistance) will actually lower the current to the LEDs while the LEDs are in “on” condition (PIC output off). Mechanical relays have been discarded and the blinking and dimming will be accomplished by the PIC and ???, respectively.

APD, please help me understand what I think is going to happen with interaction between the PIC and the CC driver, as described below.

Allegro driver: with no input to the EN pin, the IC trucks right along and supplies current to the single output channel based on it native architecture and the Rsense resistor value. I’m thinking that the 80mOhm Rsense resistor dictates an .83% (2.5A out of a 3A potential) duty cycle for the chip and that goes on for so long as there is power and it’s operating within its heat range.

When there is square wave (PWM) input to the EN pin, the IC must be designed such that the duty cycle of the input takes precedence over the duty cycle determined by the Rsense resistor, thereby likely cutting current to, and brightness of, the LED. I suppose it could also increase the duty cycle and increase brightness?

PIC10F200: there are 3 output pins that put out a square wave and I’m guessing that the duty cycle of the output is 50% (doesn’t really matter). To achieve a blinking effect, it appears that an output pin could be turned on and off (cleared and set) with a software generated reduced and constant duty cycle of 1% or less. Sort of PWM with a predetermined very low duty cycle and no further modulation. The Allegro driver would default to its “no EN input” condition during the time that the PIC output was off and then would instantaneously drop from 83% to <1% of current potential when the PIC output is turned on.

Dimming the “no EN input” periods: These periods will be controlled by the Rsense resistor. Perhaps there is a potentiometer that could be put in series that would increase the Rsense resistence to 500mOhm. That would reduce the current going to the LEDs to 400mA, a small fraction of the normal 2.5A.

The above is probably all wrong but that’s how I see it. So straighten me out.

I have a schematic but do not know how to attach.


1 Like

For this proto board, the only difference in the three driver circuits is that they have fixed inductors of 10uH, 22uH and 33uH, left to right. This is per APDahlen’s suggestion.


Hello Larry,

Have you considered the programming connection for the PIC? It’s certainly possible to perform the programming before installing the uC on the PCB. However, if there is ever a change, it would be useful to have a programming connection (header) for easy modification.

Yes, as I understand the Allegro driver has its own high frequency PWM set by. By contrast, or should I say on a related note, the PIC develops a low frequency PWM that will modulate the Allegro’s PWM to dim the LEDs.

Have you prototyped the unit? There may yet be value in purchasing the demo board to explore the operation before committing to a new PCB. You may want to study / reverse engineer the demo board to see how the designers routed the traces. With this high frequency design, you will want to take every advantage you can to prevent unstable operation.

Other than that, keep going and see where it takes you. I appreciate you keeping us informed.


1 Like

APD, I have it prototyped in EasyEDA but have not had any boards made. I have some challenges with the component library but I can solve that when the time comes. Also, I need to add the potentiometer for conditioning the Rsense resistor.

Software “development” of the PIC10F200 continues. If satisfactory results are not achieved, I’ll change out MCU for the PIC12F1501, which has three PWM hardware channels.

APD, please help me spec out a header for programming - I know nothing about the technical specs. Male or female? Pin size? For development, I’m using MPLAB IDE 8.91 and a PICKIT2 (sort of a neanderthal approach - but fairly efficient in terms of mouse clicks). There are 5 male pins connected to the BB but there is an unused pin and it’s easy to convert to a 6 pin female connection. I assume I can buy either MCU (in quantity) that is already programmed and code protected. But the ability to re-flash would be great considering the low cost to include that capability.


Hello Larry,

An example circuit is shown in the PICkit5 Quick Start User Guide - this should be very close to the PICkit2 you mentioned. Notice that the debugger connects to your board via a 6 or 8-pin header as shown in this image:

Picture showing the PICkit5 debugger connection to a user circuit board.

You will need to be careful with your PCB design as the PICkit programmer will take control of the various microcontroller pins. It may or may not be compatible with external hardware you have connected to the microcontroller. Also, your external hardware may not like being driven the PICkit. Generally, as you develop hardware, it’s best to keep the programming line free and clear. Later as you shift to a production mindset you can more the pin assignments to optimize the PCB traces and accommodate the programming header.

Best Wishes,


P.S. DigiKey has a value-added service that may be able to program the PIC for you. Yes, I agree that the ability to reflash would be beneficial.