InfluxDB is a time-series database, where we store all the sensor data. For details on this see Store data in database

Mosquitto is an MQTT message broker.

Node-RED is a graphical programming environment. For an intro of how to use this together with Mosquitto, see This tutorial

Omxplayer is a tiny image that we put together that listenes to an MQTT topic, and plays a sound when a message is received. op-en/rpi-omxplayer

Node-RED Program

Network Layer

Because IoT is still in it's infancy, the market hasn't stabilized on one way to transmit wireless data with minimal power.

Therefore, the smart plugs that we use all use a different network protocol. The protocols all have their different advantages and disadvantages, and which one comes out dominant in the end is anyones guess.

Equipment

Network

Fibaro

Z-Wave

Plugwise

ZigBee

Yanzi

6LoWPAN

Photon

Wi-Fi

Setting up the battleground

Collect all the components needed in the list above.

Plug in the Circle+ in the main power outlet that you will use, so that it is never disconnected, and all power goes through the plug. This special type of Plugwise plug relayes messages from the normal Circle plugs to the USB-stick that we will connect to the Raspberry Pi. By making sure it is always connected to power, we stabilize the plugwise message pipe.

Find a place where you want the fight to happen. Tape a "fighting box" on the ground perhaps?

Make two stacks from the 3 types of smart plugs, so that they are connected:

Vacuum cleaner
↓
Fibaro
↓
Plugwise
↓
Yanzi
↓
Power Socket/Outlet

Connect the HUGE red button to power.

Connect the LED power strip to power.

Power the Raspberry Pi, connect the network cable from the Pi to a LAN port on the router and plug in the Plugwise USB-Stick and Yanzi Radio.

Connect the Router to power.

Configure the router so that it sets up a local network (skip this step if you have used this router for battle before)

Optional. Connect the router to the internet. How you do this can vary depending on where you are, but you usually either: 1. Connect the WAN port to another ethernet port already connected to the internet, 2. Bridge the connection from your computer to the router. (Note. if you do this, you will require another computer that is connected only to the local router network to access the Raspberry Pi)

Connect to the local network with your computer.

Now we will access the Raspberry Pi over ssh so that we can control it. We start by figuring out the ip-adress of the raspberry pi. Run a network scan in the terminal of your computer:

Based on experience, testing, luck and knowing your own IP adress, we figure out that the IP adress of the Pi is 192.168.2.235.

Connect to the Pi over ssh:

ssh root@192.168.2.235

Download the code to the vacuum battle, if you haven't already.

git clone https://github.com/op-en/vacuum-battle.git

Start all the programs running on the Raspberry Pi:

cd vacuum-battle
docker-compose up -d

Start the Yanzi border router and device server (these instructions will be special for everyone so can't give much guidance here, sorry)

When everything is started, the control interface is available at 192.168.2.235:1880

GAME ON!

Caveats

The vacuum cleaners should always be on. The plugwise plug turns them off.

We use a static IP to the router to simplify things. If you share internet to the router, you may encounter ip conflicts that have to be solved. If possible try to configure the network so that the router remains at 192.168.2.235. If you cannot achieve this, some parts of the system may not work as expected. If a part is not connected to the network, it may have a hard coded ip adress somewhere in it's code.

Theoretically, everything except the Photons work on a local network that is not connected to the internet. The photons are the only thing that require an internet connection to start. (note: replace with something that doesn't require internet? like an arduino)