PicoBuck Hookup Guide v12
Dimming with a Microcontroller
As mentioned earlier, the PicoBuck's three channels can be individually dimmed by either varying the input voltage of the channel from 0-2.5V or using a PWM signal. You could use a preprogrammed microcontroller like the capacitive touch potentioemter or custom control each channel using any microcontroller with PWM outputs.
Pre-Programmed Capacitive Touch Potentiometer
If you are looking for a preprogrammed microcontroller with capacitive touch capabilities, check out the Touch Potentiometer. There is additional software that can be used to fine tune the settings of the capacitive touch potentiometer.
Touch Potentiometer for PWM Lighting Controller |
Arduino
Otherwise, the PWM signal from an Arduino board is also perfectly suited for this.
Connecting One LED Per Channel
Here's a diagram showing how to connect the PicoBuck to an Arduino.
Note that each channel must be independently connected to the + and - connections of the LED it is to drive! Do not connect the + or - connections of any two channels together.
More Than One LED Per Channel
Multiple LEDs can be connected in series, as shown, and the supply voltage should be at least 2-3V higher than the sum of the forward voltages of the LEDs.
Multiple LEDs can be connected per channel; they should be connected in series, as shown above, and the power supply voltage must be at least 1-2V higher that the sum of the forward voltages of the LEDs.
For instance, our blue 3W LEDs have a forward voltage of 3.2V to 3.8V. To be on the safe side, use the highest voltage in the range. If you want to connect four of them, you'd need a power supply of ~17V or greater (3.8V + 3.8V + 3.8V + 3.8V = 15.2V; add 2V of "head room").
Since 17V is greater than the Arduino can tolerate on its input, we have to provide an external supply for the Arduino as well. This can be the standard 5V USB supply.
It's perfectly acceptable to mix colors either between channels or on one channel, so long as all of the LEDs can handle the current (330mA or 660mA, depending on the jumper setting). Just make sure that the power supply voltage is high enough to handle the sum voltages of the highest voltage string. There is also no requirement that the three strings of LEDs have the same forward voltage of LEDs across them; you could have one white LED on channel 1, two red LEDs on channel 2, and four green LEDs on channel 3.
Arduino Code Example
Note: This example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE.
Code for controlling this device is trivial; simply use the analogWrite()
function to adjust the brightness via PWM.
language:c
/**
* PicoBuck Breakout Example
* Mike Hord @ SparkFun Electronics
* Nov 5 2015
*
* A simple example showing how to control a PicoBuck with an Arduino.
*
* License: http://opensource.org/licenses/MIT
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
const int CHL_1 = 3;
const int CHL_2 = 5;
const int CHL_3 = 6;
void setup()
{
pinMode(CHL_1, OUTPUT);
pinMode(CHL_2, OUTPUT);
pinMode(CHL_3, OUTPUT);
}
void loop()
{
// Let's just step through a couple of values, so we can see how they look.
// Remember, LEDs are non-linear, so doubling the PWM output value won't
// necessarily double the apparent brightness.
analogWrite(CHL_1, 0);
analogWrite(CHL_2, 0);
analogWrite(CHL_3, 0);
delay(1000);
analogWrite(CHL_1, 64);
analogWrite(CHL_2, 64);
analogWrite(CHL_3, 64);
delay(1000);
analogWrite(CHL_1, 255);
analogWrite(CHL_2, 255);
analogWrite(CHL_3, 255);
delay(1000);
}
Try checking the example that was used in the LilyPad ProtoSnap Plus Activity Guide for custom color mixing with tertiary colors. Just make sure to update the pin definitions.
Or try using the code from the Non-Addressable RGB LED Strip Hookup Guide. While the code was written for RGB strips with transistors, the code functions the same with the the PickBuck.