# data[].attributes.headline
Building Smart Homes with Raspberry  Pi Zero

# data[].attributes.subject
Building Smart Homes with Raspberry  Pi Zero

# data[].attributes.body
https://subscription.packtpub.com/book/hardware_and_creative/9781786466952/10/ch10lvl1sec56/hardware-and-software-requirements

# data[].attributes.attachment_link.readable_text
This website uses cookies and other tracking technology to analyse traffic, personalise ads and learn how we can improve the experience for our visitors and customers. We may also share information with trusted third-party providers. For an optimal-browsing experience please click 'Accept'. Learn more

You're currently viewing a course logged out. Sign in to your account or start a FREE trial.

Hardware and software requirements

As always, we are going to start with a list of required hardware and software components for the project. We are going to use four modules in total: a sensor module, an appliance control module, a motion sensor module, and a camera module.

Of course, you will need one Raspberry Pi Zero board for each module you use, along with supporting components, such as SD cards and power supplies. If you plan to run the central interface on a Raspberry Pi Zero as well, you will need an additional Pi Zero board.

For the sensors module, we'll use a simple DHT11 sensor, along with a 4.7k Ohm resistor.

For the appliance control module, we'll use the PowerSwitch Tail Kit that we already used in several chapters of this book.

For the motion sensor module, we'll use a simple PIR motion sensor.

For the camera module, we are going to use the C270 HD camera from Logitech. However, you can use any USB camera here.

You will also need the usual breadboard and jumper wires.

This is the...

Get quickly up to speed on the latest tech

Packt gives you instant online access to a library of over 7,500+ practical eBooks and videos, constantly updated with the latest in tech.

Start a FREE 10-day trial

Something went wrong, please check your internet connection and try again...

Retry

# data[].attributes.attachment_link.title
Hardware and software requirements - Building Smart Homes with Raspberry Pi Zero

# data[].attributes.attachment_link.description
This website uses cookies and other tracking technology to analyse traffic, personalise ads and learn how we can improve the experience for our visitors and customers. We may also share information with trusted third-party providers. For an optimal-browsing experience please click 'Accept'. Learn more You're currently viewing a course logged out.

# data[].attributes.body
https://catedu.gitbooks.io/monta-tu-aula-de-informatica-con-raspberry-pi/content/

# data[].attributes.attachment_link.title
Introducción · Monta tu aula de informática con Raspberry Pi

# data[].attributes.attachment_link.description
El boom de los dispositivos móviles supuso de nuevo un paso de gigante en este camino, sembrando el terreno para que aflorara todo un ecosistema de Apps y soluciones basadas en la web. Esto ha hecho que poco a poco las prioridades hayan ido cambiando.

# data[].attributes.body
Aula de informática con Raspberry, usandolo como terminal tonto http://pinet.org.uk/

# data[].attributes.body
https://www.raspberrypi.org/magpi/

# data[].attributes.body
¡¡ Son de Zaragoza !!!

# data[].attributes.attachment_link.title
Raspberry Pi to Arduino Shields Connection Bridge

# data[].attributes.attachment_link.description
The idea behind the Raspberry Pi to Arduino shields connection bridge is to allow to use shields, boards and modules designed for Arduino in Raspberry Pi.

# data[].attributes.body
https://www.raspberrypi.org/education/

# data[].attributes.attachment_link.readable_text
Computing is a vital aspect of today's world. We want to empower teachers to give young people the skills they need to shape this world.

That's why we provide high-quality CPD training courses, classroom resources, and online events for teachers. All for free.

# data[].attributes.attachment_link.title
Teach computing and digital making - Raspberry Pi

# data[].attributes.attachment_link.description
Computing is a vital aspect of today's world. We want to empower teachers to give young people the skills they need to shape this world. That's why we provide high-quality CPD training courses, classroom resources, and online events for teachers. All for free.

# data[].attributes.body
https://hipertextual.com/2013/02/minecraft-pi-edition

# data[].attributes.body
https://legacy.gitbook.com/book/catedu/introduccion-a-python/details

# data[].attributes.body
https://legacy.gitbook.com/book/catedu/scratch-avanzado-y-makey-makey/details

