×

SparkFun will be closed on Tuesday, December 24th, and Wednesday, December 25th, in observance of the Christmas holiday. Any orders qualifying for same day shipping placed after 2:00 p.m. (MST) on Monday, December 23rd, will be processed on Thursday, December 26th, when we return to regular business hours. Wishing you a safe and happy holiday from all of us at SparkFun!

Please note - we will not be available for Local Pick up orders from December 24th-December 27th. If you place an order for Local Pick-Up we will have those ready on Monday, December 30th.

Enginursday: A Little Car Hacking

Making a display for an ethanol sensor.

Favorited Favorite 0

A buddy of mine is a real racing aficionado, constantly trying to squeeze every last bit of power out of his car - part of that effort includes mixing ethanol in with his gasoline. As it turns out, there's a sensor to help with that. It measures the amount of ethanol present in the fuel passing through it, and reports the output for use in vehicle tuning.

How It Works

The sensor is a very clever piece of engineering. To explain it, I'll have to bring in a little bit of physics - specifically how a capacitor is formed.

Simple capacitor diagram

Image courtesy Wikipedia user Fabian R

As shown in the image above, a capacitor at its simplest is two plates (of area A) separated by a distance (d) with some insulating material between them. The insulating material has a property called permittivity.

If, like me, you once had to take an advanced physics class, you might recognize this formula:

Equation for capacitance

ε0 is the permittivity of free space, and εr is the relative permittivity of the material between the plates (the dielectric). A is the area of the plates, and r is the distance between the plates. Variations on this formula allow one to calculate the capacitance of many different orientations of plate/dielectric.

The ethanol sensor relies on the difference in permittivity between ethanol and gasoline to calculate how much ethanol is in the fuel flowing between two plates inside the sensor. Ethanol has something like five times the permittivity of gasoline, meaning the capacitance can vary significantly as more ethanol is added to the mix.

The Sensor Interface

The sensor itself runs on 12V, as do most automotive sensors. Its output is an open-drain signal that varies in frequency with ethanol percentage: 50Hz for 0 percent ethanol, and 150Hz for 100 percent ethanol. It also reports the temperature of the fuel by varying the pulse width of the signal, but we won't worry about that here.

The Electronics

Since the output signal is open-drain, we can connect it directly to a pin on a microcontroller, despite the fact that the sensor is a 12V device. This makes the sensor interface simple.

To provide feedback to the user, I attached one of our Serial Controlled 7-Segment Displays. A ring of Addressable 5mm LEDs around the outside edge provides a quick visual of where the mix is. The entire thing is driven by a SAMD21 Mini Breakout.

Power is supplied through a standard 7805 Voltage Regulator. Getting the 12V to the regulator was interesting, and was solved by a little gadget I'd never seen before (but my car-oriented buddy is apparently very familiar with) called an add-a-fuse. Providing a negative return is a lot easier, because you just find a screw and run a wire to that -- the entire operation uses the car's chassis as the current return path. For some reason this really bothers me.

The Final Product

We spent some time this past Saturday with my friend's car in the SparkFun garage, and I'm happy to say that my gizmo works as planned!

Picture of the final project in its case

I still have to install it in the car; it's going in the glove box since it's not a mission critical gauge that needs to be constantly monitored.

As I was doing this write up, it occurred to me that it would've been easier to do this as a wireless project, using a Simblee board to provide an interface on a smartphone rather than passing a wire through the firewall. Oh well. There's always the next hack!


Comments 4 comments

  • Member #134773 / about 7 years ago / 1

    Two comments:

    First, and most importantly, a car's DC system can be VERY noisy. Consider that the starter is a HUGE inductor, and when you drop from "start" to "run", all that energy stored in the magnetic field has to go somewhere. It can lead to some unexpectedly high voltage spikes (they can be on the order of 70 volts). The car manufacturers these days deal with this by cutting off the power to radios and such when the starter is active plus a second or so.

    Second, the "fuse adder" you linked to seems a bit pricey to me. I've seen some much simpler things that can get some power out to a spade lug, though off hand I can't recall what they're called nor where I saw them. From your description you probably don't need a lot of power, so don't really need something rated at 30A. I'd suggest it would be worth talking to someone at your local auto parts store, as "added gadgets" are VERY common. BTW, if it's a NAPA store, and you have a AAA membership, show NAPA the AAA card for a discount, IIRC 5%. Not big, but hey, every little bit helps!

    • ShapeShifter / about 7 years ago / 1

      There is indeed something odd about that add-a-fuse listing: a single piece is $18.60, but a pack of ten is $8.99? That latter price sounds more typical. The alternative you are thinking of might be something like this which is basically a brass shim that goes next to the fuse and lets you attach a wire with a Fast-On connector. Yes, they are cheap, but I've always found them to be difficult to use, as they just don't want to stay in place while you try to jam it and the fuse blade into the fuse holder, especially considering the tight places they put fuse blocks these day. Plus, you still have to add a separate fuse holder for the new accessory. These add-a-fuse adapters may cost a bit more, but they are so much more convenient and easy to use that I think they are worth it.

      Agreed about the nasty voltages n a car, and it's not just from the starter. Nasty spikes can happen any time. I put a front end consisting of polarity protection diodes, a TVS, and filter capacitors on any of my projects going in a car. Researching such protection circuits, I've found plenty of sources warning of such concerns, but I'm surprised that there are very few details on how to implement such protection, and no ready made solutions are available. They sell audio noise filters to put inline to accessories, but no power protection devices. Seems like an untapped market to me. Maybe it's because most commercially produced accessories already have the protection built in, and it's only the hobbiests/makers that would need one - and they are a smaller market that can just build the protection themselves?

      • Member #134773 / about 7 years ago / 1

        Yes, that's exactly what I was thinking about. I think I probably saw them at something like a Hamfest. I can definitely see your point, and at 10 for $8.99, it would be well worth the extra cost.

        And yes, the spikes can come from a lot of places. And the spikes can also be negative going, so the reverse polarity protection can be well worth it. For the typical "few milliamp" accessory using the car body (assuming it's metal!) can suffice. But on "high drain" things, such as Amateur ("Ham") Radios, it's best to run a return line to the battery, and fuse BOTH ENDS of BOTH LINES. I've seen cases where the current from other things tries to "return" through the radio -- not pretty.

  • Steve Spence / about 7 years ago * / 1

    Interesting. Ethanol has less BTU than gasoline, so mixing with ethanol won't help make more power. Running E100, although lower in BTU, has a higher octane value, so allows increased compression and advanced timing to make power. So unless he advancing the timing, and has increased compression, he's going to get less power, not more. Great project though! It would be interesting to electronically advance the timing and open the jets (longer injection time) with increased alcohol percentage.

Related Posts

Recent Posts

Tags


All Tags