Close
0%
0%

Locost Electrics

Car electronics projects for home built cars and hot rods. It includes a capacitive fuel sender interface and a wiper synchronizer.

Similar projects worth following
I recently helped a friend build a "Locost" car, which is a homebuilt Lotus 7 replica. In this case it uses a Mazda Miata engine and transmission. Having bought it off my friend, there are a number of electronic/electrical upgrades which I am working on and which will be the subject of this project. The first is an interface to allow a capacitive fuel level sender to interface to a Miata fuel gauge. The principles should be applicable to interfacing any fuel sender to any gauge. The second is a windscreen wiper synchronizer. The Locost has two independent wiper motors and the synchronizer prevents the blades interfering. It is an interesting exercise in synchronizing rotary motion. The car currently only has one oxygen sensor and so the third part is either to build an oxygen sensor simulator or an interface to a Delphi Mini-Switching Oxygen Sensor. As I progress, other devices may be needed and the project is intended to generally look at electronic upgrades for home build c

The first upgrade is to build a fuel level sender interface. The Locost has a fuel cell rather than a conventional fuel tank so there is no room for a conventional float arm based level sensor. Capacitive senders, though, just have a small tube that goes in the tank. The tube has a second concentric tube inside and the level is determined by measuring the capacitance between the inner and outer tube. Such senders are available through Ebay for around $30. The problem is that the sender outputs a voltage between 0.5v and 5v but the meter expects a resistance between 4 ohms and 110 ohms. The obvious way to interface is to use a voltage to resistance chip but they don't come with the right values and cannot take the 100ma that is necessary to drive the meter. So, I have decided to build a microcontroller based resistor simulator.

First a word about fuel level senders. Most of them have a variable resistor to ground. here are some typical resistance ranges (empty to full):

1. 240-33, standard aftermarket
2. 0-90, GM Type ’66 and later
3. 0-30, GM Type ’64 and earlier
4. 16-158, Ford Type ’87 and later
5. 75-10, Ford type ’86 and earlier
6. 90-0, Toyota and Nissan ’85 and later
7. 40-250, Late model GM
8. 10-180 VDO gauges

You can buy converters, but they are expensive and it is an interesting project to build one.

Older, non electronic, fuel gauges generally use "balanced coils" where there are two coils in the meter, one pulling the needle towards zero and one pulling the needle to full. The sender is essentially wired in parallel with one of the coils, thus changing the relative pull of the coils. If you simply provide a constant current or voltage based on the fuel level, the meter reading will vary with the battery voltage.

A simple solution should be to stabilize the voltage feed to the meter and then a constant voltage drive should provide a stable reading but I didn't want to modify the wiring of the instrument panel so I am working on a resistor simulator.