# data[].attributes.body
https://legacy.gitbook.com/book/catedu/ensena-pensamiento-computacional-con-scratch/details

# data[].attributes.body
Gamificación en la escuela

# data[].attributes.attachment_link.description
Kano is the most simple and fun way to learn to code, and make your own technology. Kits and more for all ages.

# data[].attributes.body
https://www.dexterindustries.com/gopigo3/

# data[].attributes.attachment_link.title
2018-10-15 14_03_28-GoPiGo3 is a Raspberry Pi Robot Car for Learning Coding

# data[].attributes.body
https://www.seeedstudio.com/GrovePi-p-2241.html

# data[].attributes.body
https://legacy.gitbook.com/book/catedu/alphabot/details

# data[].attributes.body
https://legacy.gitbook.com/book/catedu/pibrella/details

# data[].attributes.body
https://www.dexterindustries.com/new-brickpi3-lego-mindstorms/

# data[].attributes.attachment_link.readable_text
Happy Pi Day! After a long wait, we are pleased to announce the release of RetroPie 4.8. The RetroPie 4.8 images are built on the latest version of the Raspberry Pi OS Lite Buster (which is now their legacy release). This image supports the latest Raspberry Pi Zero 2 W...

Thanks very much to Vilros who are generously making a donation to the RetroPie project for every Raspberry Pi gaming kit they sell. Vilros was founded in 2010 with the goal of helping to create a more technological society. They are passionate about promoting STEM education and making it easily...

TL;DR The ControlBlock provides a soft power switch and status indication functionality, as well as an easy-to-use interface for original and arcade game controllers. It has been updated now with a dedicated power switch IC to provide all the power that you need for your retro project. Also, it comes...

RetroPie 4.7.1 images are now available from the Download Page. Unfortunately a couple of bugs crept into the EmulationStation front-end for the 4.7 release. A performance issue causing EmulationStation to have a poor frame rate and a bug affecting its built in scrapers. The performance issue affected Raspberry Pi 0/1/2/3...

# data[].attributes.attachment_link.readable_text
Al final he caído, ya he puesto un emulador a funcionar en mi Raspberry Pi B+. Primero lo intenté con el que recomiendan por todas partes: RETROPIE de petRockBlog | Fun stuff for technics enthusiasts Pero había tantas opciones y tanto por configurar que al final .... NO CONSEGUÍ QUE FUNCIONARA!!!

Después de intentarlo durante una tarde laaaaaarga entera, decidí desistir y buscar otra versión, así que mirando entre otras posibles elegí: recalbox.com

A lo que vamos, hubo que hacer una pequeña inversión en mandos. Yo compré una copia barata de los originales de SuperNES, ya que los iba a usar con una Raspberry Pi B+, no un modelo nuevo Raspberry Pi 2, y conociendo que es más corta de potencia no esperaba emular ni PSX ni Nintendo64. Además de los mandos necesité un teclado, algo que no esperaba pero es que no hay otra forma de resetear la consola que no sea dándole a la tecla Escape. La lista de la compra es:

OJO no es necesario usar ningún programa para guardar el ZIP como imagen al estilo Raspbian, solo hay que descomprimir el contenido del ZIP en la microSD formateada normalmente con Windows. Al iniciar Recalbox por primera vez se reformatea y particiona todo automáticamente.

La instalación es al estilo NOOBS con la SD en un PC normal copias, nada de flashear ni de usar imágenes, copias los archivos del ZIP en la microSD. Los puedes descargar desde la web de Recalbox: recalbox.com y allí concretamente vamos a Releases · recalbox/recalbox-os · GitHub y al hacer click sobre la última versión disponible ya nos aparecen las opciones de descarga: en concreto será la primera con extensión ZIP

Una vez copiado en la SD la insertamos en la Raspberry Pi. Al conectarla a la fuente de alimentación ya se termina de instalar y configurar.

Cuando todo esté listo reiniciamos con los mandos conectados y lo primero que nos pedirá será la configuración de éstos. Para ello vamos pulsando el botón que nos diga. Si no lo tenemos, mantenemos uno cualquiera pulsado hasta que se salte al siguiente. Con un mando al menos funcionando lo mejor es entrar ya en la configuración. Allí buscar la opción del idioma para ponerlo en Español. A partir de ahí seguir configurando el resto.

