# DIY Capacitive fuel sensor question

For my motorcycle dashboard project I would like to make a fuel sensor, because my current sensor is in fact a on/off switch for the fuel warning light. After doing a little research I concluded that a capacitive sensor would be the most realistic (please correct me if I'm wrong), mainly because it has to fit in the sensor hole in the tank (about 1,5 cm in diameter) and the fact that my spark plug plus ignition are located directly under the tank, causing possible noise.

I found this circuit online and I was wondering if I can use 14 gauge copper wire cores or copper tubes instead of brass tubing? and how will this the affect the capacitance?

The capacitative sensor design is clever! The type of metal doesn't matter much. For a capacitor made of flat, parallel plates the formula for capacitance is eps*D*A/d, where eps = 8.85 x 10^-12 Farad/meter, D=dielectric constant (for air D = 1, for fuel around 2, I think), A is the area of one plate and d=separation between plates. For a cylindrical capacitor the same formula will give you an approximate result, as long as the two tubes are nearly concentric. Here is the theoretical exact result. http://www.ajdesigner.com/phpcapacitor/cylindrical_capacitor_equation.php

The outer tube should be grounded to the motorcycle frame and you should use heavy shielded cable for the connections. The nearby spark plug and wire will induce large, possibly circuit-destroying spikes into unshielded wires.

I couldn't make much sense of the tank photo.

Thanks for the help,I think I get it. I´ll do some more research on DIY capacitors. I am aware of the issues with EM noise around the ignition. I can´t even use a multimeter within 1 meter of my bike without shielding it. :0 The purpuse of the tank photo was to show how much room there is for a fuel sensor, but just dimensions would have been enough.

The circuit in the OP is designed to output 0-1 V, is there any way to change to circuit and change that to 0-5V for a better resolution?

You can increase the value of the 15 Kohm resistor on the output, or eliminate it completely to get up to (roughly) 0-5V output. At the moment, the output results from a voltage divider consisting of the 68K and 15K resistors, which effectively multiplies the filtered output voltage by a factor of 15/(15+68) = 0.18 (or divides by a factor of 5.5). You could also use the circuit as it is, and select the 1.1 V AREF reference voltage option on the ADC input.

You should look at the data sheet for the QT301 capacitance sensor closely, because the PWM output, and hence the analog output voltage, is not a linear function of the capacitance. It is logarithmic. Given that and the tank shape, it will take a bit of head scratching to come up with a programmed fuel gauge that accurately reflects even 1/4, 1/2, 3/4 full marks. Seems like a fun project!