PyCosworth

The following is taken from my project which is hosted at: https://github.com/megatron-uk/PyCosworth

An example of the emulated LCD output from the program, running live against my Escort Cosworth:

And here you can see the actual physical output devices - one being an OLED screen for the main control, and small sub-screen showing a single sensor:


What is it?

PyCosworth is a monitoring, data-logging and diagnostic tool for vehicles equipped with the Magneti Marelli L8/P8 ECU which have the serial datastream protocol enabled.

This feature is often called the Pectel Datastream, but is simply a feature of the ECU itself - being turned on or off based on the type of ROM chip fitted to the ECU. Some aftermarket ROM chips available from tuning firms can optionally enable this feature where it was not available by the manufacturer.

PyCosworth interfaces with the serial datastream to display, monitor and log the information available via the serial datastream, similar to such products as:

These products are great for their intended use, but are either a: very expensive, or b: designed for use on a laptop. PyCosworth is intended to to on a cheap embedded device such as a Raspberry Pi, BeagleBoard or other small Linux system and be permanently connected to the vehicle.


Using PyCosworth

Hardware Requirements

  • A vehicle with a serial datastream enabled Magneti Marelli ECU, specifically:
Model ECU Type
Ford Sierra Cosworth 4×4 Weber/Marelli L8 ECU (with serial comms enabled via software)
Ford Escort Cosworth Weber/Marelli P8 ECU

Any other Cosworth YB engine with one of the above ECU variants retro-fitted should also work

  • A diagnostic cable that interfaces with the ECU.

*Please note that these are specific diagnostic cables that connect to the 3 pin flash-code cable on the factory Ford loom, convert it to a RS232 compatible serial interface and then convert that serial interface into a USB plug for use on modern computers. Common OBD/OBDII interfaces will not work with the Weber Marelli serial datastream. Ask your usual Cosworth specialist or forum on how to obtain one.*

  • A Linux computer running Python (both 2.x and 3.x supported) with at least one free USB port for the diagnostic cable.
  • Optionally: An Adafruit *HD44780* or *Matrix Orbital* character mode LCD board with USB to serial backpack, such as this one on Adafruit, for in-car sensor readout and error code monitoring.
  • Optionally: A Raspberry Pi (1/2/3, A, B or B+) with exposed GPIO pins to use optional in-car push buttons to control system functionality.
  • Optionally: One or more OLED screens supported by the Python luma.oled driver (minimum of 128×32 pixels, though 128×64 is strongly reccomended) for in-car live sensor/data visualisation.
  • Optionally: A supported X11 display or desktop interface to emulate the live sensor/data visualisation as would be seen in the OLED screens, in a desktop window.

None of the optional components are necessary in any way to run the software, but functionality will be limited to text-mode display and datalogging to file.

It it not designed to work (and I have no way to test) on the Fiat/Lancia or Ferrari F40! version of the ECU, but may work. However, an excellent tool already exists, that the comms protocol part of PyCosworth is partly based on. Many thanks to Neil, the author of that tool, for his technical information.

Software Requirements

All of the Python software library requirements are listed in the requirements.txt file, simply run:

pip install -r requirements.txt

… to install them on your Linux system.

On Raspbian systems, first check my Raspbian guide for any pre-requisites needed. There are several software packages needed to support the hardware devices used on that platform.

The Raspbian guide also lists a number of software configuration changes you may need to make to your Pi in order make it boot faster as well as increase speed of data display and enable the optional hardware listed above, to work.


Running PyCosworth

To start the monitoring programme, type ./run.sh in the programme directory. The monitor will start and within a few seconds it should communicate with the ECU and start gathering data.

To run manually, just call the main() method of the script PyCosworth.py.

Configuration

All of the user-customisable settings are found in the file libs/settings.py. This includes an extensive set of optional modules and complete customisation over which sensors are monitored, their update frequency (subject to the speed of the ECU) as well as total control over the layout and display modes of the in-car visualisation and display options.

Please see https://github.com/megatron-uk/PyCosworth/blob/master/docs/Configuration.md for full details.


Pectel Datastream

Description

For full details of the Pectel serial datastream, see https://github.com/megatron-uk/PyCosworth/blob/master/docs/Pectel.md .

  • blog/car_stuff_pycosworth.txt
  • Last modified: 2019/06/07 11:17
  • by john