ESP32 GPS-Module in Camper

Hello,

I’m new to the whole Home Assistant and ESP universe. Therefore, I need help with a project.

I want to connect a “GY-GPS6MU2” with a “NEO-M8N-0-10” with an “ESP32 C3 supermini” so that my location data can be accessed in Home Assistant.

I’ve assigned the pins as follows:
VCC = 3.3V
GND = GND
RX = 20
TX = 21

But I can’t find any code to configure the ESP correctly.

Can anyone help me?

Thanks in advance

esphome:
  name: gps_c3_supermini
  comment: GPS6MU2 + ESP32‑C3 SuperMini

esp32:
  board: esp32c3_devkitm // ajusta al nombre correcto según tu placa
  framework:
    type: esp-idf
wifi:
  ssid: "TU_SSID"
  password: "TU_PASS"

time:
  - platform: gps
    id: gps_time

uart:
  tx_pin: GPIO17  # rx gps
  rx_pin: GPIO16  # tx gps
  baud_rate: 9600

gps:
  latitude:
    name: "GPS Latitud"
  longitude:
    name: "GPS Longitud"
  altitude:
    name: "GPS Altitud"
  satellites:
    name: "Satélites visibles"
  speed:
    name: "Velocidad GPS"
  fix_type:
    name: "Tipo de Fix GPS"

sensor:
  - platform: uptime
    name: "Tiempo encendido ESP"

logger:
  level: DEBUG

ota:
  safe_mode: true

whit the neo

esphome:
  name: gps_m8n_esp32c3
  comment: Configuración ESP32‑C3 con NEO-M8N

esp32:
  board: esp32c3_devkitm
  framework:
    type: esp-idf

wifi:
  ssid: "TU_SSID"
  password: "TU_PASS"

time:
  - platform: gps
    id: gps_time

uart:
  rx_pin: GPIO16  # TX del GPS
  tx_pin: GPIO17  # not rerquires only if you want to send commands
  baud_rate: 9600  #  38400 or 115200

gps:
  latitude:
    name: "Latitud GPS"
  longitude:
    name: "Longitud GPS"
  altitude:
    name: "Altitud GPS"
  speed:
    name: "Velocidad GPS"
  satellites:
    name: "Satélites visibles"
  accuracy:
    name: "Precisión GPS"
  fix_type:
    name: "Tipo de Fix"

sensor:
  - platform: uptime
    name: "Tiempo encendido ESP"

logger:
  level: DEBUG

ota:
  safe_mode: true

And not forgetting that once you have longtitude and latitude sensors into HA, you can use the action homeassistant.set_location to update it into your HA.

Thanks for the quick reply.

But somehow I can’t configure it.

I keep getting the error message.

"INFO ESPHome 2025.6.2
INFO Reading configuration /config/esphome/gps.yaml…
ERROR Error while reading config: Invalid YAML syntax:

Duplicate key “esphome”

  • in “/config/esphome/gps.yaml”, line 33, column 1*
    NOTE: Previous declaration here:
  • in “/config/esphome/gps.yaml”, line 1, column 1*"

what am I doing wrong?

You need to post your config with line numbers.

Read what the error message tries to tell you.
I could imagine that on line 33 you have duplicate of core configuration
esphome:

Maybe other duplicates as well…

I’ve already read it, but I don’t know what to do. If I delete the duplicate lines, another error occurs.

Here’s the error:
"INFO ESPHome 2025.6.2
INFO Reading configuration /config/esphome/gps.yaml…
Failed config

captive_portal: [source /config/esphome/gps.yaml:33]

[esphome] is an invalid option for [captive_portal]. Please check the indentation.
esphome:
name: gps_m8n_esp32c3
comment: Configuración ESP32‑C3 con NEO-M8Nh"

here the configuration:

esphome:
  name: gps
  friendly_name: gps

esp32:
  board: esp32-c3-devkitm-1
  framework:
    type: esp-idf

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "*******************************************"

ota:
  - platform: esphome
    password: "********************************"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Gps Fallback Hotspot"
    password: "************"

captive_portal:

 esphome:
  name: gps_m8n_esp32c3
  comment: Configuración ESP32‑C3 con NEO-M8N




time:
  - platform: gps
    id: gps_time

uart:
  rx_pin: GPIO20  # TX del GPS
  tx_pin: GPIO21  # not rerquires only if you want to send commands
  baud_rate: 9600  #  38400 or 115200

gps:
  latitude:
    name: "Latitud GPS"
  longitude:
    name: "Longitud GPS"
  altitude:
    name: "Altitud GPS"
  speed:
    name: "Velocidad GPS"
  satellites:
    name: "Satélites visibles"
  accuracy:
    name: "Precisión GPS"
  fix_type:
    name: "Tipo de Fix"

sensor:
  - platform: uptime
    name: "Tiempo encendido ESP"

thank you for help

Looks like you have 2 esphome entries with the second using (improper) indentation.

just add this to your original code

after

captive_portal:

time:
  - platform: gps
    id: gps_time

uart:
  rx_pin: GPIO20  # TX del GPS
  tx_pin: GPIO21  # not rerquires only if you want to send commands
  baud_rate: 9600  #  38400 or 115200

gps:
  latitude:
    name: "Latitud GPS"
  longitude:
    name: "Longitud GPS"
  altitude:
    name: "Altitud GPS"
  speed:
    name: "Velocidad GPS"
  satellites:
    name: "Satélites visibles"
  accuracy:
    name: "Precisión GPS"
  fix_type:
    name: "Tipo de Fix"

sensor:
  - platform: uptime
    name: "Tiempo encendido ESP"

than i got this error

 INFO ESPHome 2025.6.2
INFO Reading configuration /config/esphome/gps.yaml...
INFO Detected timezone 'Europe/Berlin'
Failed config

gps: [source /config/esphome/gps.yaml:42]
  - latitude: 
      name: Latitud GPS
    longitude: 
      name: Longitud GPS
    altitude: 
      name: Altitud GPS
    speed: 
      name: Velocidad GPS
    satellites: 
      name: Satélites visibles
    
    [accuracy] is an invalid option for [gps]. Please check the indentation.
    accuracy: 
      name: Precisión GPS
    
    [fix_type] is an invalid option for [gps]. Please check the indentation.
    fix_type: 
      name: Tipo de Fix

As you can see, accuracy and fix_type are NOT options for GPS.

I am not sure why @WarLion has them in his example.

yeah sorry was a old version code accuracy is now HDOP

and for the fix remove it

this will be a complete code

esphome:
  name: cvgbn
  friendly_name: cvgbn

esp32:
  board: esp32-c3-devkitm-1
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "1fjHxOV0rhj6t8Fgr267HFmRrRB3Y18FFAxL7mZZWXM="

ota:
  - platform: esphome
    password: "5a1f960261257e2a9e4d54b483fd1edb"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Cvgbn Fallback Hotspot"
    password: "OLVYiqDPeoPe"

captive_portal:
    
time:
  - platform: gps
    id: gps_time

uart:
  rx_pin: GPIO20  # TX del GPS
  tx_pin: GPIO21  # not rerquires only if you want to send commands
  baud_rate: 9600  #  38400 or 115200

gps:
  latitude:
    name: "Latitud GPS"
  longitude:
    name: "Longitud GPS"
  altitude:
    name: "Altitud GPS"
  speed:
    name: "Velocidad GPS"
  satellites:
    name: "Satélites visibles"
  hdop:
    name: "Precisión GPS"


sensor:
  - platform: uptime
    name: "Tiempo encendido ESP"


remove that

One more note - from experience in my camper. The weather integrations do not update based on home location changes by default. Actually, I believe the stock weather integration is the only one even capable of this, but there is a setting you have to change to enable this. I posted about it here - although I haven’t verified/tested it under version 2025.6.2 or later…

Dynamic Weather

1 Like

than i got this error :frowning:

INFO ESPHome 2025.6.2
INFO Reading configuration /config/esphome/gps.yaml...
INFO Detected timezone 'Europe/Berlin'
Failed config

gps: [source /config/esphome/gps.yaml:42]
  
  This feature is only available with frameworks ['arduino'].
  - latitude: 
      name: Latitud GPS
    longitude: 
      name: Longitud GPS
    altitude: 
      name: Altitud GPS
    speed: 
      name: Velocidad GPS
    satellites: 
      name: Satélites visibles
    hdop: 
      name: Precisión GPS

change this part of your code

l
INFO ESPHome 2025.6.2
INFO Reading configuration /config/esphome/gps.yaml...
INFO Detected timezone 'Europe/Berlin'
INFO Starting log output from ********** using esphome API
INFO Successfully resolved gps @ ************ in 0.000s
INFO Successfully connected to gps @ ************* in 0.080s
INFO Successful handshake with gps @ *************** in 0.052s***************
[20:59:02][I][app:137]: ESPHome version 2025.6.2 compiled on Jul  1 2025, 20:18:03
[20:59:02][C][wifi:613]: WiFi:
[20:59:02][C][wifi:434]:   Local MAC: **************
[20:59:02][C][wifi:439]:   SSID: [redacted]
[20:59:02][C][wifi:442]:   IP Address: *************
[20:59:02][C][wifi:451]:   BSSID: [redacted]
[20:59:02][C][wifi:451]:   Hostname: 'gps'
[20:59:02][C][wifi:451]:   Signal strength: -61 dB ▂▄▆█
[20:59:02][C][wifi:462]:   Channel: 3
[20:59:02][C][wifi:462]:   Subnet: ****************
[20:59:02][C][wifi:462]:   Gateway: ****************
[20:59:02][C][wifi:462]:   DNS1: ****************
[20:59:02][C][wifi:462]:   DNS2: 0.0.0.0
[20:59:02][C][logger:215]: Logger:
[20:59:02][C][logger:215]:   Max Level: DEBUG
[20:59:02][C][logger:215]:   Initial Level: DEBUG
[20:59:02][C][logger:220]:   Log Baud Rate: 115200
[20:59:02][C][logger:220]:   Hardware UART: USB_CDC
[20:59:02][C][logger:224]:   Task Log Buffer Size: 768
[20:59:02][C][uart.arduino_esp32:151]: UART Bus 0:
[20:59:02][C][uart.arduino_esp32:152]:   TX Pin: GPIO21
[20:59:02][C][uart.arduino_esp32:153]:   RX Pin: GPIO20
[20:59:02][C][uart.arduino_esp32:155]:   RX Buffer Size: 256
[20:59:02][C][uart.arduino_esp32:162]:   Baud Rate: 9600 baud
[20:59:02][C][uart.arduino_esp32:162]:   Data Bits: 8
[20:59:02][C][uart.arduino_esp32:162]:   Parity: NONE
[20:59:02][C][uart.arduino_esp32:162]:   Stop bits: 1
[20:59:02][C][gps:014]: GPS:
[20:59:02][C][gps:015]:   Latitude 'Latitud GPS'
[20:59:02][C][gps:015]:     State Class: 'measurement'
[20:59:02][C][gps:015]:     Unit of Measurement: '°'
[20:59:02][C][gps:015]:     Accuracy Decimals: 6
[20:59:02][C][gps:015]:     Icon: 'mdi:latitude'
[20:59:02][C][gps:016]:   Longitude 'Longitud GPS'
[20:59:02][C][gps:016]:     State Class: 'measurement'
[20:59:02][C][gps:016]:     Unit of Measurement: '°'
[20:59:02][C][gps:016]:     Accuracy Decimals: 6
[20:59:02][C][gps:016]:     Icon: 'mdi:longitude'
[20:59:02][C][gps:017]:   Speed 'Velocidad GPS'
[20:59:02][C][gps:017]:     State Class: 'measurement'
[20:59:02][C][gps:017]:     Unit of Measurement: 'km/h'
[20:59:02][C][gps:017]:     Accuracy Decimals: 3
[20:59:02][C][gps:017]:     Device Class: 'speed'
[20:59:02][C][gps:017]:     Icon: 'mdi:speedometer'
[20:59:02][C][gps:019]:   Altitude 'Altitud GPS'
[20:59:02][C][gps:019]:     State Class: 'measurement'
[20:59:02][C][gps:019]:     Unit of Measurement: 'm'
[20:59:02][C][gps:019]:     Accuracy Decimals: 2
[20:59:02][C][gps:019]:     Icon: 'mdi:altimeter'
[20:59:02][C][gps:020]:   Satellites 'Satélites visibles'
[20:59:02][C][gps:020]:     State Class: 'measurement'
[20:59:02][C][gps:020]:     Unit of Measurement: ''
[20:59:02][C][gps:020]:     Accuracy Decimals: 0
[20:59:02][C][gps:020]:     Icon: 'mdi:satellite-variant'
[20:59:02][C][gps:021]:   HDOP 'Precisión GPS'
[20:59:02][C][gps:021]:     State Class: 'measurement'
[20:59:02][C][gps:021]:     Unit of Measurement: ''
[20:59:02][C][gps:021]:     Accuracy Decimals: 3
[20:59:02][C][uptime.sensor:033]: Uptime Sensor 'Tiempo encendido ESP'
[20:59:02][C][uptime.sensor:033]:   State Class: 'total_increasing'
[20:59:02][C][uptime.sensor:033]:   Unit of Measurement: 's'
[20:59:02][C][uptime.sensor:033]:   Accuracy Decimals: 0
[20:59:02][C][uptime.sensor:033]:   Device Class: 'duration'
[20:59:02][C][uptime.sensor:033]:   Icon: 'mdi:timer-outline'
[20:59:02][C][uptime.sensor:034]:   Type: Seconds
[20:59:02][C][captive_portal:089]: Captive Portal:
[20:59:02][C][esphome.ota:077]: Over-The-Air updates:
[20:59:02][C][esphome.ota:077]:   Address: gps.local:3232
[20:59:02][C][esphome.ota:077]:   Version: 2
[20:59:02][C][esphome.ota:080]:   Password configured
[20:59:02][C][safe_mode:018]: Safe Mode:
[20:59:02][C][safe_mode:025]:   Boot considered successful after 60 seconds
[20:59:02][C][safe_mode:025]:   Invoke after 10 boot attempts
[20:59:02][C][safe_mode:025]:   Remain for 300 seconds
[20:59:02][C][api:185]: API Server:
[20:59:02][C][api:185]:   Address: gps.local:6053
[20:59:02][C][api:187]:   Using noise encryption: YES
[20:59:02][C][mdns:125]: mDNS:
[20:59:02][C][mdns:125]:   Hostname: gps
[20:59:09][D][sensor:099]: 'Latitud GPS': Sending state nan ° with 6 decimals of accuracy
[20:59:09][D][sensor:099]: 'Longitud GPS': Sending state nan ° with 6 decimals of accuracy
[20:59:09][D][sensor:099]: 'Velocidad GPS': Sending state nan km/h with 3 decimals of accuracy
[20:59:09][D][sensor:099]: 'Altitud GPS': Sending state nan m with 2 decimals of accuracy
[20:59:09][D][sensor:099]: 'Satélites visibles': Sending state 0.00000  with 0 decimals of accuracy
[20:59:09][D][sensor:099]: 'Precisión GPS': Sending state nan  with 3 decimals of accuracy

Thanks to your help, I was able to configure it now.

But no coordinates are displayed, just “nan.”

The antenna hangs out the window, so it should have reception.

I’ve already swapped the RX and TX, but there’s no change.

im sorry this is as far i can go as i dont have your gps to test, maybe need time to get signal to satélite ,

can you show us your circuit a picture or you wiring and your code to check if you are connecting your wires correct

I don’t have this board either, but have ordered a similar one out of interest. I’d say for troubleshooting, don’t connect anything to the gps RX pin. Connect the GPS TX pin to the GPIO you have assigned as RX in esphome - I believe 20. And then let it sit for a while. From what I’ve read, it can take a bit of time to get a lock.

In your UART config, use the debug option to monitor the serial data being received. If none, you have a wiring or hardware problem. If it’s garbled non-ascii data, you probably have the wrong baud rate. If it’s NMEA sentences it should work, or at least report something.

2 Likes