Monday 19 November 2018

[Tutorial] Air Quality Workshop DIY Introduction


一、   Kits Overview

1)        Arduino Uno

Arduino Uno is a microcontroller board based on the ATmega328P (datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with an AC-to-DC adapter or battery to get started. You can tinker with your UNO without worrying too much about doing something wrong, worst case scenario you can replace the chip for a few dollars and start over again.
Arduino Uno is open-source hardware! The Arduino Uno can be programmed with the (Arduino Software (IDE)).

2)        Arduino WiFi Shield

The Arduino WiFi Shield connects your Arduino to the internet wirelessly. Connect it to your wireless network by following a few simple instructions to start controlling your world through the internet. As always with Arduino, every element of the platform – hardware, software and documentation – is freely available and open-source. This means you can learn exactly how it's made and use its design as the starting point for your own circuits.
The Arduino WiFi Shield allows an Arduino board to connect to the internet using the 802.11 wireless specification (WiFi). It is based on the HDG204 Wireless LAN 802.11b/g System in-Package. An AT32UC3 provides a network (IP) stack capable of both TCP and UDP. Use the WiFI library to write sketches which connect to the internet using the shield. The WiFI shield connects to an Arduino board using long wire-wrap headers which extend through the shield. This keeps the pin layout intact and allows another shield to be stacked on top. The WiFi Shield can connect to wireless networks which operate according to the 802.11b and 802.11g specifications.

3)        ESP8266 WiFi Shield

The ESP8266 is a popular, inexpensive WiFi/microcontroller system-on-chip (SoC). Although it can be programmed like any microcontroller, the ESP8266’s popularity was gained as a simple, serially-controlled WiFi gateway. Using an AT command set, any microcontroller with a UART can use the ESP8266 to connect to WiFi networks, and interact with the rest of the Internet world over TCP or UDP. It’s an easy (and cheap!) way to get your Arduino on the Internet!
Some differences exist between the Arduino WiFi shield and ESP8266 shield. The first one is the structure and ESP8266 don’t have a SD card slot but Arduino WiFi shield has. The second one is the WiFi Library. And the last one is the assembly way with Uno. The following introduction will show these difference and solution.

4)        Seeed Base Shield

            Arduino Uno is the most popular Arduino board so far, however, it is sometimes frustrating when your project requires a lot of sensors or LEDs and your jumper wires are in a mess. The purpose of creating the Grove – Base Shield is to help you get rid of breadboard and jump wires. With the rich grove connectors on the baseboard, you can add all the grove modules to the Arduino Uno very conveniently!
            There are in total 16 grove connectors on the Base Shield, here we use a table to show the details. Apart from the rich grove connectors, on the board you can also see an RST button, a green LED to indicating power status, ICSP pin, a toggle switch and four row of pinouts. There is no need to explain the RST button and LED, but you really need to know below two features that are very important for your usage.
            Power Compatible:
Every Grove connector has four wires, one of which is the VCC. However, not every micro-controller main board needs a supply voltage of 5V, some need 3.3V. That's why we add a power toggle switch to Base Shield v2 so that you can select the suitable voltage of the micro-controller main board you are using via this switch. For example, if you are using Arduino UNO with Base Shield v2, please turn the switch to the 5v position; while using Seeeduino Arch with Base Shield v2, please turn the switch to 3.3v.
Board Compatible:
The pinout of Base Shield V2 is the same as Arduino Uno R3, however, Arduino Uno is not the board one that the Base Shield V2 is compatible with, here we listed the boards that we have confirmed that can be used with Base Shield V2.
Ø  Arduino Uno
Ø  Seeeduino V4.2
Ø  Arduino Mega / Seeeduino Mega
Ø  Seeduino LoraWan
Ø  Arduino Leonardo / Seeeduino Lite
Ø  Arduino 101
Ø  Arduino Due
Ø  Intel Edison
Ø  Linkit One

5)        MQ-7 Sensor

It is a air quality sensor suitable for the detection of carbon monoxide, gas, etc. The module features is following:
Ø  High quality double panel design
Ø  Power and TTL signal output indication
Ø  Has better sensitive detection for carbon monoxide
Ø  Has a long service life and reliable stability

6)        Dust Sensor

This Dust Sensor gives a good indication of the air quality in an environment by measuring the dust concentration. The Particulate Matter level (PM level) in the air is measured by counting the Low Pulse Occupancy time (LPO time) in given time unit. LPO time is proportional to PM concentration. This sensor can provide reliable data for air purifier systems; it is responsive to PM of diameter 1μm.
This sensor uses counting method to measure dust concentration, not weighing method, and the unit is pcs/L or pcs/0.01cf. Please pay attention to the warnings when using it.

7)        Power Bank

This super slim power bank is ideal for charging your smartphone, tablets and more. The slim design and soft touch finish ensure this portable charger goes everywhere with you.
Ø  . 2500 mAh for all day needs
Ø  . Ultra Slim and compact design makes it easy to carry
Ø  . The smart LED light indicator displays battery level and charging status
Ø  . Classic soft touch finish surface
Ø  . Guaranteed protection against overcharge, over-discharge, overvoltage, over-current, overpower and short-circuit
Ø  . Approx. Dimensions (mm) 105 x 32 x 21.5

8)        WiFi Router

            The WiFi network environment is necessary when collecting sensor data via WiFi. So need to use a WiFi router when no existing WiFi access point. Attention please, WiFi shield can’t connect the WPA2- Enterprise encryption based WiFi network.

9)        Accessory Equipment

Apart from the devices showed above, we also need Uno cable, jump wires.


10)    Android System Based Displaying Application

In this case, we develop an Android System based application to display the data collecting from the sensor.

二、   Kits configuration

1)    Devices Assembly

2)    Upload Code to Uno using IDE

2.1       IDE Overview

After assembling the devices as shown above, then we can connect the kit with computer and start to burn code.
So we need to download the Arduino interactive development environment (IDE) because we program our codes by using it. The Arduino Integrated Development Environment - or Arduino Software (IDE) - contains a text editor for writing code, a message area, a text console, a toolbar with buttons for common functions and a series of menus. It connects to the Arduino and Genuino hardware to upload programs and communicate with them.
Programs written using Arduino Software (IDE) are called sketches. These sketches are written in the text editor and are saved with the file extension .ino. The editor has features for cutting/pasting and for searching/replacing text. The message area gives feedback while saving and exporting and also displays errors. The console displays text output by the Arduino Software (IDE), including complete error messages and other information. The bottom righthand corner of the window displays the configured board and serial port. The toolbar buttons allow you to verify and upload programs, create, open, and save sketches, and open the serial monitor.
NB: Versions of the Arduino Software (IDE) prior to 1.0 saved sketches with the extension .pde. It is possible to open these files with version 1.0, you will be prompted to save the sketch with the .ino extension on save.

2.2       IDE Programming

Step1: Download and install the Arduino IDE, after that, we can start doing anything with the Arduino. The Arduino Programmer is based on the Processing IDE and uses a variation of the C and C++ programming languages.
Step2: Connect the Arduino to your computer's USB. It is also good to know that every single Arduino has a unique virtual serial port address. This means that every time you plug in a different Arduino board into your computer, you will need to reconfigure the serial port that is in use.
Step3: Setting the board and serial port. In this case, we choose Arduino/Genuino Uno, and the serial port depends on your computer.
To set the board, go to the following: Tools --> Boards
To set the serial port, go to the following: Tools --> Serial Port
 
Step4: Write Your Own Code: When writing your code, you need to include the head file to let WiFi shield work. For Arduino WiFi shield, we need to include “# include <WiFi.h>”, for ESP8266, we need to include “# include <WiFiEsp.h>”. These two head files can be got from their support library.
            So next I will introduce how to include the WiFi library. Choose sketch->Include Library->Manage Library. As I said before, there are two different Libraries for Arduino WiFi shield and Esp8266 WiFi shield.
            For Arduino WiFi shield, Search the key words: WiFi, and install WiFi Built-In by Arduino Version 1.2.7. Then you can find the examples in File.
            For Esp8266 WiFi, you need add a link in File->Preference because Esp8266 is an additional boards. This link is http://arduino.esp8266.com/stable/package_esp8266com_index.json.
            Then you can search key word WiFiEsp to download the Esp8266WiFi Library. and you can find the WiFiEsp files in File->Examples.
Step5: Compile your own code and upload: In this case, we have already uploaded the code to Uno, you can reload the following codes. For Arduino WiFi is Webserver_ArduinoWiFi.txt, for Esp8266 is Webserver_ESP8266.txt
            Step7: Serial Monitor: through the serial monitor, we can look over the output. And at the lower right corner, we can set the baud rate, e.g. 9600, 115200.

3)    Install Android Application and Network Configuration

An Android system based application can be used for displaying the data from the sensor. You can download this app from this link.
The communication between the phone and Uno sensor is established via WiFi network. Uno and WiFi can work as a WebServer and the phone acts as a web client HTTP is employed for this communication. The figure below shows the communication structure.
            The next step is to get the IP address of webserver. After uploading our code to Uno using IDE, we can get the webserver IP address via serial monitor like shown below.
            Then input the IP address to the app and establish the connection. And data will display on the app.

            If you want to turn off the communication, press down the Disconnect/Back.

1 comment:

  1. it is useful to everyone it is easily to understand everyone we are offering
    portable air quality monitor device

    ReplyDelete

[Research] Recurrent Neural Network (RNN)

1. Introduction As we all know, forward neural networks (FNN) have no connection between neurons in the same layer or in cross layers. Th...