0% found this document useful (0 votes)
64 views8 pages

Raspberry Pi Big Ben Clock - 3 Steps - Instructables

The document describes a project for creating a Raspberry Pi Big Ben Clock that simulates the sounds of a grandfather or cuckoo clock using audio files and Bash scripting. It outlines the requirements, coding steps, and how to set up the clock to play sounds at specific intervals using Crontab. The project is aimed at users familiar with Raspberry Pi and provides links to necessary audio files and additional resources.

Uploaded by

victoriamensao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views8 pages

Raspberry Pi Big Ben Clock - 3 Steps - Instructables

The document describes a project for creating a Raspberry Pi Big Ben Clock that simulates the sounds of a grandfather or cuckoo clock using audio files and Bash scripting. It outlines the requirements, coding steps, and how to set up the clock to play sounds at specific intervals using Crontab. The project is aimed at users familiar with Raspberry Pi and provides links to necessary audio files and additional resources.

Uploaded by

victoriamensao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Projects Contests Teachers

Log In(https://www.instructables.com/account/login/?nxtPg=)
(/projects) (/contest) (/teachers) (/search)
(/)

(https://www.instructables.com/contest/3dprint2023/?instructables)

Raspberry Pi Big Ben Clock


By renierdelport (/member/renierdelport/) in Circuits (/circuits/) > Raspberry Pi (/circuits/raspberry-pi/projects/)
5,724 21 6

Download Favorite

(https://content.instructables.com/FB6/FHZM/J4IQ062Z/FB6FHZMJ4IQ062Z.jpg?
auto=webp&frame=1&fit=bounds&md=508ac78b26d313f878d9f13c102c84e0)
(/member/renierdelport/)
By renierdelport
(/member/renierdelport/)
My Website More by
(http://www.behind-the- the author:
scenes.co.za)

Follow

About: I also find myself busy with creative web design, my websites, motorcycling, photo shopping,
micro electronics, non-commercialised music, superhero movies, bad ass series and many other things
that are not int… More About renierdelport » (/member/renierdelport/)

Want your own grandfather or cuckoo sounding clock run on each hour? Stay
tuned. I've been using Instructables for so long long now, so I decided to give
something back. Introducing my Raspberry Pi Big Ben Clock.

This is a small little project I did out of a bit of boredom because I had a 'silent'
Raspberry Pi behind my TV who's only job was to play mp3s on demand (maybe an
Instructable for another day).

The Raspberry Pi Big Ben Clock is basically an audio simulation of a grandfather


or cuckoo clock using some edited mp3's I got o! the internet, some Bash scripting
and crontab. It is called Big Ben because the audio "les I decided to use was from
the Great Bell in London, England.

You can use any audio of your choice, but this fairly simple Instructable will help
you to put it all together.

 Add Tip " Ask Question # Comment Download

Step 1: Requirements
(https://content.instructables.com/FCX/G6G7/J4IQ072H/FCXG6G7J4IQ072H.jpg?
auto=webp&frame=1&fit=bounds&md=181a74f58c2793d296e56f6135100e6d)

This Instructable will be very easy for those who owns and/or are familiar with the
Raspberry Pi. You will obviously need one, pre-installed with the very popular
Raspbian operating system. I used Wheezy, but the steps will be the same with
Jessy.

You will also need to be connected to the internet to be able to do the latest
update/upgrade,

sudo apt-get update

sudo apt-get upgrade

get the necessary additional software like MPlayer

sudo apt-get install mplayer

and to get the time accurately (usually done automatically if your location settings
are correct).

I used a B model Raspberry Pi, with which you can run audio through the HDMI
cable, but I preferred using the audio jack instead (con"gurable through Raspi-
con"g or the GUI).
 Add Tip " Ask Question # Comment Download

Step 2: Do the Coding

(https://content.instructables.com/FK7/Z5MY/INC0CA9Y/FK7Z5MYINC0CA9Y.jpg?
auto=webp&frame=1&fit=bounds&md=8f2479dbdfcdde762b39a9f7997b1bd8)

I used a simple Bash script, the mp3s and Crontab for this project. Create a big-ben
directory in a known location to hold the Bash script and the mp3s. For
explanation, I will use /home/pi/big-ben. To get started, you can download mine
below - originally from the UK Parliament website (http://www.parliamen-
t.uk/about/living-heritage/building/palace/big-ben/anniversary-year/downloads).

From a freshly booted Raspbian terminal (i.e. the default working directory, which
should be /home/pi) copy the following lines one-by-one to create the directory
and copy the mp3 "les:

mkdir /home/pi/big-ben

cd /home/pi/big-ben

wget https://www.instructables.com/files/orig/F3C/WOPJ/INC0CAI4/F3CWOPJINC0CAI4.mp3

wget https://www.instructables.com/files/orig/FOP/GM68/INC0CAI9/FOPGM68INC0CAI9.mp3

To create the script:

nano clock.sh

and copy this code to it:


#!/bin/bash
# Triggered through Crontab every 30 minutes
minute=$(date +"%M")
if [[ $minute == 30 ]]
then
mplayer "/home/pi/big-ben/FOPGM68INC0CAI9.mp3"
elif [[ $minute == 00 ]]
then
mplayer "/home/pi/big-ben/F3CWOPJINC0CAI4.mp3"
hour=$(date +"%I")
x=0
while [ $x -lt $hour ]
do
mplayer "/home/pi/big-ben/FOPGM68INC0CAI9.mp3"
let x=x+1
done
fi

Remember to exit & save (Ctrl + x, y Enter)

To add this script to Crontab:

crontab -e

By adding the following command to Crontab, the scrip will be executed every 30
minutes:

0,30 * * * * bash /home/pi/big-ben/clock.sh

Exit & save (Ctrl + x, y Enter)

big-ben-hourly-chimes.mp3 (https://content.instructables.com/F3C/WOPJ/INC0CAI4/F3C‐
Download (https://content.instructables.com/F3C/WOPJ/INC0CAI4/F3CWOPJINC0CAI4.mp3)
WOPJINC0CAI4.mp3)

big-ben-strike.mp3 (https://content.instructables.com/FOP/GM68/INC0CAI9/FOPGM68INC0‐
Download (https://content.instructables.com/FOP/GM68/INC0CAI9/FOPGM68INC0CAI9.mp3)
CAI9.mp3)

 Add Tip " Ask Question # Comment Download

Step 3: Conclusion

(https://content.instructables.com/FXX/KRP5/J4IQ07P4/FXXKRP5J4IQ07P4.jpg?
auto=webp&frame=1&fit=bounds&md=c72540a06ebe05894a66f623a0ffa205)

That's about it! Sit back and wait for the magic to happen if the clock strikes.
You can go back and look a bit deeper into what I did and make your own changes.
I for example added Bash to prevent this clock script running in the evenings. You
can also use Crontab for that. Also go and try your own sounds.

For more like this, see my Blog (http://www.behind-the-scenes.co.za).

Enjoy =)-~

 Add Tip " Ask Question # Comment Download

1 Person Made This Project!

michael95420 (/member/michael95420/)
made it!

Did you make this project? Share it with us!

I Made It!

Recommendations
(/Ventbot-a-DIY-Home-HVAC-Vent-Booster- (/Tiny-Mac-II-Pi-Zero-2-and-Tiny-Mac-III-Pi-4-
Warm-Side-Coo/) With-A/)

Ventbot, a DIY Home HVAC Vent Booster: Tiny Mac II (Pi Zero 2) and Tiny Mac III (Pi
Warm Side Cool, Cool Side Warm 4) As Telegram Picture Fame (TeleFrame),
(/Ventbot-a-DIY-Home-HVAC-Vent- Activity-LED, Safe Shutdown and More
Booster-Warm-Side-Coo/) by wjcarpenter (/Tiny-Mac-II-Pi-Zero-2-and-Tiny-Mac-III-
 24
(/member/wjcarpenter/) in Gadgets % 4.4K Pi-4-With-A/) by The_Old_Wolf 53 % 7.5K
(/circuits/gadgets/projects/) (/member/The_Old_Wolf/) in Raspberry Pi
(/circuits/raspberry-pi/projects/)

(/contest/3dprint2023/) (/contest/rainbow23/)

 Add Tip

" Ask Question

# Post Comment

We have a be nice policy.


Please be positive and constructive.

Add Images Post

6 Comments

(/member/solarboyy/) solarboyy (/member/solarboyy/) 1 year ago Reply & Upvote

Excellent build! Thank you for sharing. May I inquire as to which version of Raspberry Pi Model board
(e.g. B) did you use? What is the necessary RAM? Is it possible to program this so that the clock is
silent at night, say from 9pm night, to 6 am the next morning? Thanks again.
(/member/kford2/) kford2 (/member/kford2/) Question 5 years ago Answer & Upvote

I am looking to play specific audio files at certain times throughout the day. Not sure what needs to be
modified to do this. any suggestions on where to look?
1 answer '

(/member/danymj/) danymj (/member/danymj/) 5 years ago Reply & Upvote

I have it added to my grandfather clock that doesn't chime. Awesome project, thank you for sharing

(/member/neilblenkiron/) neilblenkiron (/member/neilblenkiron/) 7 years ago Reply & Upvote

What a great Instructable. I have it running on my Pi, laptop and desktop computers. Must remember
to turn off when I'm in the library though ;-)
1 reply '

Post Comment

Categories About Us Resources


 Circuits (/circuits/) Who We Are (/about/) Sitemap (/sitemap/)
 Workshop (/workshop/) Why Publish? Help (/how-to-write-
 Craft (/craft/) (/create/) a-great-instructable/)

 Cooking (/cooking/) Contact (/contact/)

 Living (/living/)
 Outside (/outside/)
 Teachers (/teachers/)
Find Us

(https://www.instagram.com/instructables/) (https://www.tiktok.com/@instructables)

© 2023 Autodesk, Inc.

Terms of Service Privacy Statement Privacy Legal Notices & Trademarks


(http://usa.autodesk.com/adsk/servlet/item? (http://usa.autodesk.com/adsk/servlet/item? settings (http://usa.autodesk.com/legal-notices-
siteID=123112&id=21959721) siteID=123112&id=21292079) | trademarks/)
| |
(http://www.autodesk.com)

You might also like