Module to read the ethanol percentage of a standard automotive 50hz to 150hz ethanol content sensor
The goal of this project was to build an affordable way to read ethanol for cars being tuned on e85. The code is built with the purpose of being installed onto an Arduino based device that receives input from an OEM ethanol content sensor.
This is a cleaned up example I put together to integrate with a Raspberry Pi and Adafruit Trinket. Credit for the original idea and code can be tied back to the user Dala on the sr20 forums and referenced through other various forums from NASIOC and evolutionm. The code was included in snippets across forums and were specific to displaying on an small LCD but this project returns data over I2C SDA/SCL to the Raspberry Pi.
An example of interacting with the module using Python and the smbus-cffi library.
import smbus
import time
I2C_ADDRESS = 0x04
ETHANOL_DATA_IDENTIFIER = 0x01
DEVICE_DELAY = 0.1
bus = smbus.SMBus(1)
bus.write_byte_data(I2C_ADDRESS,0x00,ETHANOL_DATA_IDENTIFIER)
time.sleep(DEVICE_DELAY)
fuelContent = bus.read_byte(I2C_ADDRESS)
The full picture of how this can be implemented and pinned.
Pin out pictures pulled from https://pinout.xyz and https://learn.adafruit.com/introducing-pro-trinket/pinouts