Another point worth noting is the harsh environment in automobiles. This requires special care in building electronics for them. I usually address the temperature range issue by installing the electronics away from heat sources, generally in the passenger compartment. Dealing with very low temperatures is not an issue for the Locost as I am not going to be using it when it is below freezing. Having said that, I usually try to use automobile grade components when I can get them. The second aspect of the harsh environment is electrical spikes and noise. The alternator often creates significant voltage spikes which I address by using Transient Voltage Supressors (TVS). Sensor inputs also need protecting to be safe. There is also a lot of high frequency noise which is best dealt with through a combination of shielding (metal enclosures) and a lot of capacitors and low pass filters in the circuits. Next, I will describe the circuit I plan to use for the converter.

  • 1 × INA219 Power Management ICs / Power Supply Support. High Side Current Sensor Module
  • 1 × Teensy LC Small form factor Arduino compatible microcontroller
  • 1 × AOI518 Power Mosfet

  • Resistor Fuel Gauge Simulator: The final design

    Dave White04/20/2017 at 22:24 0 comments

    I have been away traveling for a while so am only just catching up. I decided to use a different circuit with a INA219 high side current and voltage sensor used to measure the current and voltage. As before, I used an AOI518 MOSFET as the "variable resistor". Power MOSFETs aren't perfect for this application as they are designed for strict on/off operation, but it worked. I started with an Arduino ProMini to provide the feedback control but it turned out to be too slow and its PWM capabilities were insufficient for fine control. I had a spare Teensy LC and this turned out perfect for the job. Enhancements to the circuit included a gate bias circuit that increased sensitivity by biasing the MOSFET half way between full on and full off. This requires calibration but that is easy to do.

    I started by setting up the INA219 module using the available Arduino library. I set up a test program to calculate the effective resistance using Ohms law and the measured current and voltage. It worked well for fixed resistors. I was aiming for a resistance range of zero (approximately) to 110 ohms. They I added the mosfet with the control logic. Initially, I used "bang/bang" control driving the gate with a digital pin and with a 10 microfarad capacitor on the gate to dampen the voltage. This didn't provide fine enough control so I moved to PWM control on a Pro Mini but a 255 step PWM was still not fine enough control.

    Next I added the bias circuit so that the whole PWM range was being used effectively. The gate was biased half way between pinch off and full on, similar to MOSFET audio amps. The PWM pin then drives the gate using a resistor chosen to just cut off the MOSFET with zero PWM count and just fully turn on the MOSFET with a full PWM count. I also changed to a Teensy LC (quite reasonably priced at around $12). This both gave faster response and provided a 12 bit PWM (4096 steps). This ended up as the final hardware design. I will add the schematic later as I have time. As I wanted the INA219 range to be 16 volts and 400ma, I had to modify the library as it didn't provide a call to set the full range values. You should be able to run with the existing settings and the library has the code to set the maximum voltage and current, but that capability doesn't seem to be callable from Arduino.

    The bottom line is that the final system works well. I can provide a 0.5 volts to 5 volts input (as per my capacitive fuel level sensor) and get a simulated resistor output that varies between around 0.5 ohms and 110 ohms corresponding to what the fuel gauge expects. The software allows calibration of the range and correction of non-linearity. I will be publishing the Arduino code shortly.

    The next project is a windscreen wiper synchronizer which I have just completed. The circuit should work well for other applications where you want to keep two motors synchronized in both position and speed but where you only have a single point in the cycle for synchronization (the home switch for windscreen wipers). More details to follow....

  • Low-Side current sensors

    Dave White01/31/2017 at 18:12 0 comments

    After experimenting a while with the above circuit, I found that low side current sensing with only about 20mV signal required a lot of care in circuit design to minimize drift and offset. The TCA271 was OK as you can add an offset nulling circuit but I didn't want to have to trim the circuit so I started to look for a suitable alternative opamp. In searching I discovered the Texas INA219 high side sensor. This is available as a module from around $2 from China up to around $10 from Adafruit. The INA219 not only includes a suitable high side current sensor but also includes a bus voltage sensor, which I need for this circuit, and a 12 bit ADC. It connects to a microprocessor using the I2C bus. I have now changed the circuit to put the MOSFET on the low side of the sensor input. I am waiting for delivery of the INA219 modules that I have ordered and will report on the results when I have them. The microcontroller will remain an Arduino mini pro but the code will now read the input over I2C from the INA219, driving the MOSFET as per the current design. More to follow....

  • Mosfets in Saturation

    Dave White01/25/2017 at 22:50 0 comments

    In trying to choose a MOSFET for the project, I researched how to use MOSFETs in their non-saturated region. Modern MOSFETs are optimized for switching so their saturation regions are small and their headroom when non saturated is limited so I decided to use an old MOSFET. I chose an IRF640 as I happen to have a bunch of them. Next I plan to test out how they behave in their saturation region which is how MOSFETs are used in audio amplifiers. I will also be using a separate opamp for the current sensing resistor. I have a spare TLC271 which is optimized for single power rail usage so that is what I will use. More when I have built the test circuit.

  • Fuel Sender Adaptor Circuit

    Dave White01/25/2017 at 00:45 0 comments

    Here is a schematic of the circuit I plan to use:

    R1 is the current sense resistor. It will probably be around 0.1 ohms, giving 10mV at 100ma. U2 is a opamp with the gain set by R2 and R3 to bring that voltage up to the range for the ADC. The voltage across the simulated resistor goes into ADC2 through a voltage divider designed to support up to 15 volts across the "resistor". The current through the "resistor" is controlled by a GPIO pin with simple "bang bang" control. It drives the gate of a MOSFET via a current limiting resistor/ low pass filter comprising R5 and C1. R4 is for gate protection, say 1 megohm. The time constant for C1 R5 is set to about 1 second as fast response is not required. This also biases the MOSFET into its linear region where it will act like a somewhat non-linear voltage controlled resistor on its own. Operating the MOSFET in its linear region increases its dissipation but at less that 100ma at less than 12 volts, this should be less than 1.5 watts which is easily handled by any decent power MOSFET without a heatsink.

    Right now, I am deciding on what MOSFET to use. It must fully turn on at less than 5 volts, have the lowest possible gate threshold voltage and an on resistance of no more than a couple of hundred milliohms. I will probably use a AO518 as I have a lot of them.

    The code is in two parts. One takes the control input from ADC3 to set the "resistor" value. This will use a small lookup table with interpolation to provide first order correction for non-linearity. The second part maintains the effective resistance by providing closed loop control of the ratio between the current sense voltage and the overall "resistor" voltage. I was thinking of using a PWM output with PID control but as it is OK for the response time to be slow in this application, simple on/off control with the low pass filter should work well.

    Although the circuit as specified uses an Arduino mini-pro with a separate opamp, I am tempted to use a Cypress 4200 PSOC chip as they can be set up to handle both the analog part and the digital part on the one chip. It is somewhat overkill, but simple dev boards are available for $4 so it is certainly cheap enough.

View all 4 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates