Introduction: Let's Go Fly a Kite... With an Arduino on It!
Hello everyone! I am Michalis Vasilakis from www.ardumotive.com and in this Instructables I will show you how to make your own Arduino IOT system for your kite!
This system will be able to measure real-time values of the barometric pressure, altimeter, temperature and humidity. You can put it on your kite, drone, atmospheric balloon, even on your balcony!
We will use the WiFi technology to communicate with it, our goal is to take values up to 200 meters from our ground station. To make that possible we will use a WiFi router with two 5dBi antennas, you can also use a directional antenna to extend the range. On the next steps I will also show you how you can easily find the max range from your WiFi router.
Measured values will be automatically available to our ThingSpeak.com channel for observation and farther analysis.
Q & A and updates : http://www.ardumotive.com/iot-kite.html
So, let's get started!
Step 1: What We Will Need
For this project we will need:
For your own custom circuit* :
- ATmega328p (+28 pin socket)
- 16Mhz Crystal oscillator
- 2x 22pF, 1x 0.1uF capacitors
- 10K Ohm resistor
You will also need one Arduino uno board to program the ATmega328p IC. It's also highly recommended to build your circuit on a breadboard first.
*If you want to use an Arduino board try something small, like Arduino Nano or Arduino Micro.
Sensors and modules:
- DHT-22 (for temperature and humidity) ($9 link)
- Adafruit BMP280 (for barometric pressure and altimeter)
- ESP8266 WiFi module (~3$ link)
- 3.7V Rechargeable battery (500mAh will be fine)
Our code is only supporting the BMP280 sensor of Adafruit. If you want to use another brand it will be necessary to make changes to our code.
There are too many versions of ESP8266 WiFi modules out there... some of them will not work with our code, so please make sure to use the same version (link - photos here)
Step 2: ThingSpeak Account - Create Your IOT Channel
Visit www.thingspeak.com and click on the "Get Started" button to make a free account.
Now click on the "New Channel" (second image above). Give it a name and select four (4) fields:
- Field 1: Barometric pressure (Pa)
- Field 2: Altimeter (m)
- Field 3:Temperature (oC)
- Field 4: Humidity (%)
If you want you can fill more info about your channel, e.g. Latitude and Longitude of your sensor.
If you want to share sensor info with your friends (and more..) click on the "Make Public?" check box option.
Finally click on the "Save Channel" button.
Click on your new channel and select the API keys tab (third image above).
Copy your "Write API Key" , you will need it in the next step.
Step 3: The Circuit
Here is the circuit schematic.
Connections of the ESP8266 WiFi module:
- RXD to Arduino TX pin
- GND to GND (what else?)
- VCC to Arduino 3.3V Pin or "+" battery (3.7V) cable
- RST to Vcc
- CH_PD to Vcc
- TXD to Arduino RX pin
Connections of the DHT-22 sensor:
- VCC to Arduino 3.3V pin or "+" battery (3.7V) cable
- DATA to Arduino pin 11
- GND to GDN
Connections of the Adafruit BMP280 sensor:
- Vin to Arduino 3.3V pin or "+"battery (3.7V) cable
- GND to GDN
- SCK to Arduino SCL pin (A5)
- SDI to Arduino SDA pin (A4)
You can test your circuit by building it first on a breadboard with the Arduino uno board. For your final custom circuit board make sure to use a 28pin socket for the atmega328 IC.
Step 4: The Code
Here's the code, embedded using Codebender!
Before you proceed:
- Attach your ATmega328 IC to the Arduino uno board
- Remove the RX and TX cables from the Arduino board.
Add your information in the code below by pressing the "Edit" button:
- #define SSID "name" // "SSID-WiFiname"
- #define PASS "password" // "password"
- String msg = "GET /update?key=YOUR_WRITE_KEY"; //change it with your write key...
- curPre=1023.25; // Change it with current pressure of your city, find it here: https://www.wunderground.com
You can only really do a good accurate job of calculating altitude if you know the hPa pressure at sea level for your location and day! The sensor is quite precise but if you do not have the data updated for the current day then it can be difficult to get more accurate than 10 meters.
Try downloading the Codebender plugin and clicking on the "Run on Arduino" button to program your Arduino board with this sketch. And that's it, you've programmed your Arduino board directly from your browser! Now you can re-connect the RX and TX cables - or attach the ATmega328 IC back to your custom circuit.
Now check your ThingSpeak channel to see the first sensor's info!
Note: If you want to use the Arduino IDE instead Codebender you will need to manual add the necessary libraries. Try to find the on google.
Step 5: Find Max Range
How can you find the max range for your network? It's simple, go to an open area and open a command prompt (on Windows OS) and type:
ping 192.168.1.19 -t
Change the IP if necessary / the "-t" will send pings continuously, make sure that the ESP8266 and your computer is already connected with your WiFi router.
Take the ESP8266 and start walking to one direction. (use the 3.7 battery for power source), leave someone behind to watch the computer screen.
When you will receive "Destination host unreachable." (or something like that) stop and measure your distance.
In my case with a WiFi router with 2 5dBi antennas I measured 200 meters. Try to use a bigger antenna to extend this range.
Step 6: Well Done!
That's it! You have successfully complete this guide and now you have your own Arduino based IOT system ready to... fly!
I will also put a video and share my channel info soon! Make sure to mark it as favorite!
For more Arduino tutorials and cool projects you can visit our web page: www.ardumotive.com
I hope you liked this, let me know in the comments!
If you liked it, you can also vote it ! Check the upper right corner ;-)