Getting ready

You will need the RGB LED module shown in the following picture:

The RGB LED module from PiHardware.com

As you can see in the preceding photo, the RGB LED module from http://pihardware.com/ comes with GPIO pins and a DuPont female-to-female cable for connecting it. Although there are two sets of pins labelled from 1 to 5, only one side needs to be connected.

Alternatively, you can recreate your own with the following circuit using five common cathode RGB LEDs, 3 x 470 ohm resistors, and a Vero prototype board (or large breadboard). The circuit will look as shown in the following diagram:

Circuit diagram for the RGB LED module
Strictly speaking, we should use 15 resistors in this circuit (one for each RGB LED element), which will avoid interference from LEDs sharing the same resistor, and will also prolong the life of the LEDs themselves if switched on together. However, there is only a slight advantage in using this, particularly since we intend to drive each RGB LED independently of the other four to achieve multi-color effects.

You will need to connect the circuit to the Raspberry Pi GPIO header as follows:

RGB LED

1

2

3

4

Rpi GPIO pin

2

4

6

8

10

12

14

16

18

20

22

24

26

28

30

32

34

36

38

40

Rpi GPIO pin

1

3

5

7

9

11

13

15

17

19

21

23

25

27

29

31

33

35

37

39

RGB LED

5

R

G

B

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.19.251