Head-Up display based on OBDII for RPi zero W actually compatible with LCD screen 1602A and a rotary encoder.

My Smart ForTwo only have a revcounter if you pay it as an extra, mine didn't come with that extra and I don't want to pay it, so I decided to create one myself taking advantage of the OBD-II protocol.
The initial idea was to only get the rpm of the car, but as you will see, I implemented much more things.
All the program is written in Python3 and relies on the PYTHON-OBD library which extracts de data from the car.
The software can show:
- Engine RPM.
- Coolant Temperature.
- Gasoline consumption in L/100km (based in MAF sensor).
- Stop time to let the turbo cooldown.
In order to make RPMGauge, it needs PYTHON-OBD, a rotary-encoder library and my LCDLibrary; these last two are already implemented in the project. In my car, the release version of PYTHON-OBD doesn't work, so download the zip of the main branch and install it via:
$ pip install .or you can also try:
$ pip3 install .- Download the zip
- Edit constants.py to assign bluetooth obd ports and savefile root for the MPG.
- Edit main.py to edit the pins of the LCD and the rotary.
- Execute main.py
$ python3 main.pyThe basic usage relies on the object Menu and ECU commands, every Menu actually handles a maximum of 2 ECU commands. For example, to create a menu which displays the RPM in number and the gasoline consumption will be created this way:
Menu(RPMNumber(), Gas())
After created a Menu we now can create an object Car(), in this object we will specify the encoder object, the printer to use and a list of menus. It also contains the mainLoop and other features like consider a diesel car. Another basic example:
encoder = Encoder(13, 19, 6)
lcd = LCDHandler(d4=26, d5=19, d6=13, d7=6, en=5, rs=0)
main = Car(encoder, lcd, [menu1, menu2, menu3, menu4])
main.dieselCar() # Consider a diesel car
main.mainLoop()
You can take advantage of the already programmed main.py
Coolant()
DtcScreen()
RPMNumber()
RPMGraph()
Gas()
TimeTurbo()
Library for the controller ST7066U made by myself. Much faster than Adafruit one.
Le he realizado unos cambios para que funcione con el rotary conectado de GPIO -> GND, he añadido la función de un botón para los rotary con botón y lo he tratado como variable global.
Modelos 3D en formato stl de la caja en carpeta doc/Modelos
Cableados a la RPi en carpeta doc/Images
- Librería OBD original
- Librería Rotary encoder original
- Librería original LCD Adafruit
- Pantalla: LCD 1602
- Obd: elm327
- Rotativo
Para programarlo todo, he utilizado un OBD-II virtual el cual te ahorra bastante tiempo, ya que no necesitas bajar directamente al coche.
OBD II Codes.
Este programa permite utilizar la Raspberry como punto de anclaje Wi-Fi y de esta manera poder meter actualizaciones sin necesidad de sacar la Rpi de la caja.