Una vez que esté configurado el idioma, ya podéis ir comprobando el rendimiento. Esta versión viene con varios juegos gratuitos y libres. Si luego queréis añadir más, una de las opciones es conectaros a la Recalbox por red ya que automáticamente crea una carpeta compartida con usuario root y contraseña recalboxroot donde hay una subcarpeta denominada ROMS y donde a su vez hay otras con el nombre de cada consola compatible. Copiando allí a través de la red vuestros juegos, estarán disponibles la próxima vez que reiniciéis.

Como extra deciros que también incluye Kodi al completo. Así que tenéis listo el emulador y el media center en una solo tacada.

Os dejo con un enlace la manual en español que me han indicado en los comentarios. Gracias Dragda

# data[].attributes.attachment_link.title
Recalbox emulación y retro gaming para torpes

# data[].attributes.attachment_link.description
Al final he caído, ya he puesto un emulador a funcionar en mi Raspberry Pi B+. Primero lo intenté con el que recomiendan por todas partes: RETROPIE de petRockBlog | Fun stuff for technics enthusiasts Pero había tantas opciones y tanto por configurar que al final .... NO CONSEGUÍ QUE FUNCIONARA!!!

# data[].attributes.attachment_link.readable_text
Vamos a darle un uso adicional a la Raspberry Pi además de servidor de ficheros y NAS casero. Se trata de montar un d escargador de torrents. Para ello vamos a instalar Transmission en su versión más ligera y sin entorno gráfico y luego veremos como usarla desde un móvil Android o desde cualquier equipo que tenga un navegador web ( Safari desde iPhone, Mac o iPad, Chrome, Firefox, etc.)

Antes de instalar nada, como siempre actualizamos todo:

sudo apt-get update
sudo apt-get upgrade
sudo rpi-update

Después de este último es probable que tengamos que reiniciar

sudo reboot

Antes de instalar os voy a recordar todo lo que yo considero necesario para poder hacerlo como yo:

1. Instalar el sistema operativo Raspbian en la Raspberry Pi, ya sea directamente o a través de NOOBS

2. Configurar Raspbian con raspi-config después de instalarlo

3. Actualizar Raspbian y actualizar los drivers y firmware

4. Poner la dirección IP fija

5. Formatear el disco duro o memoria USB en formato ext4 solo para Linux

6. Configurar la Raspberry para poder usar el nuevo disco duro

7. Es conveniente saber un poco como manejar la Terminal para hacer la instalación

También puedes necesitar un Video Converter con aceleración de hardware

Ahora sí que sí:

sudo apt-get install transmission-daemon

Y ahora dependiendo de lo que tengamos instalado, nos instalará cosas adicionales, entre las que con casi total seguridad estarán transmission-cli y transmission-common.

Al terminar de instalarse se configura más o menos y empieza a funcionar. Así que ahora nosotros paramos el servidor de torrents.

sudo service transmission-daemon stop

Y ahora como siempre y para prevenir hacemos una copia de seguridad del fichero de configuración. Luego comprobamos que se ha copiado.

sudo cp /etc/transmission-daemon/settings.json transmission-old-settings.json
ls

Y ahora como siempre editamos con nano recordando lo siguiente:

Se abre un fichero de texto con muchas líneas que no es necesario casi tocar. La aplicación que se llama nano es un editor muy básico pero más o menos sencillo de manejar. Con los cursores, las teclas de las flechas, nos movemos hasta las siguientes líneas para modificarlos.

Para Guardar el archivo con los cambios pulsar la tecla Ctrl y al mismo tiempo la letra o

Para Salir del editor pulsar la tecla Ctrl y al mismo tiempo la letra x

Si nos pregunta si queremos salvar los cambios y nos indica el nombre del fichero le decimos que Sí escribiendo una letra S y dándole a Enter / Return / Intro

...
"download-dir": "/media/16GB",
...
...
"incomplete-dir": "/media/16GB/temp",
"incomplete-dir-enabled": true,
...

