• Maker Space
  • My Blog

Part Time Maker

~ DIY – Home Automation System

Part Time Maker

Tag Archives: raspberry pi

Securing Raspberry Pi

28 Friday Feb 2020

Posted by parttimehacker in How to guides

≈ Leave a comment

Tags

guide, raspberry pi, security

This guide will walk you through a series of steps to configure really basic security for your Raspberry Pi.  First create a new user and remove the default pi account. 

Create a new user account

sudo useradd -m newuser -G sudo
sudo passwd newuser

Then ensure that the new newuser account uses bash. Simply add bin/bash to the newuser account if needed.

sudo vi /etc/passwd

Logout and login as newuser. Make sure everything works for the newuser and then remove pi account.

sudo deluser -remove-home pi

Install Firewall

Install the open source firewall and enable two ports. I like to enable secure shell access (ssh) and file access from my Mac laptop Apple Filing Protocol (AFP) over TCP.

sudo apt-get -y install ufw
sudo ufw allow 22
sudo ufw allow 548
sudo ufw enable
sudo ufw status

I do this for all of my Raspberry Pi servers. I’m sure more could be done but that’s for later post.

Do It Yourself Home Automation System

06 Friday Dec 2019

Posted by parttimehacker in How to guides

≈ Leave a comment

Tags

diyha, project, python, raspberry pi

The building blocks of my do it yourself home automation system (DIYHA) consists of nine elements:

  1. Adafruit.io host for dashboards, graphs, control buttons, data storage, etc.
  2. Alexa interface through the Fauxmo server which emulates a Belkin switch
  3. Mosquitto MQTT broker/bridge server handles local messaging and the bridge to Adafruit.io
  4. Environment sensor servers measuring temperature, humidity, air pressure, gas concentration, air quality and light lux
  5. Motion sensor servers for security applications and to activate or deactivate lights
  6. Administration server to manage configurations and coordinate activities between servers
  7. Alarm servers are an integral part of the security system, e.g., intruder alerts and fire alarms
  8. Lighting control servers that are controlled by Alexa or motion sensor
  9. iOS application to provide a mobile administration tool

Future posts will provide build instructions to create you own DIYHAS solution. The servers are all Raspberry Pi devices with applications written in Python 3 and the help from lots of great open source code. I’m planning to push all of my python source to github to coincide with posts.

Building a Do It Yourself Home Automation System

05 Thursday Dec 2019

Posted by parttimehacker in Uncategorized

≈ Leave a comment

Tags

project, python, raspberry pi

Welcome to my new home automation project site!

For the past four years I’ve been in a self-taught program to learn python, Raspberry Pi administration, the Internet of Things and basic digital electronics. Its really been an immersed in prototyping, discovery and testing a variety of solutions with a steep learning curve. Its been a blast!

I’m ready to start version 2.0 of my do it yourself home automation system. Over the next  couple of months I will post entries on how to build a custom home automation system with security, environment monitoring, video surveillance, lighting controls, Alexa integration and more. Please stay tuned.

 

Raspberry Pi Python Tool Chain

21 Tuesday Nov 2017

Posted by parttimehacker in How to guides

≈ Leave a comment

Tags

python, raspberry pi

Introduction

I didn’t like Python when I was first introduced to it a couple of years ago. Since that time I’ve learned that it is a great quick-n-dirty language that can be used to build an app or what we used to call a “hack”. The extent of its built-in features and the enormous amount of open source code makes it a natural do-it-yourself language.

Install Tool Chain or Installation Scripts

The first step is to install several tools to facilitate installation of Python modules.

sudo apt-get install -y python-pip git
sudo apt-get install -y build-essential python-dev python-smbus
sudo apt-get install i2c-tools

I like to use Flask so install the following for a basic environment.

sudo pip install flask 
sudo pip install requests 
sudo pip install flask-httpauth

My do-it-yourself home automation system uses MQTT for messaging. My Python apps subscribe and publish using the Paho implementation.

sudo pip install paho-mqtt

I like to use Adafruit’s I2C backpack for LED and OLED devices. Their libraries usually require the Python imaging module.

sudo apt-get -y install python-imaging python-pil

Add Adafruit libraries for the most common devices. I like to use the GPIO, LED backpack and OLED displays for almost every project.  Upgrade pip to use setup wheel

sudo python -m pip install --upgrade pip setuptools wheel

Start with the GPIO stuff. I like to use a directory called /home/pi/systemd.

mkdir systemd
cd systemed
git clone https://github.com/adafruit/Adafruit_Python_GPIO.git
cd Adafruit_Python_GPIO
sudo python setup.py install

Add OLED python class:

git clone https://github.com/adafruit/Adafruit_Python_SSD1306.git
cd Adafruit_Python_SSD1306
sudo python setup.py install

Add the LED backpack class:


git clone https://github.com/adafruit/Adafruit_Python_LED_Backpack.git 
cd Adafruit_Python_LED_Backpack
sudo python setup.py install

Sync and reboot. The next step depends on your project device.

Alexa Voice Alarm Clock

30 Tuesday Aug 2016

Posted by parttimehacker in Projects

≈ Leave a comment

Tags

alexa, hackster.io, python, raspberry pi

Check out my Amazon Alexa contest project posting.

https://www.hackster.io/parttimehacker/alexa-voice-alarm-clock-42ab05

Raspberry Pi Surveillance Project

19 Saturday Sep 2015

Posted by parttimehacker in Projects

≈ Leave a comment

Tags

diy, project, python, raspberry pi

I wanted to add video surveillance to my home automation project, which was a good excuse to add another Raspberry Pi to the project. I’d tried using an ATMega328 with the Pi but found it too cumbersome to write Python code and Arduino ATMega code. It worked with an I2C interface but I wanted something simpler.

The diagram below illustrates the Adafruit photo-board with all of the necessary interfaces to 5 volt and 3.3 volt devices.

Raspberry Pi Interface Board

Raspberry Pi Interface Board

Project Enclosure

Project Enclosure

Features of a Raspberry Pi 2 Surveillance project:

  • Raspberry Pi 2 – REST server (HTTP communication and control)
  • Surveillance – Raspberry Pi camera for video capture
  • Panic Button – hardware debounced button (3.3 volts)
  • Motion sensor – PIR sensor at 5 volts
  • Night Light – large LED at 3.3 volts
  • Identification – IR Sensor to check for “me”
  • iBeacon sensor – BLE USB dongle checking for my iPhone iBeacon
  • Alarm – 555 Timer driving a loud speaker

I enclosed the project in a plain wooden box. As you can see the cable management was a hassle with the hinge and external interfaces on the door.

Raspberry Pi Surviellance

Raspberry Pi Surveillance

All of the code is in Python. There are four main packages

  1. REST server code
  2. Hardware interace – interrupts
  3. Camera controls with 2 rotating JPEG images
  4. BLE iBeacon scanner

I will publish the code to GitHub when I get a chance.

Subscribe

  • Entries (RSS)
  • Comments (RSS)

Archives

  • April 2020
  • February 2020
  • December 2019
  • March 2018
  • November 2017
  • August 2016
  • June 2016
  • February 2016
  • December 2015
  • October 2015
  • September 2015

Categories

  • How to guides
  • Projects
  • Uncategorized

Meta

  • Register
  • Log in

Blog at WordPress.com.

Cancel