Group members and responsibilities
Aleksi Toivanen (Frontend dashboard)
Juhani Jaakkola (Arduino device, backend server and 3D printed cover)
Overview
A device for measuring temperature and relative air humidity. It measures and sends the data to the backend server every 5 minutes. One aim of the project was to make a small affordable device which could be placed to almost anywhere. Parts ordered from Ebay cost about 5,50€ per device (excluding jumper cables, 3D printed box and USB charger).
Data is displayed on a dashboard web page which allows the user to follow changes and latest measurements from the device easily. All devices send a device identifier with the data so users can have multiple devices measuring at different locations.
Backend is running in Heroku (PaaS) platform and data is stored to MongoDB (MongoLab).
HARDWARE (2 devices)
2x AM2302/DHT22 (digital temperature and relative humidity sensor)
2x Arduino Pro mini V3.3
2x ESP 8266 – ESP-01 (wifi module)
2x 5V to 3.3V DC-DC Power Supply Module AMS1117 LDO 800MA
3D PRINTED PARTS (TinkerCad links included)
2x Device box and cover
Schematics
The voltage regulator in the diagram should be a 3-pin low-dropout regulator (5V to 3.3V) with a couple of condensators. In the project we used regulator modules that include these, but unfortunately this module is not available in Fritzing libraries.
Dashboard
Device
The parts are put together on a small breadboard which is just enough for the few parts used in this project.
The hardest part of building the device was creating a proper HTTP request using an ESP 8266 wifi module. The module communicates with AT commands which are printed to a serial connection. AT+CIPSEND’s command value must be exactly the amount of characters in the request. Also the content length value must be correct so that the request is valid.
// CIPSEND value and Content-Length in the request must be correct! espStr_P(PSTR("AT+CIPSEND=208\r\n")); if (waitForString(ESP_START, ESP_NONE, DEFAULT_TIMEOUT) == ACT) { // Building POST Request espStr_P(PSTR("POST /api/data HTTP/1.1\r\n")); espStr_P(PSTR("Host: murmuring-bayou-3294.herokuapp.com\r\n")); espStr_P(PSTR("Connection: close\r\n")); espStr_P(PSTR("Content-Type: application/json\r\n")); espStr_P(PSTR("Content-Length: 68\r\n\r\n")); // Building POST Request body espStr_P(PSTR("{\"did\":\"")); espStr_P(PSTR(DID)); espStr_P(PSTR("\",\"tem\":")); char value[6]; espStr(dtostrf(MEASUREMENT[0], 5, 2, value)); // Insert temperature espStr_P(PSTR(",\"hum\":")); espStr(dtostrf(MEASUREMENT[1], 5, 2, value)); // Insert humidity espStr_P(PSTR(",\"hin\":")); espStr(dtostrf(MEASUREMENT[2], 5, 2, value)); // Insert heat index espStr_P(PSTR("}\r\n")); if(waitForString(ESP_SAVED, ESP_NONE, DEFAULT_TIMEOUT) == ACT) { // 'SAVED' DEBUG_PRINTLN(F("\r\nSend successfully")); } else { DEBUG_PRINTLN(F("\r\nSend failed")); } }
Testing
During the development the device run three weeks successfully. During this time all the measurements were received by the backend server.