Go Down

Topic: Ethanol Content Sensor (Read 806 times) previous topic - next topic

ClemQuat

Oct 14, 2016, 06:18 pm Last Edit: Oct 14, 2016, 06:24 pm by ClemQuat
Hey Guys,

   The shop I work at uses a lot of e85 flex fuel for racing purposes. The big problem is, here in AZ, flex fuel from the pump can be anywhere from 54% to 85% ethanol. This makes tuning quite a headache, so we test each car we see. I thought it would be a cool idea to build a rig that has a self contained sensor, pump, power supply etc, so we can pour a little sample into it and get a readout.

The problem is, I can't seem to get accurate data to display, even though we've tested the sensor itself and it's working. Right now I'm using Freqmeasure to just try and display the hz that the sensor is outputting. it seems to be low, the test sample was tested at ~55% ethanol (105hz), but the arduino is reading 64hz. We scoped the sensor and confirmed it's outputting 105 - 110 htz consistently.

I'm using the example script that comes with the freqmeasure library with no other changes and using D49 on my ATmega 2560 as instructed.

Please help, I'm clearly a car guy and NOT a programmer...

Thanks!

Delta_G

Why don't you link us to the library and post the example you're using so you don't have to wait for someone who knows already that library. They might not be coming any time soon. But with links to what you have and your code I bet any number of people could probably help.

A schematic would probably be a good idea too.
If at first you don't succeed, up - home - sudo - enter.

ClemQuat

Thanks Delta,
 Here is the link to the library:

https://www.pjrc.com/teensy/td_libs_FreqMeasure.html

Here is the example:

Code: [Select]
#include <FreqMeasure.h>

void setup() {
  Serial.begin(57600);
  FreqMeasure.begin();
}

double sum=0;
int count=0;

void loop() {
  if (FreqMeasure.available()) {
    // average several reading together
    sum = sum + FreqMeasure.read();
    count = count + 1;
    if (count > 30) {
      float frequency FreqMeasure.countToFrequency(sum / count);
      Serial.println(frequency);
      sum = 0;
      count = 0;
    }
  }
}


Not sure if I'll be able to get a schematic, but it's quite simple, the sensor is 3 wires, 12v in, signal out and ground. I powered the sensor using a jump box, ran signal to digital pin 49 as per the instruction of the library and used serial monitor to see the result

Delta_G

Code: [Select]
float frequency FreqMeasure.countToFrequency(sum / count);

That line doesn't look right. There should be an equal sign in there somewhere.
If at first you don't succeed, up - home - sudo - enter.

Go Up