Introduction: Autonomous Boat IOT Part
This autonomous Boat utilizes an automatic lake monitoring system that consists of an integrated circuit of sensors that gathers data and send them to a gateway where they can be stored and monitored by the user.
In this guide, we are focusing on the sensors part and posting data to the internet of the solar boat.
Sensors used:
- Arduino Mega 2560
- Arduino UNO (for testing)
- Arduino WiFi Shield
- 3 Ultrasonic sensor HC-SR04
- Dissolved Oxygen Probe (KIT-103D)
- Temperature Sensor LM35
- Turbidity Sensor SEN0189
- Compass GY-271
- GPS VK2828u7g5lf (Not Used at current state)
Check this for detailed -> Sensors used and sensor connection
Step 1: Setup the Software
Instead of Arduino IDE, I am using Atom Text Editor with platform.io, which allows me to code my software in C++, .cpp format with .h header instead of Arduino .ino format.
The iOT part that I used is ThingSpeak which allows me to send data using their API for my project. The drawback of free services is that I can only sent data once in 15 seconds. In this project, I am using only write method.
ThingSpeak Arduino Library: ThingSpeak Arduino
Step 2: If You Are New to ThingSpeak
Go to ThingSpeak.com, sign up an account.
After log in, Click on New Channel
ThingSpeak allows up to 8 fields for free account.
For this project, we used all 8 fields. (follow the pictures)
Save the channel
Step 3: Setup ThingSpeak and WiFi Shield at Arduino
In ThingSpeak Copy CHANNEL ID and Write API Key (in API Keys) and paste it in mega/src/parts/thingspeakAPI/internet.cpp
add SSID, password for WPA/WPA2 type WiFi in the code.
Step 4: Ultrasonic Sensor
Check SENSOR.md for detailed sensors connection
Name: HC-SR04
Pin Used: 3 sensors is used
Sonar echoPin trigPin
Sonar1 (Right) 2 3
Sonar2 (Left) 6 7
Sonar3 (Front) 8 9
Step 5: Temperature Sensor
Name: LM35 Temperature Sensor
Pin Used: Analog A1
Step 6: Dissolved Oxygen
Name: Part # KIT-103D
Pin Used: RX(Green): 14
TX(Yellow): 15
The code only works on Arduino Mega
Step 7: Turbidity Sensor
Name: Turbidity Sensor SEN0189
Mode: Analog (important)
Pin Used: Analog A0
Step 8: Compass
Name: Compass GY-271
Pin Used:
GY-273 Compass Module -> Arduino
VCC -> VCC
GND -> GND
SCL -> A5/SCL, (Use Pin 21 on the Arduino Mega)
SDA -> A4/SDA, (Use Pin 20 on the Arduino Mega)
DRDY -> Not Connected
Step 9: What to Do Next?
- GPS sensor have not setup
- Ultrasonic Sensor Avoidance System
- Using GPS and Compass, write algorithm to actuate the path after ultrasonic avoidance system.