RasPi Magazine 09.pdf

(9729 KB) Pobierz
ESIGN
D
UILD
B
CODE
9
Welcome
Unless you’ve got a Jam to go
to, mornings can be tough.
Get your Raspberry Pi involved,
though, and all of a sudden
you can freshen up your wake-up and start
your day properly with an alarm clock that’s
personalised to suit your routine. Need a
17-minute snooze? No problem. Only wake up
to the sound of singing narwhals? That’s fine
too. Swipe forward a few pages to crack on.
This issue we’re also getting you started with
servos, now that you’ve mastered the GPIO
ports, as well as casting a critical eye over the
biggest distros for your Raspberry Pi to find
out which OS is best. And if you’re using an
older Pi with just a couple of USB ports, you’ll
love our keyboard and mouse guide.
Get inspired
Discover the RasPi
community’s best projects
Expert advice
Got a question? Get in touch
and we’ll give you a hand
Easy-to-follow
guides
Learn to make and code
gadgets with Raspberry Pi
Deputy Editor
From the makers of
Join the conversation at…
@linuxusermag
Linux User & Developer
D
RasPi@imagine-publishing.co.uk
as imagine p
Contents
Smart alarm clock
Waking up is easy when you have Pi
Share your keyboard & mouse
Use your peripherals on multiple machines
DiceBot
Meet the tweeting dice roller
Raspberry Pi OS super test
Is Raspbian really the best distro for your Pi?
Control servos
Get your projects moving
Science on Raspberry Pi
Start using numpy and scipy today
Talking Pi
Your questions answered, your opinions shared
Smart alarm clock
Turn your Raspberry Pi into a better alarm clock using
Python and a single button
Advancements in alarm clock technology are
hardly exciting news reports you’d see on the
ten o’clock news but it’s something very real
in this day and age. Anyone with a smartphone has
access to a world of apps tailored to helping users get a
better night’s sleep, through sleep-cycle sensing and a
gradually increasing alarm volume to softly wake them
up. If you don’t have a smartphone or find the current
selection too limited, you can always make your own
smart alarm clock using a Raspberry Pi. In this tutorial
we’ll show you how to program the Pi to play a bit of
white noise, use a custom alarm sound and have it
wake you gently.
THE PROJECT
ESSENTIALS
Speakers or some form
of audio output
Push-button switch
Clock case
01
Update your Pi
To make sure the Raspberry Pi will work as expected,
it’s best to get it updated first of all. Do this with:
Breadboards
are excellent for
prototyping circuits
but if you want to
start keeping your Pi
by your bed, it might
be better to get a
case and lose the
breadboard. As the
wiring is very simple,
you could easily
solder it up and
connect it to the GPIO
ports directly. Drilling
a hole in a case will
keep everything tidy.
sudo apt-get update && sudo apt-get upgrade
This will also mean that when installing new software
the latest version is installed as well.
02
Install audio playback
For this tutorial, we’ll be using VLC to playback the white
noise and the alarm sound. It can be used quite easily
by Python for the tasks we want it to perform. Install it in
the terminal using:
$ sudo apt-get install vlc
“The
alarm clock will also support playlists if
you prefer listening to music”
Zgłoś jeśli naruszono regulamin