If you drive around a neighborhood like mine, you quickly get tired of jolting in and out of potholes, not to mention the damage they are doing to your car.
After heavy rain, it can take months until the road authority finds the potholes and repairs them.
What if you could send an online map of all the potholes you saw to the department who looks after road fixing.
This project describes an Arduino Nodemcu device to get and hold the pothole’s GPS location and send this data to the Thingspeak web site.
Another web site (here) then extracts the data from Thingspeak and uses Mapquest to display a map showing the locations of the potholes.
A link, printout or screen capture of this map can then be sent to the local authority responsible for road maintenance
This device could also be used to collect and map the locations of anything; - wayward shopping trolleys, roadkill, the 'treasures' in a treasure hunt. Its uses are limited only by your imagination.
Although the function of this device could certainly be created on a mobile phone, in many countries it is illegal to use a mobile phone while driving.
Step 1: Parts & Tools
All the items were purchased from aliexpress.com. They are also available on Ebay.com.
They cost around $US18, €17.30, £15.60, $A25 in total
NodeMCU - ESP8266 ESP-12E
Red led, Green Led, Blue Led---I brought all these Leds in an assorted pack of 100
3 x 330 ohm resistors
GPS sender - V.KEL VK2828U7G5LF
Plastic box around 100mm x 60mm (4in x 2.5 in)
A variety of colored connection wire
12 v car plug to micro USB, or a mobile phone battery pack and USB cable
Soldering Iron or a breadboard such as the MB102
PC , MAC or Linux machine
Step 2: Assembly
It might be best to assemble the components on a breadboard, as this gives you a chance to make sure all the components are working. Use the Fritzing diagram to connect them all together.
Connect the GPS unit to the Nodemcu using the wire colors in the diagram. All of these GPS units I have seen advertised for sale have the same wire colors, but just in case yours doesn’t, here are the connections from the GPS unit to the Nodemcu board
B – Not Used
V - +3.3
T - to D6
R - to D7
G – to GND
E – Not Used
Be careful with the Leds. The longer leg is the positive (+) and goes to the wire to the Nodemcu pin
The shorter leg is the negative (-) and goes to the resistor.
Step 3: Code Loading
- Using a USB cable, connect the Nodemcu to your PC, Mac or Linux and install the Arduino Software - code here
- Install the TinyGPS++ library - GPS Code Library
- Go to My Github page and get the file ESP8266_GPS_Prod.ino. Put it into the directory Arduino\libraries
- Configure the Arduino software for the Nodemcu – Helpful instructions here
Step 4: Setup
Setup your Thingspeak Account
1. Go to Thingspeak and sign up for an account (its free)
2. See here for instructions. Use these instructions to create your channel exactly as described, as I don't use the actual field names.
3. Write down your 'Channel Id' and 'Write API Key'
Configure the Arduino code for your own environment
1. Start the Arduino software on your PC, Mac or Linux
2. Open the program ESP8266_GPS_Prod and change the following lines 29 - 31
String apiKey = "YourThingSpeakKey";
replace with your channel’s Write API Key
const char* ssid = "SSID";
replace with the SSID (the name) of your router or other network device
const char* password = "password";
replace with the password of your router or other network device
3. Save the file, Verify/Compile and Upload the code to the Nodemcu
Step 5: Testing
- After the program loads, if the device is in you WiFi zone, the WiFi (green ) led should light up
(my Nodemcu worked up to 150 metres/500 feet from my router)
- Using the USB cable, either
attach a mobile power bank to the device and go outside your house
go into your car and attach 12V car to USB plug to the device
- Go far enough away from your router for the WiFi light to stop lighting up
- After about 30 seconds you should see the GPS (blue) led light to show a stable GPS signal
- Push the pushbutton switch. The Collect/Send (red) led will quickly light to show that the coordinates were stored in EEPROM ( non volatile) memory
- Wander/drive around and push the pushbutton to get and save multiple locations
- Remove the power and take the device back into your WiFi zone
- Apply power (mobile power bank, android mobile phone charger, PC, MAC etc)
- The the WiFi (green ) led should light up and the Collect/Send (red) led will light to show that the GPS data (Latitude and Longitude) are being sent to Thingspeak.
As Thingspeak only allows you to send data at a maximum of once every 15 seconds, it may take a while to send all the locations
- When the Collect/Send (red) led goes out, all the data has been sent.
- In your web browser, go to here and select START MAPPING. Put in your Thingspeak Channel Id and select Show the Map
- You should see a map containing a blue icon for each location. You can zoom and move the map, print or screen print it.
Step 6: Usage
- If you haven't already, use the Stanley knife to cut out the holes in the plastic box for the GPS unit, Leds and pushbutton, solder the components together and box up the device into the plastic box, using the glue gun to keep them in place. (I have included a Word template for the box top here).
I put a small piece of plastic sheet under the Nodemcu to prevent shorting on the other components
- See the movie above on using the device and displaying the map
- To clear out the location data, sign onto Thingspeak, select the channel, select Channel Settings and select Clear Channel.
- In use the device can be velcroed to the dashboard, but I found it works fine just sitting on the seat or center console
- If you want to email the link for the map generated from your channel, the link is
http://mcpotholes.com/mapdisplay.php?cid=123456 - replace 123456 with your channel number
Add an accelerometer (eg GY-521) device and additional Arduino code to automatically register the location of the pothole when you drive over it, if you really want to drive through every pothole!
Add an extra wifi connection to the Arduino program, so that the device can transmit data at your home or at the office
Add an internal 3.7V 1200MAH LiPo battery and charger circuit and give yourself 15 hours “off the grid” between charges
You can also download a list of locations from Thingspeak to use in another app or website
A big thank you to the owners/creators of the various web sites I have included for setup or instructions.
They explained their areas much better than I could