This is a project from KMU Crowd Sensor Cloud Air&Home&Web.
Korean verion here : https://github.com/ghoxa/KMUSensorCloud
ABSTRACT
Connect air quality sensors(dust sensor, temperature, humidity and pressure sensor, etc...) to Arduino and collect data based on ThingSpeak api.
We can visualize these collected data and make lots of applications, and even predict numbers by machine learning if those are collected for a few years(So that we can have enough data). Also, we can add other sensors to extend various applications by web programming based on ThingSpeak or AWS(Amazon Web Service).
- 1. Author
- 2. Objective
- 3. Sensor Modules Introduction
- 4. Arduino Connection
- 5. Communication with ThingSpeak
- Professor Suntae Hwang(sthwang@kookmin.ac.kr)
- Professor Daeyoung Heo(dyheo@kookmin.ac.kr)
- Director Gyuyeon Choi(gychoi@cs.kookmin.ac.kr)
- Hojun Kim(hotem1234@naver.com)
- Seiwon Park(psw7347@gmail.com)
- Collecting data from various places by sensing air quality to visualize, analyze and predict future data
- First, practice by building platform using ThingSpeak
- Second, linking IoT Device with ThingSpeak and practice
- Third, configuration Web Application to approach from mobile
Technical Index
Parameter | Index |
---|---|
Name | ESP8266 + ESP-01 |
Command | UART AT Command |
Antenna | On-Board Ceramic Antenna |
Communication Method | 802.11 b/g/n |
Communication Speed (Baud Rate) |
- 115200(Default) - Software-Serial: 57600bps ~ 2000000bps - Hardware-Serial: 9600bps ~ 2000000bps |
Flash Memory | 16M Byte |
Processor Speed | 80 ~ 160 Mhz |
Supply Voltage | 3.3V(≥ 300mA) |
Size | 14.5 x 24.8 mm² |
Further reference:
Technical Index
Parameter | Index |
---|---|
Name | PMS7003m |
Operating Range | 0.3 ~ 1.0, 1.0 ~ 2.5, 2.5 ~ 10 µm |
Valid Range(PM 2.5) | 0 ~ 500 µm |
Maximum Range(PM 2.5) | ≥ 1000 µm |
Supply Voltage | 5.0V |
Operating Temperature | -10 ~ +60 °C |
Operating Humidity | 0 ~ 99 % |
Size | 48 x 37 x 12 mm³ |
Further reference:
Technical Index
Parameter | Index |
---|---|
Name | BME280 |
Operating Range | Pressure: 300 ~ 1100 hPa Temperature: -40 ~ +85 °C |
Humidity Sensor | Accuracy Tolerance: ±3% Response Time: 1 sec |
Pressure Sensor | Sensitivity Error: ±0.25% |
Voltage | 3.3 ~ 5.0 V |
Supply Current | 2mA |
Size | 2.5 x 2.5 x 0.93 mm³ |
Further reference: BOSCH, BME280 libraries, Specification
Connect sensors and modules with Arduino board as above.
Conncet BME280
as follows:
Connect +
with VCC
, -
with GND
,
C
with SCL
and D
with SDA
respectively.
You can check details at following site: Arduino Sensor Connection
Also, it would be better if you have following knowledge about Arduino Board
As you can see, each block is connected: VCC with VCC, GND with GND. So it doesn't matter which VCC or GND you choose within each block.
But be cautious which PIN to choose as it should be consistent with code.
Parameter | Index |
---|---|
VCC | 5V |
GND | 0V |
Now connect a fan module to arduino.
Connect VIN
on arduino board with +(Red jumper cable)
of a fan, then connect GND
on arduino board with -(black jumper cable)
of a fan as above.
NOTE: The reason why those cable's colors are different is that we used additional jumper cable in order to lengthen cables. Please don't be confused
Also, you can check the RPM of a fan by connecting yellow jumper cable
of a fan with Digital PIN
on arduino board.
But the RPM of a fan wasn't calculated in this project.(NOTE: Thoses yellow PINs on arduino board are Digital PINs, and those blue PINs on arduino board are Analog PINs. And you can see this at 4.1 Arduino Sensor Connection)
NOTE: You might question why not connecting +
with VCC
as modules above. But you need to know this: VIN
PIN supplies 12V and as a fan needs stable voltage: 12V, you'd better use external adapter to operate the fan.
If sensors and modules are correctly connected, connect Arudino with computer using cable as follows:
Visit https://www.arduino.cc and follow the path SOFTWARE > DOWNLOADS. And then choose your OS.
Click JUST DOWNLOAD.
If Arduino IDE is installed, execute Arudino Application.
Then you may see following screen. Follow the path Sketch > Include Library > Add .ZIP Library... and add all zip files in KMUSensorCloud/library/. Zip files are as follows:
Adafruit_BME280_Library_KMU-master.zip
Adafruit_Sensor-master.zip
PMS-master.zip
SparkFun_ESP8266_AT_Arduino_Library_KMU-master.zip
NOTE
You can download .zip
files as above.
Execute wificonnect.ino
and check WiFi communication.
Follow the path Tool > Port, then make sure that serial port setting is correct.
Click UPLOAD, then follow the path Tool > Serial Monitor and set Both NL & CR, 9600 Baud Rate as above.
When all things are confirmed, Enter AT
and check whether the output is OK
. If OK
is printed, move on to next step.
We know that default communication speed of 3.1 WiFi Module(ESP8266) on ESP-01 board is 115200bps. By the way, as 9600bps is commonly used due to it's enough speed, let's change speed permanently to 9600bps.
Enter AT+UART_DEF=9600,8,1,0,0
on your monitor as above.
NOTE: AT+UART_DEF = (baudrate),(databits),(stopbits),(parity),(flow control)
Visit https://thingspeak.com.
Then click GET STARTED FOR FREE
.
If you are not signed up yet click Create one!
, or sign in with your E-mail.
Sign in and then click Channels > New Channel
.
Enter blanks as above.
Name
: your student IDDescription
: date that you made this channel.
Link to External Site
:https://air.cs.kookmin.ac.kr/
- Click checkbox
Show Channel Location
and enter the latitude and longitude.
NOTE: You can check your latitude and longitude on Google Map.
Refer to Google Map.
NOTE: Make sure that Arduino is connected correctly with your computer and that port and others are set in consistent with 4. Arduino Connection.
-
#define SSID "Enter"
: Enter WiFi's ID that your WiFi Module(ESP8266) is connected. -
#define PASSWORD "Enter"
: Enter WiFi's password that your WiFi Module(ESP8266) is connected. -
#define SENSOR_NAME "Enter"
: Enter your Student ID. -
#define API_KEY "Enter"
: Enter as follows:Visit https://thingspeak.com, then click channel that you created at 5.2 Create Channel.
Then, click API Keys as above.
Copy Key under Write API Key then paste it to
#define API_KEY "Enter"
.And finally click UPLOAD in file
main.ino
.
Follow the path Tool > Serial Monitor, and you can check the figures like Temperature, Humidity, Pressure, PM 1.0, PM 2.5, PM 10.0 as above.
Also at Channel on ThingSpeak, you can check the values that Arduino sent through serial and see that the values are represented in a graph.