Use the buttons below to read all of the AAIMI Home Automation tutorials.
Configure AAIMI rooms and devices
11th February 2018
Let's configure some rooms and devices using the new AAIMI Configuration GUI.
Before you begin you should create an overall plan for your systen and make a diagram or list of all the devices and their GPIO pins.
The diagram below shows the connections for a full AAIMI room with a PIR movement-sensor, light-sensor, and lamp. There is also a thermostat, smoke-detector and cooling fan.
To see a larger image, right-click the image and click Open in new tab.
Note that the lamp and fan need to be connected via a relay, as described in our relay tutorials. You can find links for all the other devices on our Harware page.
In a web browser, type YourIP/config into the address bar, substituting your Raspberry Pi IP address for YourIP.
You'll see the new GUI.
It provides options to add and view rooms and hardware devices, and enable/disable program features.
We recommend doing this on a desktop or laptop computer rather than a phone, so you can utilize the support documentation built-in to the right-hand column of the GUI.
As you can see, the initial help column tells you to stop the main AAIMI program before adding anything. In our case we haven't started the main program yet, but keep that in mind if you use the configuration GUI again later.
After configuring your devices, shut down the Raspberry Pi before connecting the hardware.
You need to add at-least one room before starting the main program.
I'm going to add my Lounge, which uses the exact connections shown above. Click Add Room.
You can create a custom empty room and add devices later, but I recommend you choose a default room-type that includes your desired devices, and add their details in the pop-up fields. These devices will then operate as part of the standard AAIMI control system.
I define the room-type as a PIR/Lightsense/Relay. The entry fields for these devices now appear.
I enter 27 for the PIR pin number on the Raspberry Pi, and set the room timeout at 60 seconds. This is the time AAIMI waits after the last movement to declare the room vacant.
As in the diagram my light-sensor pin is A0 on the Arduino. The Light Trigger is the switching point in volts returned by the sensor that will denote the room dark enought to switch on lights. The Light-check frequency is the time in seconds between each reading.
Under Light relay details I've chosen Raspberry Pi as the relay type, because that's the board that drives this relay. My relay is connected to pin 4.
I've set the Light operation as automatic, meaning the lamp will switch on and off based on movement and light levels.
Lastly, I select to include the room in the alarm system and press Enter.
If I click the view button and click on Lounge I can see the details for my new room.
We'll add the temperature sensor soon, but first we need to add the relay for my cooling fan.
I click Add Relay and give my fan relay a name. I enter Lounge as the relay room.
I want the fan to stay off unless needed, so I set the Default state as Off
Once again for the relay type I choose RaspberryPi and enter the pin number, in this case 24.
Some switching equipment have a standby power method activated by an enabler pin. Mine doesn't, so I leave that as None.
For the Relay Purpose I select Cooler, then press Enter to finish.
Now I can add my thermostat. Click Add Thermostat and as usual give the thermostat a name. I like to name my devices based on the room they reside so I call mine LoungeTemp.
Enter the room name and a check-frequency. Temperatures don't change too rapidly so I'll set mine at 30 seconds.
Next select the type of temperature sensor you are using.
I'm using my home-made analog sensors so I choose analog.
In this case I'm using a simple fan connected to a single relay so I select Basic Relay.
The Cooler name is the name of the relay I defined for my fan, LoungeCool.
I set the Trigger Temp at 25 degrees C. The fan will switch on if the temperature goes above 25 degrees and stay on untill it returns to 25.
Click Add Thermostat.
If you click View beside the main Add Thermostat button you'll see the details for your new temperature sensor.
I cover adding a smoke and gas sensor in a moment, but you may wish to add a couple of other relays first.
If you are planning to activate a relay in response to smoke events you'll need to add that relay first. For instance if you want a siren or screammer to switch on in a fire, create a relay like we did before with the Lounge fan.
Add any other relays you plan to use.
You can also add some system-related relays. Below you can see the standard system relays I have in my Lounge. There are two alarm LEDs and a relay-operated speaker for alarms and alerts.
The alarm LEDs give you a visual indicator of whether the system is armed or disarmed. They connect directly to the Pi or Arduino without relay, but you still add them in the Add Relay section.
To add any system relays you need to name the relays accordingly. The armed LED will be called ArmedLED and the disarmed LED will be DisarmedLED. The entries will look like this.
Notice this time I'm using the Arduino so I select Arduino in the Relay Operation menu and entered the full name for the pin instead of just the number like the Pi.
I've selected ArmedLED in the Purpose menu.
I repeat these steps to add a green disarmed LED named DisarmedLED on D5, setting the purpose as (you guessed it) DisarmedLED.
To save power you can connect your system speakers to a relay and AAIMI can switch them off when it has nothing to say. It turns them on only as it needs them. I have a pair of loudish computer speakers for my system connected to the 12V power supply via a relay.
To add speaker-switching, create a relay called 'systemSpeaker' and choose System Speaker under relay Purpose.
Note that you need to enable system sounds in the Enable sound section before AAIMI will play sound.
Click Add Smoke Detector, give your sensor a name, enter the room name and set a check-frequency.
The trigger voltage is the voltage above which represents a smoke event. A new sensor should return around 0.3V in good air and anything over 2.0V is a concern. After a couple of years they creep and you might need to raise the limit.
In the trigger action menu you can choose AlarmAudio to play an alarm through the speakers or Email to send you an email. To do both, choose AlarmAudio/Email.
If you choose to use audio you'll be prompted for a WAV file to play. This file must be a .wav file in the aaimihome/aaimi/sound folder. If you leave the field as None the system will use the default fire.wav audio siren.
Note that you'll need to enable System Sounds and/or Outgoing Email to use each function.
Towards the bottom of the configuration GUI you'll find op\tions to enable and disable program features. These features are disabled by default so that people can run AAIMI with the bare minimum of hardware.
Internet is the only one enabled by default. If you are putting your AAIMI system in a location without Internet access you'll need to click on Enable Internet and select Disable.
Click Enable System Sounds to open the sound section.
If you don't have a relay to operate your speakes select Always On under Speaker Power. Otherwise select Relay power on/off.
The system will use the relay called systemSpeaker you configured earlier.
Click Enable Email to open the email section.
You can enable just outgoing email alerts (recommended). You can also enable incomming email so you can send email commands to the system, but this is mainly handy if you are using IP filtering.
You'll be prompted for a dedicated Gmail account for the system to send from, and your own email for AAIMI to send to.
When you start the main program, aaimi_home_control.py later, you'll be prompted for the password for the system's Gmail account.
To enable GPS location awareness, click Enable GPS and select Enable.
Note that you also need to configure your home perimeter in AAIMI GPS Mapper as described at the end of the previous setup article.
General-purpose analog and digital sensors.
These are sensors that work independently from AAIMI's standard room operations and allow you to choose custom reactions for sensor events. You can also use use these sections to add standard sensors to upgrade default room-types, for instance adding a light sensor to change a PIR/Relay type room to a PIR/Lightsense/Relay room.
I'll demonstrate both options.
First we'll add a digital sensor to GPIO 24 on the Raspberry Pi, in this case a spring-loaded button that breaks a circuit when a door is opened.
Click Add Digital sensor and enter a name and the name of the room.
This button is on, or closed, when the door is shut and we want to know when the door opens. Opening the door will open the button or turn it off.
Therefore we need to set the default state as High. This will mean the system reacts when the signal is sent Low.
I enter enter 24 for GPIO 24 on the Pi and set the check-frequency to one second. This means there will be no delay between the door opening and the reaction.
There are several actions available to respond to system events. You can switch a relay on or off, send an email or play a sound.
If you choose Relay you'll be prompted for the name of the relay you wish to switch.
If you choose Play Sound you'll be prompted for the name of the sound file, which once again must be a valid .WAV file inside the aaimihome/aaimi/sound folder.
You can also set the action as RoomPIR, which converts a custom room-type into a standard AAIMI PIR room-type and includes it in room occupancy operations.
In my case I select Play Sound as my action. Any time someone opens the door I'll hear my chosen sound.
Default analog sensor
This time we'll add an analog sensor, but use it as a light-sensor to upgrade a PIR/Relay room-type to a PIR/Lightsense/Relay room-type.
We'll assume I've already created a room called Kitchen as a standard PIR/Relay room-type.
Click Add Analog Sensor and name your sensor the same as your room name.
My light-sensors return a higher voltage as the room darkens so I'll set the default state to Low.
I enter A2 as the analog pin on the Arduino
I set the check-frequency to 11, and the trigger voltage to 3.0.
In the Action menu this time I select Room Light Sensor to convert the room-type
From now on my Kitchen will use this light sensor along with the existing PIR sensor to decide when to switch the Kitchen light on.
Finally, we'll add an RFID card reader so we can arm and disarm the alarm system using cards and Key fobs.
You don't have to use RFID arming, you can toggle the alarm with your phone, but it's good to have two options.
There are set pins on the Arduino you must use for the card reader. Connect your card reader exactly like the image below, and add a LED for a card-read indicator.
Note this is a 3.3V device, don't connect it to 5V.
The CardOk LED, is there to indicate a successfull swipe. It lights for a second when a card is detected. You do not need to configure this LED like the other relays, it is already configured in the Arduino sketch. You'll need a current-limiting resistor in line with the LED.
In the configuration GUI, select Add RFID reader and enter the room name the card reader is in.