Estas carpetas las creamos con anterioridad y están en un disco externo con el formato y permisos de escrituras adecuados. Si no las tenéis, o tienen otros nombres deberéis cambiarlos.

Ahora cambiamos el tema de la seguridad poniendo un nombre de usuario, el que viene es transmission, añadiendo una contraseña y permitiendo el acceso de un usuario externo a la Rasperry Pi pero dentro de nuestra red local y usando la dirección IP fija.

...
"rpc-password": "mi contraseña",
...
"rpc-username": "mi usario",
...
"rpc-whitelist-enabled": false,
...

Y salimos de nano y desde fuera en la Terminal volvemos a reiniciar el servidor de torrents

sudo service transmission-daemon restart

Si aún así tenemos algún problema con los permisos de las carpetas volvemos a asignar permiso de escritura para todos. Para ello usamos los comandos siguientes en una Terminal

sudo service transmission-daemon stop
sudo chmod 777 /media/16GB/
sudo chmod 777 /media/16GB/temp/
sudo /etc/init.d/transmission-daemon restart

Controlar Transmission desde Android

Ahora vemos como acceder por ejemplo configurando Remote Transmission para Android

Y descargando un torrent desde el Chrome en Android que al abrirse se nos redirige directamente a la Raspberry siempre que estemos en la misma red local.

Igualmente lo podemos abrir desde el navegado web, usando la dirección IP fija de la Raspberry Pi seguida de :9091

Si vemos cómo marcha la descarga vía web y confirmamos uso de RAM y procesador con htop y pcmanfm a través de la opción de Exportar las X, vemos como aún hay margen para que la Raspberry Pi esté al 100% de carga

Y eso es todo, solo una recomendación final. El uso del descargador de Torrents debe ser legal en vuestros países de residencia. Además de respetar los derechos de autor y la propiedad intelectual. Como uso legal que se puede ver en estas pantallas de ejemplo está la descarga del sistema operativo de la Raspberry Pi o de armbian:

# data[].attributes.attachment_link.title
Instalar y configurar un descargador de torrents | transmission

# data[].attributes.attachment_link.description
Vamos a darle un uso adicional a la Raspberry Pi además de servidor de ficheros y NAS casero. Se trata de montar un d escargador de torrents. Para ello vamos a instalar Transmission en su versión más ligera y sin entorno gráfico y luego veremos como usarla desde un móvil Android o desde cualquier equipo que tenga un navegador web ( Safari desde iPhone, Mac o iPad, Chrome, Firefox, etc.)

# data[].attributes.attachment_link.readable_text
Update 06 Aug 2018: In case you are interested, I've just published a new blog about creating an AI powered security camera using the Raspberry Pi and Movidius Neural Compute Stick!

Introduction and Motivation for Project

Recently my wife and I suspected that some unwanted guests had been visiting our garden. After a discussion we decided that we needed a motion activated camera that could send us emails once it detected movement. We also wanted the ability to view the live video stream from the camera on demand.

As a fully fledged Raspberry Pi geek I knew right away that I wanted to build my own solution. My wife was not so convinced, and starting listing the dozens of unfinished projects I currently have on my backlog. After promising her that I would see this project through to the bitter end I finally got permission to build a proof of concept :)

This project required no coding, but quite a bit of configuration. It took about 6-7 hours to complete once I had the parts in place. I spent most of this time wrestling with Linux and this blog will hopefully help anyone attempting a similar project.

Hardware

To reduce the projects overall complexity I decided that the camera would be mounted inside our living room. This meant that the unit could be powered from the mains, and would be protected from the harsh Norwegian weather.

Below is a full list of the parts I used, along with current prices. I already had some of these parts laying around from previous projects, so my total project cost came up to about $40. If you need to purchase all of the below parts then I would suggest shopping around and looking into Pi Zero starter kits to keep your costs low.

Some notes about some of the specific parts:

The Combined WiFi Dongle and USB Hub has two USB ports, allowing me to connect a keyboard and optionally a mouse when setting up the Pi Zero for the first time. The Pi Zero has only one mini USB port available, so this dongle is a worthwhile investment for the most Pi Zero projects. Edit August 2017: The new Pi Zero model (Pi Zero W) has added WiFi support. This costs slightly more than the standard Pi Zero, but removes the need for a WiFi dongle.

