Skip to content

dasTholo/EVNotiPi

 
 

Repository files navigation

EVNotiPi

Python Version of EVNotify

Needed Hardware

Variant 1 (MCP2515 based adapter with GPS); Recommended:

Variant 2 (MCP2515 based adapter without GPS):

Variant 2.1 (additional external GPS):

Variant 3 (Diamex OBD-Hat, the old default; does not support Renault Zoe):

Wiring

OBD2 connection

The case has a slot for a DB9 plug (the side with the pins). Connect the DB9 plug to CAN_H and CAN_L of the CAN-hat; connect GND and 12V to the watchdog. Pinout is as follows:

OBD2        DB9
4,5  GND    1,2
  6  CAN_H  3
 14  CAN_L  5
 16  12V    9

This pinout should be compatible to most DB9 to OBD2 cables. One can always build one's own cable, though.

Installation

Raspberry Pi

  • sudo apt update
  • sudo apt upgrade
  • sudo apt install python3-{pip,rpi.gpio,serial,requests,sdnotify,pyroute2,smbus,yaml,gevent} gpsd git watchdog rsyslog-
  • sudo systemctl disable --now [email protected]
  • sudo sed -i -re "\$agpu_mem=16\nmax_usb_current=1\nenable_uart=1\ndtoverlay=disable-bt\ndtoverlay=gpio-poweroff:active_low" -e "/^dtparam=audio=/ s/^/#/" /boot/config.txt
  • sudo sed -i -re '/console=/ s/$/ panic=1/' /boot/cmdline.txt
  • sudo sed -i -re '/max-load/ s/^#//' /etc/watchdog.conf
  • sudo sed -i -re "\$adtparam=watchdog=on" /boot/config.txt

If using MCP2515 based adapter:

  • sudo apt install dkms
  • sudo git clone https://github.com/noradtux/can-isotp /usr/src/can-isotp
  • sudo dkms add /usr/src/can-isotp
  • sudo dkms install -m can-isotp -v r26.ced84ca
  • sudo sed -i -re "\$adtparam=spi=on\ndtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25\ndtoverlay=spi-bcm2835-overlay" /boot/config.txt
  • echo -e "[Match]\nDriver=mcp251x\n\n[CAN]\nBitRate=500000\nRestartSec=100ms" | sudo tee /etc/systemd/network/can.network
  • sudo systemctl enable --now systemd-networkd

If using the i2c watchdog (the one with the Trinket M0):

  • sudo sed -i -re "\$adtparam=i2c_arm=on,i2c_arm_baudrate=50000" /boot/config.txt
  • sudo sed -i -re "\$ai2c-dev" /etc/modules

EVNotiPi

  • sudo git clone https://github.com/EVNotify/EVNotiPi /opt/evnotipi
  • cd /opt/evnotipi
  • sudo pip3 install -r requirements.txt
  • sudo systemctl link /opt/evnotipi/evnotipi.service
  • sudo systemctl enable evnotipi.service
  • sudo systemctl disable evnotipi_shutdown.{timer,service} # if updating
  • sudo cp config.yaml.template config.yaml

Edit config, follow comments in the file

  • sudo nano config.yaml # nano or any other editor

Optionally: Set up a GPS receiver

Set up gpsd, see a tutorial here: https://maker.pro/raspberry-pi/tutorial/how-to-use-a-gps-receiver-with-raspberry-pi-4. Once the "sudo cgps -s" command works, you are done.

About

Python Version of EVNotify

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%