Work In Progress.
Adapted to suit MY hardware, some of which I already owned (OBDLink MX+, USB GPS antenna, Huawei MS2372H-517 4G Modem).
I don't suggest that someone else repeat these steps, as I would do things differently if I had to do it again. But I still want to document what I did, mostly for myself:
Python Version of EVNotify
- Raspberry Pi Zero W with GPIO Header https://buyzero.de/collections/boards-kits/products/raspberry-pi-zero-w-easy-mit-bestucktem-header
- OTG cable for Raspberry Pi https://buyzero.de/collections/raspberry-kabel-und-adapter/products/micro-usb-zu-usb-otg-adapter
- Small wires in different colors: https://www.amazon.de/AZDelivery-Jumper-Arduino-Raspberry-Breadboard/dp/B07KYHBVR7?tag=gplay97-21
- LTE Stick Huawai MS2372H-517, which works for me in Canada. I had great difficulty finding an LTE stick that works in Canada. But I didn't realize before buying that this stick did not have Wi-Fi, so it complicated my setup by forcing me to buy a USB hub, which wouldn't be needed if if the Pi connected to the Internet via Wi-Fi. If I were to buy again, I would try and find one that has Wi-Fi. Setup would have been much simpler.
- Rapberry Pi USB Hub, to be able to connect both my LTE stick and the GPS antenna: https://www.amazon.ca/MakerSpot-Stackable-Raspberry-Connector-Bluetooth/dp/B01IT1TLFQ
- USB GPS antenna: https://www.amazon.ca/Navigation-External-Receiver-Raspberry-Geekstory/dp/B078Y52FGQ
- OBDLink MX+ that I alrady owned: https://www.amazon.ca/OBDLink-Bluetooth-Professional-Grade-Diagnostic-Performance/dp/B07JFRFJG6. It would have been simpler to buy a PiCan. But I already owned this device and I'm cheap.
- The i2c watchdog and power supply, https://github.com/noradtux/evnotipi-watchdog. I modified this design to use a buck converter as the power supply instead of the linear regulator, and a relay instead of the mosfets, both of which I already owned (Again, I'm cheap). The (DPDT) relay also allows me to completely turn off the power to the OBDII dongle.
- OBD2 male and female connectors: https://www.aliexpress.com/item/4000087243731.html
- I designed & 3D-printed my modified version of the case https://github.com/noradtux/evnotipi-case.
OBD2
4,5 GND
6 CAN_H
14 CAN_L
16 12V
I only connected Pin4 to Ground as it is documented as Chassis Ground. Pin5 is the Signal Ground, I wanted to make sure I don't contaminate it.
sudo apt updatesudo apt upgradesudo apt install python3-{pip,rpi.gpio,serial,requests,sdnotify,pyroute2,smbus,yaml,gevent} gpsd gpsd-clients git watchdog rsyslog-sudo systemctl disable --now serial-getty@ttyAMA0.servicesudo sed -i -re "\$agpu_mem=16\nmax_usb_current=1\ndtoverlay=gpio-poweroff,gpiopin=4,active_low=1\ninitial_turbo=60\nboot_delay=0\ndisable_splash=1" -e "/^dtparam=audio=/ s/^/#/" /boot/config.txtsudo sed -i -re '/console=/ s/$/ panic=1/' /boot/cmdline.txtsudo sed -i -re '/max-load/ s/^#//' /etc/watchdog.confsudo sed -i -re "\$adtparam=watchdog=on" /boot/config.txt
sudo sed -i -re "\$adtparam=i2c_arm=on,i2c_arm_baudrate=50000" /boot/config.txtsudo sed -i -re "\$ai2c-dev" /etc/modules
sudo git clone https://github.com/DBestman/EVNotiPi /opt/evnotipicd /opt/evnotipisudo rm -r extras/# Don't need this folder to operatesudo git ls-files --deleted -z | sudo git update-index --assume-unchanged -z --stdin# Tell git to ignore the files deleted above.sudo pip3 install -r requirements.txtsudo systemctl link /opt/evnotipi/evnotipi.servicesudo systemctl enable evnotipi.servicesudo cp config.yaml.template config.yaml
sudo nano config.yaml# nano or any other editor
sudo bluetoothctl- [bluetooth]#
power on - [bluetooth]#
scan on
- [bluetooth]#
scan off - [bluetooth]#
pair <MAC> - [bluetooth]#
quit sudo rfcomm bind 0 <MAC>ls /dev/rfcomm0# /dev/rfcomm0 should appearsudo systemctl link /opt/evnotipi/rfcomm-bind@.servicesudo systemctl enable rfcomm-bind@<MAC>.service
sudo nano USBModem.rules# nano or any other editorsudo ln -s /opt/evnotipi/USBModem.rules /etc/udev/rules.d/20-USBModem.rules# Install USBModem.rules : http://reactivated.net/writing_udev_rules.html#whysudo udevadm control --reload-rules && sudo udevadm trigger# reload udev rulessudo apt install wvdialsudo mv /etc/wvdial.conf /etc/wvdial.conf.bak# back up old configuration filesudo ln -s /opt/evnotipi/wvdial.conf /etc/wvdial.conf# use my wvdial configuration filesudo nano /etc/wvdial.conf# nano or any other editorsudo wvdial# check that wvdial workssudo systemctl link /opt/evnotipi/wvdial.{path,service}sudo systemctl enable wvdial.{path,service}
Verify that the GPS receiver is working correctly. If not, see a tutorial here: https://maker.pro/raspberry-pi/tutorial/how-to-use-a-gps-receiver-with-raspberry-pi-4
cgps -s
Because of a bug where the GPS position is not updated, I added a command (ExecStartPre=ubxtool -p RESET) in evnotipi.service, to be run before evnotipi. See https://www.reddit.com/r/raspberry_pi/comments/sthxpg/why_does_gpsd_not_update_a_location_past_its/
sudo sed -i -re '/^ExecStart=.*/i ExecStartPre=ubxtool -p RESET' evnotipi.service
RaspAP allows the Pi to become a wireless access point, enabling access to Internet when you're in your car.
Follow the instructions here: https://docs.raspap.com/ap-sta/.
I had to uninstall/reinstall RaspAP several times before I could configure properly, but I don't remember what were the difficulties. Maybe it was a buggy version.
cd /var/www/htmlsudo installers/uninstall.sh
Debug with
systemd-analyze && systemd-analyze blame && systemd-analyze critical-chain evnotipi.service
sudo raspi-config nonint do_boot_wait 1# Don't wait for network connection on boot. This saves a few seconds.sudo sed -i -re '/console=/ s/$/ quiet fastboot/' /boot/cmdline.txtsudo systemctl disable keyboard-setup.service# Keyboard not needed for headlesssudo systemctl disable triggerhappy.{service,socket}# Unless you have an external joystick or something that uses `/dev/input/`sudo systemctl mask systemd-rfkill.service# Disabling won't work. Unless you have a hardware button to disable the WIFI you won't need this