Smart Home Security Camera

This post explains the technical background of the security camera system, shown in the following movie. The post will answer the questions: How to detect a thief, how to take a photo, how to get notifications on your phone, and whether the system would work in reality.

For cutting the movie I made use of iMovie.
iMovie was used for editing.

Links and Quick Facts

The source code is not publicly accessible. For the development I used this configuration.
Buy the system for your home / shed / garage.
Movie background music: LCMC music
Additional information about me.

Technical Details

How to Detect a Thief?

In order to detect a thief I made use of an acceleration sensor that I placed at the apartment’s door. The sensor listens for significant changes in the measured x-acceleration. This technique was so precise, that even the slightest knock triggered the motion detection.

bool motionDetected(float tolerance) {
  readMPU6050SensorData(&mpu6050Data, MPU_addr);
  int16_t accX = mpu6050Data.acceleration.x;
  return (accX > boundaries.max + delta * tolerance || 
    accX < boundaries.min - delta * tolerance);
}

Continue reading “Smart Home Security Camera”

Install Node SerialPort on Raspberry Pi

Since I had a lot of trouble installing the npm package serialport on my Raspberry Pi B Rev 1 (and Rev 3), I want to share how it eventually worked.

When installing serialport I ran into a lot of errors.
When trying to install using npm install serialport you might see those errors.

Enable serial port usage by adding  enable_uart=1 to the file /boot/config.txt.

If the normal  npm install serialport doesn’t work for you try the following.

Install Node 6.x

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs 
sudo apt-get install -y build-essential

Install node-gyp and node-pre-gyp globally Continue reading “Install Node SerialPort on Raspberry Pi”

Die drei ??? Telegram Bot

Since the publisher Europa uploads new Die drei ??? episodes on Spotify quite frequently, I have been wanting to get an update every time they upload something new. For me the most convenient way to be notified is to get a message on my smartphone. The free messenger Telegram is predestinated for that task because of its open API and bot capabilities.

A bot is like a Telegram user. The only difference: You are not chatting with a person but a program that is running on a server somewhere else. For my bot that is a Node.js script, being executed on my Raspberry Pi.

How does it Work?

To get updates you have to search for the bot on Telegram (the name is @DieDreiFragezeichenBot) or click on that link: @DieDreiFragezeichenBot

Then you have to subscribe by writing /start. The bot will respond with a success message. Now you are on a list of subscribed clients and the next time the bot detects new episodes, you will get an update pretty much like that:

Once there are new episodes you'll get an instant update.
Once there are new episodes you will get an instant update.
The bot just looks like a normal chat partner.
The bot just looks like a normal chat partner.

Continue reading “Die drei ??? Telegram Bot”

Node.js: Develop on Mac, Run on Raspberry Pi

For me the solution for productive Node.js development on Mac, with code execution on a Raspberry Pi was usage of Samba. After following the steps you will be able to develop Node.js applications right on your Mac, execute them on your Raspberry Pi (just by pressing cmd+S) and see the console output and errors on your Mac, without much hassle. This tutorial covers the entire setup.

Login to your router interface and assign a static IP address to your Raspberry Pi’s MAC address (e.g. 192.168.0.120). The router menus differ from each other, if you have trouble check the router manual.

IP Address Reservation Router Interface

Then connect to your Raspberry Pi via Secure Shell (SSH) from your Mac.

ssh pi@192.168.0.120

Install Node.js and the npm packet manager on the Raspberry Pi.

apt-get upgrade
apt-get update

apt-get install nodejs npm
ln -s /usr/bin/nodejs /usr/bin/node

Continue reading “Node.js: Develop on Mac, Run on Raspberry Pi”