Skip to content

A topic of GPS IOT application for use with MicroPython and ESP8266 mini D1.Send the datas to the server and display it on the Google map.

License

Notifications You must be signed in to change notification settings

pinze/MicroPython_GPS_IOT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MicroPython_GPS_IOT

A topic of GPS IOT application for use with MicroPython and ESP8266 mini D1.Send the datas to the server and display it on the Google map.

Modules

1. ESP8266:

  • mini-mcu wifi board
  • 11 digital I/O pins
  • 1analog input
  • 4 MB flash

2. 0.96 inch OLED

  • ssd1306 0.96 inch OLED display
  • I2C driver

3. DHT11 Humidity&Temperature Sensor

4. GY-GPS6MV2(blox NEO-6M)

  • UART TTL connector
  • EEPROM to store settings

Writing

D1 mini 6MV2 DHT11 OLED
3.3 VCC VCC VCC
GND GND GND GND
Rx Tx
Tx Rx
GPIO 4 Single
SCL(GPIO 13) SCL
SDA(GPIO 12) SDA

Server

https://github.com/DDPlay123/IoT_Python_Server

D1 mini set up

  1. Import webrepl_setup
  2. boot.py setting
  3. set your wifi's name and password in boot
  4. burn main.py into D1 mini

main

# Main function
gps = GPS()
oled = OLED()
#d = dht.DHT11(Pin(2))

def loop():
    global gps, oled, api, d4
    
    gpsStr = b''
    gpsReading = False    
    
    while True:
        data = gps.getGPSInfo()
        #d.measure()
        #if data and (gpsReading or ('$GNRMC' in data)) :  #You need to check your GPS data is GPMRC or GNMRC
        if data and (gpsReading or ('$GPRMC' in data)) :
            gpsStr += data
            if '\n' in data:
                gpsReading = False
                #temp = d.temperature()
                #hum = d.humidity()
                lat, long= gps.convertGPS(gpsStr)
                oled.displayGPS(lat, long)
                # Send lat&long to Web Server

                
                value1 = '{"longitude":'+'"'+long+'"'+','
                value2 = '"latitude":'+'"'+lat+'"'+','
                #value3 = '"temp":'+'"'+str(temp)+'"'+','
                #value4 = '"humid":'+'"'+str(hum)+'"}'
                data = value1+value2#+value3+value4
                r = requests.post(url,data=data,headers=header)
                #############
                
                gpsStr = b''
                gc.collect()    #clear memory
                break
            else:
                gpsReading = True

About

A topic of GPS IOT application for use with MicroPython and ESP8266 mini D1.Send the datas to the server and display it on the Google map.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages