Based on original project Car Engine Parameters Visualization, we developed a newer version of this project in order to work with the new firmware version of Carberry.
Differences between previous version:
How we did this
Raspberry Software Limit - QT5 Solution
The first problem in order to draw with Raspberry some gauges was the hardware acceleration, in fact at the moment with none of OS available for Raspberry is possible to get a Desktop Session Hardware Accelerated, that means that all graphic calculations that should be manage by SoC GPU are managed by SoC CPU with an higher resource usage and a worst result. A gauge that moves slowly or lagged is useless... After tons of web searches and tests:
I found that the UNIQUE solution, for the moment, to allow to an application to use the Raspberry Hardware Acceleration was to use the QT5 programming language.
How to install QT5 on Raspberry
QT5 unfortunately is not available on Raspbian repository, and for this reason must be built manually. There are two ways to do that:
Remember that Raspbian must be modified in order to work with Carberry, you could do that following this guide: http://www.carberry.it/wiki/carberry:rpi:linux:distrib:raspbian_yourself
How to draw Gauges - QML
Carberry OBD Info Panel Project Download: Carberry - OBD Info Panel - QT Project - v2.0
How to update gauge value
Called by 2 timers that work at different speed:
The first timer calls the function "update_speed_rpm_usage" every 100ms because these information must be updated as fast as possible.The function calls a PHP called ajax_commands.php that returns a JSON output with the value of SPEED and RPM.
The second timer calls the function "update_air_fuel" every 5 seconds because are information that don’t require a fast update. The function calls a PHP called ajax_commands.php that returns a JSON output with the value of AIR TEMPERATURE and FUEL LEVEL.
How the socket communication works
As previously said the communication between QML and the socket is managed by PHP, that opens a connection to 127.0.0.1 at the port 7070 where the Carberry daemon runs, sends the right command, as described in the wiki http://www.carberry.it/wiki/carberry:cmds:subsys:obd:query_new, read the value, return the value in JSON format.
How to setup Carberry in order to communicate with the car
The new way to communicate with OBD ports is a bit more tricky but is more complete and allows any kind of communication with car OBD port.
Canbus 11bit working example
Canbus 29bit working example
The PHP script is available here: Carberry - OBD Info Panel - PHP Script - v2.0
Compile and Run
To run the QML application we need just to copy the project folder to "/home/pi" Enter in the directory
Build the application
To run the application
To run the application on boot we need to edit the /etc/rc.local file
sudo nano /etc/rc.local
Add before "exit 0"
The PHP script must be placed in the Webserver Document Root (by default) is /var/www/html
The OBD connections can be found at this link: http://www.carberry.it/wiki/carberry:hardware:parallel_connection
Carberry OBD Info Panel Ready Image (8GB SD required): Carberry - OBD Info Panel - V2.0