Anth's Computer Cave

AAIMI Home Automation Tutorial Hub

Use the buttons below to read all of the AAIMI Home Automation tutorials.

Download and set up AAIMI Home Automation 0.92

9th August 2019

In this article we'll download the AAIMI Home Automation setup files and prepare the Raspberry Pi and Arduino. Then we'll run the setup wizard to install and configure AAIMI.

Note:

To set up the AAIMI Home system you will need a basic understanding of the Raspberry Pi computer and the Linux operating system it uses. This includes using SSH to access your Pi, and SFTP to load the AAIMI files.

You will need to have some experience using Arduino micro-controllers, and have built or bought some sensors like our prototypes featured on our hardware page. The hardware page has links to tutorials to connect and use all the individual devices.

If you plan to control the system remotely over the Internet you should read the Network section of our Advanced page to configure safe access to AAIMI.

Download

You can find the full AAIMI Home setup folder here. Download and unzip the folder to your home folder on the Raspberry Pi. The extracted folder is called aaimihome, and it needs to be in your home folder. To ensure it is in the correct location, open a terminal and navigate to the aaimihome folder.

Type pwd. The location should be /home/YourName/aaimihome, with your Linux username in place of "YourName". The location is important because this is where the Apache server will expect to find the web folder.

Prepare your Raspberry Pi

You don't connect any home-automation sensors or devices yet, we'll do that after the installer runs.

We recommend you start with a fresh installation of Raspian. Make sure you have added your own user account and removed the default 'pi' user.

As usual with Linux, the first thing you do is open a terminal and type:

sudo apt-get update && sudo apt-get upgrade

DHT temperature sensors

If you plan to use any DHT11 or DHT22 temperature and humidity senors in your devices you'll need to install the DHT Python library from Adrafruit.

I don't have a tutorial on using these, but there is a good DHT how-to over at Circuit Basics. They cover several methods for using DHT. Head over there and install just the Python DHT library using the instructions under 'Programming the DHT with Python', then we'll continue here.

Configure Arduino

You'll need to upload one of the two Arduino sketches in the aaimihome folder. The basic version is in the folder called sensor_monitor_arduino. The other version, sensor_monitor_arduino_rfid, is the one you use if you wish to include an RFID card reader in your system. Use whatever method you usually employ to upload the relevant sketch to your Arduino.

Next you'll need to configure the serial connection between the Raspberry Pi and the Arduino. We are making this connection using a USB cable.

My Raspberry Pi connects to this over the "ttyUSB0" com port, thus the serial-connect part of my Python code (aaimi_home_control.py, line 1075) looks like this:

arduino = serial.Serial('/dev/ttyUSB0', 9600)

Your board may connect on a different tty port. Click here for a guide to set up a serial connection between an Arduino and a Raspberry Pi.


Add people avatars and smoke-and-gas siren

People

You need to add an avatar image for each member of your household. These images go in the people folder at /home/YourName/aaimihome/aaimiweb/themes/people.

The images should be square, at around 200*200 pixels. The image names must match each person's user name + dot + jpg. For example my username is anth, so my avatar image is called anth.jpg.

System sounds

There are five system sounds for the alarm operation in the /home/YourName/aaimihome/aaimi/sounds folder. There is arming.wav, which sounds when a user is arming the system and leaving, and armed.wav, which sounds at the end of the exit-time when the system actually arms. There is intruder.wav, which sounds when an intruder is detected, and allclear.wav, which sounds whenever the alarm is disarmed. You'll also find a siren file called fire.wav, which is the sound the system uses by default if it detects smoke or gas.

You can replace all of these sounds with your own WAV files, just rename the new files the same as the originals. Choose WAV files no more than a few of seconds long. You can also add extra WAV files for custom sounds you can configure to play on events from other general-purpose sensors


Run the AAIMI wizard

Now we'll run AAIMI's setup wizard and installer. This wizard configures a web server with .htaccess password protection. It also configures paths in several of the other system files.

The setup wizard is in the aaimihome folder and it is called aaimi_home_setup.py.

Navigate to the aaimihome folder and type:

sudo python aaimi_home_setup.py

The installer will check the location of the AAIMI folders to make sure they are in the correct place. It will also set ownership and permissions for the aaimihome folder and several of the files it will use during the installation.

If you have the aaimihome folder correctly-positioned AAIMI will prompt for a password for the admin user, which is you. The password should be eight characters long with upper and lower-case characters and numbers. Don't use the same password as your Linux user password. The password will not display as you type.

Next setup will install an Apache2 web server and PHP, along with various Linux and Python libraries required to run AAIMI Home Automation.

After that, you'll be asked if you wish to use IP filtering for extra security. Choosing yes will mean you need to manually allow access to each device you plan to use to access AAIMI while you are away. You'll also need to update the settings any time your phone's network details change.

Using AAIMI Home Automation without IP filtering

Unless you live in a bunker and wear a tin-foil hat, choose n.

It will then configure the Apache2 server files to change the Document Root to the aaimiweb folder and create a password-protected access system for AAIMI users. It will also configure IP filtering if you answered yes to the previous question.

That's the setup wizard out of the way.

In the next article we'll define our rooms, sensors and relays, then start AAIMI Room Control.

Cheers

Anth


Previous: Hardware Recap

Next: Configure rooms and devices


_____________________________________________


Comments

Leave a comment on this article




Leave a comment on this article