The Magpi - February 2014 (issue 20), The MagPi, The MagPi 2014

[ Pobierz całość w formacie PDF ]
I
ISSUE20
-
-FEB2014
G
e
e
t
tp
r
r
i
in
t
t
e
ed
c
cop
i
i
e
e
s
s
a
a
t
t
t
th
e
em
a
agp
i
i
.
.
c
com
A Magazine for Raspberry Pi Users
ResolveCableModem'Flap'
EnvironmentalMonitor
PanoramicPhotos
R
e
emo
t
t
e
eS
e
en
s
s
i
ing
Qu
a
ad
c
cop
t
t
e
e
r
r
Scratch
I
I
/
/O
B
a
a
r
r
e
eM
e
e
t
t
a
a
l
l
A
l
lgo
i
id
P
i
iBOX
R
a
a
s
spb
e
e
r
r
r
r
y
yP
i
iho
s
s
t
t
i
ing
Wina
GEEKcase,
PiNoIRcamera,
GPIOCobbler,
2SDcards
&more
R
a
a
s
spb
e
e
r
r
r
r
y
yP
i
i
i
i
s
s
a
a
t
t
r
r
a
ad
e
em
a
a
r
r
k
ko
f
fTh
e
eR
a
a
s
spb
e
e
r
r
r
r
y
yP
i
iFound
a
a
t
t
i
ion
.
.
Th
i
i
s
sm
a
ag
a
a
z
z
i
in
e
ew
a
a
s
s
c
c
r
r
e
e
a
a
t
t
e
edu
s
s
i
ing
a
aR
a
a
s
spb
e
e
r
r
r
r
y
yP
i
i
c
compu
t
t
e
e
r
r
.
.
h
t
t
t
tp
:
:
/
/
/
/www
.
.
t
th
e
em
a
agp
i
i
.
.
c
com
20
Welcome to Issue 20 of The MagPi magazine. It’s a brand new year and we can’t wait to see
what is in store for the Raspberry Pi over the next 1 2 months.
After a massive response, we are pleased to write that the article series ‘Bake your own Pi filling’ is
back by popular demand! In this article Martin Kalitis throws down the gauntlet by instructing how to
create a bootable Linux SD card which can load within 1 0 seconds.
We have more from the Caribbean with Project Curacao. This project has been so popular with our
readers that John Shovic is extending it further, in a future issue, with a conclusion presenting the
project's results. In this issue John reviews the building and installation of the camera and shutter
mount into the project, allowing the production of timed photos, before updating us on changes made to
the project from past articles.
Deepak Patil introduces his project for panoramic photography using Pi-Pan, a robotic arm controlled
by his Raspberry Pi to move his Pi Camera. Deepak looks at some of the code used to control this
clever kit and discusses how to take pictures while out in your car.
We have more from Andy Baker’s Quadcopter series with this issue reviewing his pre-flight checks. His
article looks at controlling the movement of the Quadcopter and provides some handy questions and
answers for those of you who have been building this project.
We have a great article detailing John Hobson’s and Efrain Olivares’ journey into managing the
frustrating problem of internet dropout. We then head over to France where Yann Caron presents his
development environment and language ‘Algoid’, before the NanoXion chaps present their Raspberry Pi
colocation service.
As always, we keep you updated with the latest
Raspberry Pi book reviews and upcoming events.
Let's begin...
Chief Editor of The MagPi
The MagPi Team
Ash Stone - Chief Editor / Administration / Layout
W.H. Bell - Issue Editor / Layout / Grapics / Administration
Bryan Butler - Page Design / Graphics
Ian McAlpine - Layout / Proof Reading
Matt Judge - Website / Administration
Aaron Shaw - Layout / Proof Reading
Colin Deady - Layout / Proof Reading
Chris 'tzj' Stagg - Graphics
Claire Price - Layout / Proof Reading
Amy-Clare Martin - Layout
Nigel Curtis - Proof Reading
Bulent Tuncel - Layout / Testing / Proof Reading
James Nelson - Testing / Proof Reading
Age-Jan (John) Stap - Layout
2
Contents
PROJECT CURACAO: REMOTE SENSOR MONITORING IN THE CARIBBEAN
Part 3: The camera subsystem
4
PROGRAMMING FOR PI-PAN
8
A pan and tilt control for your Raspberry Pi camera
QUADCOPTER
10
Part 2: Pre-flight checks
ENVIRONMENTAL MONITOR
Part 2: Using the Google Chart library to visualise data
16
COMPETITION
19
Win a Pi NoIR camera, GPIO breakout, gigabit hub, two SD cards and more
CABLE MODEM
20
Using a Raspberry Pi to automatically restore a lost internet connection
RACKS OF PI
Colocating Raspberry Pi's in France
26
THIS MONTH'S EVENTS GUIDE
Cambridge UK, Malvern UK, Mountain View California USA, Manchester UK, Southend-on-Sea UK
29
ALGOID
30
Programming made simple and fun
THE SCRATCH PATCH
36
Flexible I/O: using GPIO, SPI, files & more
MY OS: BUILD A CUSTOMISED OPERATING SYSTEM
40
Part 2: Bake your own Pi filling - build tools and more
BOOK REVIEWS
43
Python in Easy Steps and Raspberry Pi Networking Cookbook
FEEDBACK
44
Have your say about The MagPi
3
PROJECTCURACAO
Remote sensor monitoring in the Caribbean
Part3:Thecamerasubsystem
JohnShovic
Guest Writer
SKILLLEVEL:INTERMEDIATE
WhatisProjectCuracao?
Systemdescription
This is the third part of a series discussing the
design and building of Project Curacao, a sensor
filled project that will hang on a radio tower on the
island nation of Curacao. Curacao is a desert
island 1 2 degrees north of the equator in the
Caribbean. Originally intended for four issues this
series will now be extended to cover the results of
the installation in a later issue of The MagPi.
Project Curacao consists of four subsystems. A
Raspberry Pi Model A is the brains and the overall
controller. The Power Subsystem was described in
part 1 and the Environmental Sensor Subsystem
was described in part 2. The Camera Subsystem
consists of a Raspberry Pi Camera and a servo
motor that opens and closes a "shutter" that is
intended to keep salt spray and dirt from coating
the plexiglass over the camera.
Project Curacao is designed to monitor the local
environment unattended for six months. It operates
on solar power cells and will communicate with the
designer via an iPad App called RasPiConnect. All
aspects of this project are designed to be
monitored remotely. Below is a picture of the tower
where it will be installed in March 201 4.
4
What hardware will be used?
it and went back to raspistill (as above) because of
a GPIO line conflict with the RPIO GPIO library.
We wanted to use the RPIO library because it
supports DMA (Direct Memory Address - this
means it works with no intervention from the CPU,
thus multitasking has no effect) driven PWM (Pulse
Width Modulation) for the servo motor, but it is
NOT compatible with picamera.
1 Raspberry Pi Camera
1 Adafruit Analog Feedback Servo Motor
1 Adafruit ADS1 01 5 1 2-Bit ADC - 4 Channel I2C
1 Tidy Cat plastic lid for shutter
Camera and Shutter Mount
We assembled the camera mount from soft plastic
and superglue. It was designed to sit just under
the plexiglass. Initially, we tried to mount it on top
of the plexiglass, but had a very difficult time with
the short fragile cable to the Raspberry Pi. The
shutter and the servo motor completes the device.
We uninstalled the RPIO library and put the latest
RPi.GPIO library back in and used their software
based PWM. While it is jittery (because of the
multi-tasking Linux on the Raspberry Pi), we are
using a servo with a feedback potentiometer for
position feedback. We check the shutter position
after using the RPi.GPIO PWM library by
performing an A/D conversion of the pot voltage
using the ADS1 05. We can then see the position
of the servo and run the PWM again until it is within
the bounds of the shutter being open or closed.
With this feedback, we can accurately position the
shutter even with the jittery response due to multi-
tasking.
Timed Photos
Currently, the Project Curacao main software
(described in the upcoming part 4), takes a picture
every hour and on demand from the control
program RasPiConnect. We can even email
pictures on demand using our control panel. A
crontab entry transfers the latest picture to a server
in the US using scp so we have a
prototype external webpage showing
the current status of Project Curacao.
The webpage is being hosted by our
good friends at MiloCreek (developer
of RasPiConnect) and the address is:
aphs
.
Camera Software
The Pi Camera software turned out to be quite
simple. The important part of the Python module to
take a picture turned out to be only a few lines:
def takePicture(source):
# take picture
print "taking picture"
output = subprocess.check_output ("raspistill -o
/home/pi/RasPiConnectServer/static/picameraraw.jpg
-t 0",shell=True, stderr=subprocess.STDOUT )
output = subprocess.check_output("convert
'/home/pi/RasPiConnectServer/static/picameraraw.jpg
' -pointsize 72 -fill white -gravity SouthWest
-annotate +50+100 'ProjectCuracao
%[exif:DateTimeOriginal]'
'/home/pi/RasPiConnectServer/static/picamera.jpg'",
shell=True, stderr=subprocess.STDOUT)
Future functions
We are planning to add three
additional features to the Camera
Subsystem. These are time lapse
photography, a short video on demand
and a streaming video interface. A big
unknown for the streaming video
interface is the amount of bandwidth
available for uploading data in Curacao. We know
that it is an ADSL modem, but we don't know the
parameters on the upload speeds.
pclogging.log(pclogging.INFO, __name__, source )
print "finished taking picture"
return
We started out using the picamera library
) because it
was pure Python and feature heavy. We removed
5
[ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • shinnobi.opx.pl
  •