Introduction: Air Butler

Air Butler is your smart butler that makes sure the air condition at home has reached its optimal state in the most efficient way.

Step 1: Collection of Sensors

To build our own home Air Butler, we first need to consider the range of information we would like him to take into consideration when making decisions to take care of our home. Then we base our use of sensors on the range of information.

For my own Air Butler, I used Air Quality Sensor (Picture 1): http://www.seeedstudio.com/depot/Grove-Air-quality...

Dust Sensor (Picture 2) : http://www.seeedstudio.com/depot/Grove-Dust-Sensor...

and PIR Motion Sensor (Picture 3):http://www.seeedstudio.com/depot/Grove-PIR-Motion-....

Air Quality Sensor captures the concentration of hazardous gases at home. I used PIR Motion Sensor because I would like my Air Butler to be informed about whether there is someone in each room. In my view, rooms with people actually in them should be prioritized, so I would like my Air Butler to consider that and provide me with that information.

You can add extra factors into consideration. There are a lot of different sensors available on markets. Possible ones to consider: air quality sensor, dust sensor, PIR motion sensor, humidity sensor(http://www.seeedstudio.com/depot/Grove-TempHumi-Se...)

, PM2.5 sensor(http://www.dfrobot.com/index.php?route=product/pro...), etc.

Step 2: Choosing a Microcontroller

For Air Butler to be your butler, it needs to be able to read data from the sensors, process that information, present that information to a web app, and receive instructions. We need to choose a platform to work with so that Air Butler can communicate through wifi.

There are a lot of micro-controllers with wifi support or ethernet support available on the market: Arduino Yun(https://www.arduino.cc/en/Main/ArduinoBoardYun), Spark Core(https://www.particle.io/prototype), LinkIt One(http://www.seeedstudio.com/depot/LinkIt-ONE-p-2017...), etc. I used Arduino Yun because it was the one that I had learnt in my Physical Computing class.

Step 3: Connecting Sensors With Microcontroller

I used 123D Circuit(https://123d.circuits.io/) to design a sensor shield to install onto the Arduino Yun (see Picture 1 and 2). To use the three grove sensors, I devised a shield with three headers for my three sensors to connect to. Check here for my schematics(https://123d.circuits.io/circuits/753386-arduino-s...) and PCB view(https://123d.circuits.io/circuits/753386-arduino-s...).

Another problem was that there was only one kind of grove connecter part on 123D Circuits and it was too small.I forked the original grove connecter part and made the holes bigger and adjusted the size of the pads to ensure safe connections. Now there is a part called “Grove Connector” under my name (see Picture 3). If the reader would like to make a PCB board to connect sensors and Arduino Yun, feel free to use this grove connector part.

Click on "+ Component" button on the top right corner of the 123D Circuits interface. Click on "All Components" in the panel that pops up. Type in "Grove Connector". Click on different options and read the description in the new pages about the components. Check here for the component (https://123d.circuits.io/components/762245). You can also design your own parts and let other people use them on 123D Circuits!

I made the PCB board with the PCB maker machine in the Interactive Media Arts lab in NYU Shanghai. You can find options online for low cost PCB prototyping if you don't have access to a PCB machine.

After having my PCB board ready, I soldered the grove connector headers and arduino headers onto the board (see Picture 4).

If you made a mistake in designing the PCB board, there is always a way to fix it. To change a connection on the printed PCB board, you can use a knife to cut away the previous connection and make a new connection by soldering a wire between the two points (See Picture 5).

When all is set, plug the sensors into the assigned headers you designed for them.

Step 4: Getting Started With Arduino Yun

After connecting the sensors onto the PCB Grove Shield we made ourselves, and plugging the shield onto Arduino Yun, we should have something that already resembles an Aeolian bell in some way (see Picture 1).

Now is the time to actually tell Arduino Yun what to do.

Download Arduino from this website https://www.arduino.cc/en/Main/Software if you don't have it already installed on your computer.

Connect Arduino Yun to your computer with the common usb cable (the same cable as is used for Android Phones).

Configure Arduino Yun to your home wifi first. If you are looking for information on how to configure Arduino Yun, there are a lot of online resources you may find helpful. Here is a video to get started with Arduino Yun.

Step 5: Coding in Arduino Yun

Create a .ino file in Arduino, paste the codes below and save them. I named it "Bridge.ino".

Before uploading the codes onto Arduino Yun, Go to "Tools" tab and select "Arduino Yun" under "Board", select the port with ttyl and usb in it under "Port". Then click the -> button to upload the following codes onto our Arduino Yun.

Here are the codes.

/* This code is a modification based on Arduino Yún Bridge example

This example for the Arduino Yún shows how to use the Bridge library to access the digital and analog pins on the board through REST calls. It demonstrates how you can create your own API when using REST style calls through the browser.

Possible commands created in this shetch:

* "/arduino/digital/13" -> digitalRead(13) * "/arduino/digital/13/1" -> digitalWrite(13, HIGH) * "/arduino/analog/2/123" -> analogWrite(2, 123) * "/arduino/analog/2" -> analogRead(2) * "/arduino/mode/13/input" -> pinMode(13, INPUT) * "/arduino/mode/13/output" -> pinMode(13, OUTPUT)

This example code is part of the public domain

http://arduino.cc/en/Tutorial/Bridge

*/

#include #include #include

// Listen to the default port 5555, the Yún webserver // will forward there all the HTTP requests you send YunServer server;

void setup() { // Bridge startup pinMode(13, OUTPUT); digitalWrite(13, LOW); Bridge.begin();

// Listen for incoming connection only from localhost // (no one from the external network could connect) server.listenOnLocalhost(); server.begin(); Serial.begin(9600);

}

//------------bridge---------- // Get clients coming from server YunClient client = server.accept();

// There is a new client? if (client) { // Process request process(client);

// Close connection and free resources. client.stop(); }

delay(50); // Poll every 50ms

}

//-------------------------bridge------------------

void process(YunClient client) { // read the command String command = client.readStringUntil('/');

// is "digital" command? if (command == "digital") { digitalCommand(client); }

// is "analog" command? if (command == "analog") { analogCommand(client); }

// is "mode" command? if (command == "mode") { modeCommand(client); } }

void digitalCommand(YunClient client) { int pin, value;

// Read pin number pin = client.parseInt();

// If the next character is a '/' it means we have an URL // with a value like: "/digital/13/1" if (client.read() == '/') { value = client.parseInt(); digitalWrite(pin, value); } else { value = digitalRead(pin); }

// Send feedback to client client.print(F("Pin D")); client.print(pin); client.print(F(" set to ")); client.println(value);

// Update datastore key with the current pin value String key = "D"; key += pin; Bridge.put(key, String(value)); }

void analogCommand(YunClient client) { int pin, value;

// Read pin number pin = client.parseInt();

// If the next character is a '/' it means we have an URL // with a value like: "/analog/5/120" if (client.read() == '/') { // Read value and execute command value = client.parseInt(); analogWrite(pin, value);

// Send feedback to client client.print(F("Pin D")); client.print(pin); client.print(F(" set to analog ")); client.println(value);

// Update datastore key with the current pin value String key = "D"; key += pin; Bridge.put(key, String(value)); } else { // Read analog pin value = analogRead(pin);

// Send feedback to client client.print(F("Pin A")); client.print(pin); client.print(F(" reads analog ")); client.println(value);

// Update datastore key with the current pin value String key = "A"; key += pin; Bridge.put(key, String(value)); } }

void modeCommand(YunClient client) { int pin;

// Read pin number pin = client.parseInt();

// If the next character is not a '/' we have a malformed URL if (client.read() != '/') { client.println(F("error")); return; }

String mode = client.readStringUntil('\r');

if (mode == "input") { pinMode(pin, INPUT); // Send feedback to client client.print(F("Pin D")); client.print(pin); client.print(F(" configured as INPUT!")); return; }

if (mode == "output") { pinMode(pin, OUTPUT); // Send feedback to client client.print(F("Pin D")); client.print(pin); client.print(F(" configured as OUTPUT!")); return; }

client.print(F("error: invalid mode ")); client.print(mode); }

Step 6: Reading Data From Arduino Yun

After uploading the codes in the previous steop, the Arduino Yun will already be reading data from the sensors. Now if you open up the Serial port in Arduino, you will see sets of values of data.

What the Bridge.ino does from the last step is to receive these data and send them to an IP address that our web app can read from.

Now we start building the web app.

Open up a text editor. Create an html file. Copy the following codes into the file. Since I cannot copy the codes here because this form automatically renders it into actual webpage, I am attaching the html file.

After having the html file to have the basic structure of the webpage, we need to arrange the elements of the html file. So we create a css file "custom.css". See attachment for the css file. Save it in the same folder as the html file.

Now that we have finished writing our custom css file. Since we are using JQueryMobile, we need to download JQueryMobile and put it into the same folder. I attached the JQueryMobile zip file too. Unzip it before putting the folder into the same folder as the html file.

By now, we already have the look of the webpage and the arrangement of the element. Now we still need to somehow get the actual data and put them into the elements of the webpage.

So we create a javascript file. I have attached the javascript file as well. Put it into the same folder as the html file.

Remember you will need to change the IP address in the javascript file because every Arduino Yun has a different IP address.

Now you should have a webpage that looks somewhat like picture 1.

Step 7: Robotics

Ideally, the Air Butler will be able to control the wheeled air purifier to go to different rooms. However, that involves complicated robotics. I built a model where the Arduino Yun controls a small car that represents the wheeled air purifier to move back and forth. That was just a model to show the potential control of Arduino Butler over the air purifier. It was not practical or useful in any way. Since it requires really advanced robotics to navigate in a home, and I do not possess this level of knowledge in robotics, I will leave it to anyone with knowledge in this area to contribute. In fact, during my demo of Air Butler with my little car, some audience expressed particular interest in Air Butler without the robotics part, because they would like to get informed about the air pollutants distribution at home.

So we continue to furnish our Aeolian Bell part.

Step 8: 3D Modeling and Designing the Aeolian Bells

The Aeolian bells are sets of sensors attached to micro-controllers. These sets are

camouflaged as cute decorations (“Aeolian bells”) that are hung in different rooms of your apartment.

I made several models for Aeolian bells, using different softwares.

See the model I made with Fusion360 (see picture 1). I 3D printed the design with an UP! 3D Printer in the IMA lab (see picture 2).

See the model I made with Rhinoceros (see picture 3). I also 3D printed the design with the same UP! 3D Printers in the IMA lab (see picture 4).

When designing for the Aeolian bells, there are several key factors to remember.

1. Leave hole(s) on the bottom for sensor wires to go through. The holes do not need to be as big as the sensors, but each of them should be bigger than the header for the sensors.

2. Measure all the dimensions and allow for extra space so that our Arduino Yun with sensors will definiteyly .

3. Leave space or extra hole on the side for power source or portable power.

4. Leave small holes on the sides for strings to go though.

Step 9: Assemble Multiple Aeolian Bells

Now having your own model printed. It is time to put out Arduino Yun into the model!

Put your charged mobile power source in to the model and connect it with Arduino Yun too.

To understand the distribution of air pollutants at home, repeat all these steps to make multiple sets of Aeolian bells. Hang them in different rooms at home.

Now whenever you open the web app, you should see the real time data of air pollutants in different rooms at home! Then you can make the decision of where to position your air purifier!

Comments

author
DIY Hacks and How Tos made it! (author)2015-09-24

Cool project.

author
haydeemoon made it! (author)haydeemoon2015-09-24

Thank you!

About This Instructable

665views

7favorites

License:

More by haydeemoon:Air Butler
Add instructable to: