Vehicle tracker and boat sensor display (Project Samosa)

Project Samosa

The yacht club (APSC) bought a Jeanneau 36i in November 2024 and we thought we could add a few extra sensors and display data on an app using a tablet.

MIT App Inventor is quite easy to use and free.  I have bought an ESP32 that gathers the data from the sensors and sends it to a pi Compute 4 (Sail Assist) that also sends boat data to the tablet.

More later...


Vehicle tracker (not used any more)

My "van pi" (thanks Sue H) has various sensors attached.

I have an independent leisure battery.  I have to charge this separately, as and when, at the moment.  

Battery monitoring: I have an INA219 battery sensor that shows voltage, and current / power being used.

I have a DHT20 sensor that measures temperature and humidity in the van (but in a cupboard where the sensor is located).

A python program I called vansensors.py collects the data and sends it via MQTT to HA.

I have a USB gps unit that lets the pi know where it is.  I have a program, gpsdatatest.py, that reads the USB gps unit and MQTTs the data to HA. It sends the time, latitude, longitude, track (COG) and speed.

The pi can connect via hotspot to an old Samsung mobile with a Giffgaff SIM so that it can transfer data to Home Assistant on the pi model 4 when out of range of my home router.

The above all works, and I can see the battery (voltage, current and power), temperature and humidity, and the van location, etc (lat, long, COG and speed) at any given time on the HA dashboard.

I collect the location data in a position.csv file on the pi 3B.  I can copy and paste this data over SSH to notepad and then, via Google maps, I can plot the waypoints on a map (menu, your places, maps, create map, import csv file).

But HA has a mapping system I can use.  I found this very counter intuitive!  But it does work.

I have installed gpsd and gps onto the pi.

In HA, I have installed a composite 'device tracker' - device tracker added to HACs integrations and added to configuration.yaml (but not sure if I am using this last bit or not!)

composite:

  trackers:

    - name: Me

      time_as: device_or_local

      require_movement: false

      entity_id: device_tracker.me

In HA, in 'known_devices.yaml' I have a device called ship. Not sure how I created this and when!

I created an automation with a trigger, when the sensor lat and log changed, and an action, to update the device called ship.

- id: '1676556206364'

  alias: Van

  description: van move

  trigger:

  - platform: state

    entity_id:

    - sensor.van_latitude

    - sensor.van_longitude

  condition: []

  action:

  - service: device_tracker.see

    data:

      dev_id: ship

      gps_accuracy: 12

      gps:

      - '{{ states(''sensor.van_latitude'') }}'

      - '{{ states(''sensor.van_longitude'') }}'

  mode: single

This gives ship the attributes of latitude and longitude so that it can be shown and tracked on a map card.








I won't be driving here!






 

Comments

Popular posts from this blog

Introductions

Weather station