This post shows how to update BlueZ on Raspberry Pi from 5.43 (the default version comes with Raspbian Stretch) to 5.50 (released notes [1]). In this post, I assume that you already have a Raspberry Pi 3, Pi 3+, or Raspberry Pi Zero W running Raspbian Stretch.

Steps[2]1. Check Current BlueZ Version1-1. Before starting, let’s check the current BlueZ version.

The goal of this post is to create an Alexa skill [1] that controls three LEDs (red, yellow, and green) connected to Raspberry Pi’s GPIO pins. The skill will enable to turn ON/OFF each LED by specifying the color of light and the ON/OFF status via voice command.

Steps1. Wiring and Booting UpIn this post we’ll use Pi Traffic Light so that we can skip making the circuit. Pi Traffic Light is designed for Raspberry Pi and you can just connect it to Raspberry Pi’s GPIO pins. [1]

2-3. Set BCM as GPIO numbering mode since the instruction uses BCM numbering. See [3] for more about the pin numbering.

1

GPIO.setmode(GPIO.BCM)

2-4. For readability purpose, let’s assign the pin numbers to variables. GPIO pins 9, 10, and 11 will be used for red, yellow, and green lights respectively.

1

2

3

red=9

yellow=10

green=11

2-5. Set those pins as output pins.

1

2

forpin in[red,yellow,green]:

GPIO.setup(pin,GPIO.OUT)

3. Controlling LEDs
Now, the preparation is done. Let’s turn ON/OFF the LEDs by using “GPIO.output”. The first argument is for LED color (i.e. pin number) and the second argument is for OFF/ON (0 and 1 respectively).

3-1. Turn on the red light.

1

GPIO.output(red,1)

3-2. Turn off the red light.

1

GPIO.output(red,0)

3-3. Turn on the yellow light.

1

GPIO.output(yellow,1)

3-4. Turn off the yellow light.

1

GPIO.output(yellow,0)

3-5. Turn on the green light.

1

GPIO.output(green,1)

3-6. Turn off the green light.

1

GPIO.output(green,0)

4. Finishing the Program4-1. Reset the all the pins to input mode. [4]