Baby Orangutan: use motor outputs for high current led pulse

Hello, I have a robot which uses IR emitters that require a brief high current pulse (~8us), currently driven through a Darlington transistor array. However, I’m running out of room on the board and only use 1/4 of the 18-pin array so I am considering using the motor outputs since they can source the necessary current.

My plan would be to use the hardware PWM outputs (non-inverted) on PD5 (M1) and PD3 (M2) and set the duty cycle to 100% for the 8us pulses. Also, the led max surge current is 2.6A for 10us so it seems like I should not need a current limiting resistor. Does this sound reasonable?

I making this up as I go and don’t have an oscilloscope to test with so I thought I’d run it by the experts here to see if anyone else has done something similar and if there are any issues I may not be aware of. I could be out in left field on this one – thanks!


Just so I’m clear, your goal would be to turn the driver on for 8 us and then turn it off? That generally sounds ok. You wouldn’t even need to use the hardware PWM for this; you could just use driver inputs as digital outputs.

Note that the voltage of the driver output will be VIN, not the board’s regulated 5 V, and you are talking about small time scales over which the driver output might not correspond exactly with the driver input (there could be various response delays within the driver, so make sure you check the driver datasheet). Why do you think a current limiting resistor is not required for your particular application?

- Ben

Yes, just a series of 8 microsecond pulses, probably at 500 microseconds intervals. For some reason, I was thinking along the lines that the motor outputs source a maximum of 1A which is well below the max surge current the emitters can handle; however, I do need a resistor.

As for driver response times, it looks like there is some dead time built in, but only up to about 0.24us so I can factor that in.

I don’t quite follow this statement: “use driver inputs as digital outputs”. I thought that the driver inputs (PD5/6,PD3/PB3) still remain inputs and the outputs are tapped off the four motor pins. I must be missing something basic here, can you elaborate?


The motor driver inputs happen to be hardware PWM outputs from timers 0 and 2 on the AVR, and the Pololu AVR library motor control code uses them as such. However, if you just want the simple behavior of on for 8 us and then off again, there is no need to complicate things by bringing the PWM control into the equation. Simply use the control lines (PD5, PD6, PD3, and PB3) as digital outputs driven appropriately to turn the driver outputs on and off (see the TB6612FNG datasheet for the driver’s truth table). Does this make sense?

- Ben

Yes, that makes sense and makes this WAY simpler than messing with PWM. Looks like I can also tie one of each pair of control lines either high or low and just use a single control line from each bank to toggle the driver output as required so this is perfect. Thanks again!