Ray Burnette

Inexpensive but Flexible RPi Zero Breadboarding (UPDATED)

Save the cost and hassle of the Cobbler cable for the RPi Zero family by simply changing the male connectors to female ones like on Arduino.

EasyFull instructions provided2 hours135
Inexpensive but Flexible RPi Zero Breadboarding (UPDATED)

Things used in this project

Hardware components

RGB Diffused Common Anode
RGB Diffused Common Anode
Resistor 330 ohm
Resistor 330 ohm
Breadboard (generic)
Breadboard (generic)
Jumper wires (generic)
Jumper wires (generic)
Cutting board
Plastic cutting board sold at WalMart, DollarTree, etc.

Software apps and online services

BCM2835 Library for RPi
Other libraries exist for GPIO support on RPi
Geany IDE
Optional if another IDE is preferred
C++ Boost library for Raspbian

Hand tools and fabrication machines

Strips, dots, etc. Available at most office supply stores.


Read more


Generic connection

Danger ... use appropriate current limiting resistor
Genericrpi ri7dffjkip


Source for Blink_3

Written for common anode RGB LED
// blink3.c
// Example program for bcm2835 library
// Blinks a tricolor LED on an off every 0.5 secs (editable)
// Or you can test it before installing with:
// gcc -o blink -I ../../src ../../src/bcm2835.c blink3.c
// sudo ./blink3

// For Geany GUI IDE:
// 	Compile switches:  gcc -Wall -c "%f" -l bcm2835
// 	Build switches:    gcc -Wall -o "%e" "%f" -l bcm2835
// 	Execute switches:  sudo "./%e"
// YouTube vid: https://www.youtube.com/watch?v=jlM9KoWyPv0&index=5&list=PL-6WIzdGN7xQdIvyCtQUhmflKNsidxfwX

#include <bcm2835.h>
#include <stdio.h>

// modified mrb 20170419 for RPi Zero
// LED between common anode to +3.3 and Pin 12, 16, 18 to 330 Ohm to RGB of LED
// RPi P1_pin_12 == GPIO_18
// RPi P1_pin_16 == GPIO_23
// RPi P1_pin_18 == GPIO_24

#define RED RPI_GPIO_P1_12 // SAME RESULTS AS #define PIN 18
#define GRN RPI_GPIO_P1_16
#define BLU RPI_GPIO_P1_18

#define t_On	10
#define t_Off	300
#define Led_Off	HIGH
#define Led_On	LOW

int main(int argc, char **argv)
    if (!bcm2835_init() ) return 1 ;

    // Set the pin to be an output
    bcm2835_gpio_fsel(RED, BCM2835_GPIO_FSEL_OUTP) ;
    bcm2835_gpio_fsel(GRN, BCM2835_GPIO_FSEL_OUTP) ;
    bcm2835_gpio_fsel(BLU, BCM2835_GPIO_FSEL_OUTP) ;
	// LED used is a RGB with a common anode which connects to 3.3V
    // Therefore, any LED is OFF when the port pin is HIGH
    bcm2835_gpio_write(RED, Led_Off);
    bcm2835_gpio_write(GRN, Led_Off);
    bcm2835_gpio_write(BLU, Led_Off);

    while (1)						// Function same as loop() in Arduino
	// LEDs illuminate when cathode is connected by output buffer to ground (sink)
	// ***WARNING*** a suitable current limiting resistor must be used (~330 Ohm)
	// RED LED on, wait, off, wait ... next color, repeat
	bcm2835_gpio_write(RED, Led_On);
	bcm2835_gpio_write(RED, Led_Off);
	// Repeat for Green
	bcm2835_gpio_write(GRN, Led_On);
	bcm2835_gpio_write(GRN, Led_Off);
	// Repeat for Blue
	bcm2835_gpio_write(BLU, Led_On);
	bcm2835_gpio_write(BLU, Led_Off);
    // Unless program responds to a Ctrl+C (break), the above loops forever
    bcm2835_close();				// housecleaning
    return 0;


Ray Burnette

Ray Burnette

57 projects • 395 followers
IT architect - retired AT&T... USAF-Secure Comm , Burroughs, Clemson U. School of EE Research, Southern Bell, BellSouth, SofKinetics, Inc. (President), AT&T IT
Thanks to SpazzTech.