I chose the Raspberry Pi NoIR Camera rather than the standard model as the NoIR can work in low light conditions (you'll add need to add infrared lighting for this camera to perform well at night time). Edit March 2017: It's important to add that here the standard Raspberry Pi Camera provides better picture quality, so you'll need to think about your use case before buying.

The ZeroView Camera Mount allowed for easy mounting of the camera and Pi Zero on the inside of my terrace window. It is a mount, not a case, and is not suitable for outside usage.

If you struggle to pick up the Raspberry Pi Zero you can always use a Raspberry Pi Model 2 or 3. Both have CSI and USB ports and the Model 3 even has built-in WiFi. If you choose to do this you will want to reevaluate using the ZeroView Camera Mount.

Once I had all the pieces in place it took less than 10 minutes to put my prototype together.

Assembled prototype mounted on the ZeroView with the USB Hub / WiFi dongle attached

Rear view of the assembled prototype - missing only the power cable

Configuring the Pi Zero

After assembling the parts I connected a keyboard and monitor to the USB Hub and switched on the Pi Zero. After booting I installed Raspian Jessie 4.4 from NOOBS.
Edit August 2017: A new version of Raspian - Raspian Stretch has just been released. This should work just as well as Jessie, but note that I haven't yet tested it with Motion.
I configured the Pi Zero as follows, with frequent reboots underway...

From the terminal window run the command:

sudo raspi-config

This will open the Raspberry Pi Configuration tool, from which you should do the following:

Enable the Camera.

Enable the ssh server (you'll need this later on to connect to Pi Zero in headless mode - i.e. without a monitor and keyboard attached).

Enable boot to command line without manual login.

At the terminal prompt type enter:

passwd

to change your password from the default. This will prevent tech savvy intruders from connecting to your Pi Zero using ssh and the default login and password.

Next you should set up a static IP address for your Pi Zero. This will make it easier for you to connect to your Pi Zero and to expose it outside of your home network via port forwarding. You can validate that your static IP address is working by connecting to your Pi Zero via ssh.

Now that you are connecting to the web, you can update Raspian Jessie by running:

sudo apt-get update
sudo apt-get dist-upgrade

If you forget to do this then I can promise that you will have problems later on!

Finally, Validate that your Raspberry Pi Camera is working. If you experience any problems, check the ribbon cable between the Pi Zero and camera - it can easily be dislodged.

Once all the above is done you can disconnect the monitor and keyboard and connect to the Pi Zero via ssh to complete the rest of the below steps.

Choosing Motion for the Camera Software

My next step was to choose a software solution for my security camera. My requirements were as follows:

Streaming video - so that I could check the video feed at will.

Motion detection and the ability to trigger events - so that I could send myself an email for each motion event.

Small footprint - due to the size of the SD card (8GB).

Low memory overhead - due to the capacity of the Pi Zero.

Linux compatible (well duh).

Compatible with the Raspberry Pi Camera (MMAL).

Configurable - allowing one to tweak the software to get the most out of the hardware.

I choose Motion as it fulfills the above requirements out of the box with no additional coding. I also considered using the marvellous OpenCV, but felt that I would have spent more time having to tweak it to fulfill my needs.

Motion monitors an incoming camera stream and detects 'motion' by finding the pixel values that have changed from frame to frame. If a threshold (i.e. total pixels changed) is exceeded then Motion triggers a "motion detected" event and optionally creates a snapshot of the video stream. Motion includes an inbuilt webserver offering both a video stream and online configuration on the fly.

Installing Motion

Important: before installing Motion you must have updated Raspian Jessie by running the ' sudo apt-get update' and ' sudo apt-get dist-upgrade' commands.

To work with the Pi Camera you need a special version of Motion that supports MMAL cameras. The easiest way to install this is by downloading and installing a deb file as follows:

1. First get the deb file with the following command (if this doesn't work then have a look for the correct release file on the Motion project GitHub). Edit August 2017: If you are using Raspian Stretch then use the pi_stretch_motion_4.0.1-1_armhf.deb file when installing Motion. For example to get the deb file for Raspian Jessie:

wgetgithub.com/Motion-Project/motion/releases/download/release-4.0.1/pi_jessie_motion_4.0.1-1_armhf.deb

2. Install the gdebi tool as follows:

sudo apt-get install gdebi-core

3. Install Motion using the gdebi tool (allow it to also install the minimal web server):
sudo gdebi pi_jessie_motion_4.0.1-1_armhf.deb

4. Create a hidden folder in your home directory:

mkdir ~/.motion

5. Copy the original Motion config file to your new .motion directory. This ensures that the original config file doesn't get ruined (and can be used to return Motion to it's 'factory settings').

cp /etc/motion/motion.conf ~/.motion/motion.conf

Configuring Motion

Don't bother trying to run Motion yet as it won't work until you've updated the configuration file :)

You can open the configuration file in edit mode by entering:

sudo nano ~/.motion/motion.conf

Nano is a simple Linux text editor allowing you to edit and search text files. Feel free to use an alternative text editor if you wish.

Below is a list of the parameters that I have tweaked for my setup. Consult the manual for comprehensive documentation of these and other Motion parameters. Note that the rest of these blog will assume that you have set these values as I have specified.

Feel free to play around with the configuration parameters to get a feel for what they do. Be careful to keep a record of the parameters you have changed, in case you mess up and need to start again. Remember that you always have a clean copy of the config file at /etc/motion/motion.conf.

Running Motion for the First Time

Now you are finally ready to run Motion for the first time! Use the following command to run Motion with your configuration file:

motion -c ~/.motion/motion.conf

While Motion starts up, key an eye out for any error messages that pop up. Problems can occur if your camera isn't correctly connected or if Motion lacks permissions to create image files.

Note that Motion occasionally fails to start up due to previous Motion processes that have failed to shut down properly and are running in the background. If you suspect this, try running the following:

ps aux | grep motion
sudo kill -9 [pid]

pid refers to the Process ID that you get from the ps aux command.

Once Motion is up and running you'll want to check out the video stream. To do this, you'll need the IP address of the Pi Zero along with the port specified by the stream_port parameter from the Motion config file. Go to the address:

http://[IPaddress]:[stream_port]

and you should see your video stream in the browser.

You can also access Motion's HTML control panel by changing the port to that specified by the webcontrol_port as specified in the Motion config file. Here you can change configuration options on the fly, stop and start Motion and even take snapshots.

Now you can test the motion detection. Movement in front of the camera should result in a still image being saved to the directory you specified for the target_dir. If this is working then your motion activated security camera is almost ready for use!

Adding Email Alerts

Our next job is to ensure that alert emails get sent from our Pi Zero. As with all things Linux there are many different ways to do this, but I found the following to work without issue.
Installing a Mail Client
For this solution you'll need a throwaway Gmail account, as you are going to specify your Gmail password in a configuration file.

Start by installing the tools you'll be using to send emails:

sudo apt-get install ssmtp
sudo apt-get install mailutils
sudo apt-get install mpack

Next, run:

sudo nano /etc/ssmtp/ssmtp.conf

and ensure that file contains the following configuration parameters, making sure that your Gmail account credentials are in place:

root=postmaster
mailhub=smtp.gmail.com:587
hostname=raspberrypi
AuthUser=yourgmailusername@gmail.com
AuthPass=yourgmailpassword
FromLineOverride=YES
UseSTARTTLS=YES

Finally send a test email with an attachment from the target_dir directory:

mpack -s "Test Email" [target_dir/filename] [recipientEmailAddress]

If this mail arrives you are good to go to the next step.
Configuring Motion to send Email
Here you'll need to make a small change to your Motion configuration file.

sudo nano ~/.motion/motion.conf

You'll be updating the on_picture_save parameter. Uncomment it and change it's value as follows (updating the recipientEmailAddress to the email at which you want to receive alerts):

mpack -s "Your Security Camera has detected Motion!" %f [recipientEmailAddress]

What happens here is that Motion will call this command each time a new image snapshot is saved to the target_dir directory. The %f variable contains the full path to the file.

Save the configuration file, restart Motion and voila! You should now be receiving email notifications each time Motion detects a motion event.

Housekeeping Functions
Ensuring Motion startups up on Reboot
The easiest way to ensure Motion starts up on reboot is to add it to the rc.local file. This is a simple as adding the following command - assuming that you have specified the configuration file as outlined in this blogpost:

motion -c ~/.motion/motion.conf
Removing old files
Over time there is a danger that your SD card will fill up with old images. Therefore I strongly recommend that you create an automated cronjob to periodically remove all images from the output directory specified in the Motions configuration (the value to the key ) .

Evaluating The Result - Did the Security Camera work?

So does my camera do the job it was meant to do? Definitely! Here are some examples of the alerts that I have been sent by the camera.

Examples of the camera successfully detecting humans in my garden

In addition the streaming video works perfectly, making it easy to check the video stream each time I get alerts. By setting port forwarding in my home router I have exposed the live stream to the web and can now view it from my iPhone.

The Camera is meant to run 24/7, and was recently up for 4 weeks without a single problem while myself and my family where on holiday in England. In addition to receiving alerts via email, we used the streaming video on a daily basis to see how the weather was in Oslo (and to check that my brother in law was watering the flowers as agreed).

There are many use cases for this kind of project. It can be used for wildlife watching, pet monitoring or even to tell you when your kids come home from school!
Minor Issues
I have two minor problems with the solution, which are both easily resolved:

1. The Pi NoIR camera works well in low light, but really needs an IR light source to perform at night. I haven't got around to picking one up yet, but they are easy to get hold of online.

2. The camera is mounted inside the house looking outwards.There is a small gap between the lens of the camera and the glass, which allows for reflections to appear when it is dark outside and the living room light is on. This can be resolved by placing some cardboard or tape around the edges of the ZeroView camera mount, which would stop the light pollution hitting the glass right in front of the camera.

Example of light pollution affecting the pictures from the Camera

Here you can make out the gap between the ZeroView/Camera and the glass window

Other Issues
A more difficult issue to resolve was that of false positives. The Motion software algorithm for detecting movement is based on the amount of pixels changing from frame to frame. In practice this meant that I received alerts when the neighbours cat paid us a visit, or on partly overcast days when the shadows in the garden quickly moved and changed. Rain running down the window was also an issue.

Example of false positive due to moving shadows

On some days I received 50 alert emails due to these false positives, which tended to undermine the usefulness of the camera. Motion allows you to tweak the amount of pixels needed to trigger an alert, but then you run the risk of making the camera less effective.

Conclusion and next steps

Over all I was very happy with the result. The camera worked as designed and satisfied our original requirements.

The false positives issue was the only real problem. I therefore decided to find a solution to this!

In my next blog post I show how I solved the problem of false positives by using Image Analysis and Amazon Web Services.

Until then, thanks for reading! If you have put together a similar project, or have any questions about this blog, or find any errors in the code then feel free to tweet me @markawest or post a comment below.

Edit Summary

Since I wrote this article, a few changes to the hardware and software have occurred. These are noted in the text and also summarised here:

Edit March 2017: It's important to add that here the standard Raspberry Pi Camera provides better picture quality, so you'll need to think about your use case before buying.

Edit August 2017: The new Pi Zero model (Pi Zero W) has added WiFi support. This costs slightly more than the standard Pi Zero, but removes the need for a WiFi dongle.

Edit August 2017: A new version of Raspian - Raspian Stretch has just been released. This should work just as well, but note that I haven't yet tested it.

Edit August 2017: If you are using Raspian Stretch then use the pi_stretch_motion_4.0.1-1_armhf.deb file when installing Motion. If you are using Raspian Jessie then use the pi_jessie_motion_4.0.1-1_armhf.deb file.

# data[].attributes.attachment_link.title
Building a Motion Activated Security Camera with the Raspberry Pi Zero

# data[].attributes.attachment_link.description
Update 06 Aug 2018: In case you are interested, I've just published a new blog about creating an AI powered security camera using the Raspberry Pi and Movidius Neural Compute Stick! Recently my wife and I suspected that some unwanted guests had been visiting our garden.

# data[].attributes.body
https://www.codeproject.com/Articles/665518/Raspberry-Pi-as-low-cost-HD-surveillance-camera