Relay and Audio Buzzer

Audio Buzzer

An on board Audio Buzzer, can be used to give alarm sound. 

The Schematics of the Alarm 

This is the location of the Buzzer and Relay on the board. 

The Buzzer can be activated by sending a digital 300 Hz to about 10K square wave to GPIO37.

Relay

A relay is an electrically-operated switch. These switches can be extremely useful for a variety of Raspberry Pi projects (think turning on a light or opening your garage door. Watch the video below to learn how to drive a relay using your Raspberry Pi.

Following schematics show how the Relay is connected to Raspberry-Pi.

Following python code can be used to turn the Relay switch On and Off.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#!/usr/bin/env python

import time

import RPi.GPIO as GPIO


GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
GPIO.output(17, GPIO.LOW)

time.sleep(0.25)

GPIO.output(17, GPIO.HIGH)
GPIO.cleanup()