Posted on 17. July 2016 in Motorcycles
Hi folks,
my favorite motorcycle has a little issue. A fuel sensor is available in the newer models. It is directly connected to the fuel indication lamp. If no fuel is present, the lamp is lit. Problem is, after turning the ignition, it does not flash up, so you dont have an indication if the fuelsensor or lamp is working. If you drive longer routes and you rely on this feature, you may find yourself in a situation without gas.
I developed an easy solution with just a few parts.
The original connectors used are from the company MOLEX
Mizu-P25™ 2.50mm Pitch Waterproof Wire-to-Wire Plug Housing, 3 Circuits
MALE
52116-0341
MALE_CRIMP
50038
FEMALE
052117-0341
FEMALE_CRIMP
50039
All products are available from the electronic supplier tme.eu (which kindly also ships to private households)
male crimp
male connector
Next step is to get a working hardware, for this application i wanted to have some features:
* Using original waterproof connectors and housing, no soldering should be done for easy swapping and replacing any parts
* Sensor voltage protection, no more then 12V to the sensor
* Sensor output driver does not drive any load (13kOhms)
* Lamp short circuit protection, current is limited to 100mA
* After Ignition do a lamp test for ~500ms, then 500ms shutdown, then use the sensor value
The controller used is a Atmel ATiny13V, which works at 2MHz @5V. The code is written in plain c.
int main(void)
{
// PB0 = GND
// PB1 = sensor reading
// PB4 = lamp output
DDRB=0x10;
PORTB=0x00;
_delay_ms(500);
PORTB=0x10;
_delay_ms(1000);
PORTB=0x00;
_delay_ms(500);
PORTB=0x00;
while (1)
{
if (PINB & 0x02)
{
PORTB = 0x10;
}else{
PORTB = 0x00;
}
}
}
there is a testvideo available on youtube, folowwing this link
A possible improvement would be to debounce the digital inputs and adding a low pass filter, which will remove unwanted blinks if the sensor is only half wet.