1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Self Made Gadget In The Making: Co-sensor

Discussion in 'Clothing, Gadgets & Equipment' started by doublehead, Jan 1, 2020.

  1. So I've been playing around with microcontrollers and sensors and after having some luck with the german MOT (TÜV), I came up with the idea of putting together a cheap device to check the CO of the bike.
    Backstory: The TÜV-guy looked somewhat concerned during the exhaust-gas check as the CO vol% was around 7 which is a lot over the limit of 4,5 vol% for a bike with no catalytic converter. Luckily, he tried it again with "high idle" (roughly 4k revs) which brought the CO to 3.7vol%. What I took away from that: MOT with no advisories what so ever and me knowing that there are probably a few worn parts inside the flat slide carbs, which is of course not a surprise. BUT: professional equipment is expensive. A rough estimate with a tolerance of +/- 1vol% would be sufficient for me.

    On to the device to be build.
    Microcontrollers are somewhat widespread in the hands of hobbyists, we use them at school as well (Arduinos).
    The microcontroller board I am using is a Wemos lolin 32 with a build in OLED display which is programmable with the standard Arduino IDE. It costs around 16 €. The sensors I will be using are MQ7 sensors for Arduinos (3 € per piece) that will need a bit of fiddling and calibration to get the desired outcome. The code I use is roughly 30 lines long.
    20200101_194043_HDR.jpg
    The values are now just the voltage output of the sensor which needs to be calculated when the calibration is done. The output voltage corresponds with a certain ppm-count (parts per million), vol% x 1000 = ppm. The sensitivity of the sensors vary depending on who manufactures them. 10000 ppm seems to be the maximum on most, which is 1 vol%. That might be a bit of a problem. o_O But playing around with this kind of stuff is fun.
     
    • Like Like x 5
    • Agree Agree x 1
  2. By gunson Gas analyser
     
    • Like Like x 1
  3. Congrats to the OP on this thread/idea!

    of course you could buy something to do the job...... but where’s the fun in that!

    i’m playing with a raspberry pi on my boat, similarly pointless but fun.

    keep the updates coming
     
    • Agree Agree x 3
  4. I'm a Pi nut , but I don't agree about pointless ....:)

    You can't fail to learn something , even if it's just by mucking about with them .... " getting your hands dirty " .... Ha !
     
    • Like Like x 1
  5. I thought about doing this with a RaspberryPi Zero, but that would have made a digital/analog converter necessary as well as a display AND it needs time to boot and shut down.
    The microcontroller doesn't care, it just needs 5 Volts (note to self: order step-down thingy from 12 to 5V) and it runs and puts out to the OLED on the board.
     
  6. 20200106_112858_HDR[1].jpg
    Sensors got delivered and had their burn-in time (manufacturer states it needs at least 48 hours of the heater-circuit running to get decent values). The resistors visible are one way to ensure the sensors work as intended.
    Still have to calibrate them.

    Someone gave me the hint of using lambda-sensors as they kind of deliver similar results: lambda value of 1 means the mixture is ok and you could also see the changes over the rev-range. As I have lambda-sensors somewhere I might give it a try. Just have to look up on how to drive the heating circuit on them.

    Besides viewing the momentary outpout on the display you could also save all values over time in a log file on your cellphone via WiFi or write to an SD-card. Those ESP32-thingies are quite capable.
     
    • Like Like x 1
  7. So I finally got around to test this little abomination.
    Sensor_chill.jpg
    While resting on the table both sensors show almost similar values. This is important, if I want to use them while driving, one sensor mounted to one cylinder/exhaust. The green housing is 3D printed. Found the design online. It's not fitting correctly but at least will avoid short circuits.
    vlcsnap-2020-05-18-15h36m26s424.png
    As the engine was running and moving the sensors near the exhaust the shown values already started rising, as expected. The shown values update two or three times per second, Iirc. (It's 932 and 940 in this wobbly picture) vlcsnap-2020-05-18-15h36m46s992.png
    Here the sensors are in roughly a medium carrot sized distance from the exhaust. Values went up to ~2000

    "What's it good for?", you might ask.
    The idea was a cheap approximation-sensor of the CO values of the exhaust for MOT-like reasons. The measured CO at the bikes TÜV-Test was around 6.7 Vol%, legal maximum is 4.5 Vol% of carbureted bikes without Catalytics.
    I already changed a few parts in the flatslides (needles and tubes and some jets), which got rid of the stuttering around 5500 revs.
    So now I have to go to a garage and compare the values shown on my digital toy and compare them to a proper CO sensor. Then I can adjust the code to put out a more or less accurate reading.
    Without a proper calibration I can still use it to compare the CO of each cylinder, while driving, all through the rev-range.
    If that works, it's 25 € well spent.
     
    #9 doublehead, May 18, 2020
    Last edited: May 18, 2020
    • Like Like x 2
  8. So here is the code, everything behind the // explains what's happening

    #define SENSOR 14 //Pin 14 is connected to a sensor
    #define SENSOR2 13 //Pin 13 is connected to a sensor

    #include "SSD1306Wire.h" // I forgot what this is
    #include "OLEDDisplayUi.h" // This is the data of display on the board

    SSD1306Wire display(0x3c, 5, 4); // Pins 5 and 4 are the I2C connection for the display
    OLEDDisplayUi ui ( &display );
    int sensorValue = 0; // integer variable, output of the sensor
    int sensorValue2 = 0;


    void setup() {
    Serial.begin(115200); //communication speed with the display
    Serial.println();
    Serial.println();

    display.init();
    display.setI2cAutoInit(true); //display is connected via I2C interface

    //display.flipScreenVertically();
    display.setFont(ArialMT_Plain_16); // typeface
    display.setTextAlignment(TEXT_ALIGN_LEFT);
    }

    void loop() {
    float senValue = analogRead(SENSOR); //analog output of sensor. Digital is possible as well, e.g. for CO alarms
    float senValue2 = analogRead(SENSOR2);
    display.clear();
    display.drawString(0, 0, "CO1: "); // on pixel 0,0 display the following..
    display.drawString(40, 0, String(senValue)); // on pixel 40,0 show the value of the sensor
    display.drawString(0, 40, "CO2: ");
    display.drawString(40, 40, String(senValue2));
    display.display();
    delay (100); // wait 100 ms to display the next value
    }
     
    #10 doublehead, May 18, 2020
    Last edited: May 18, 2020
    • Like Like x 2
Do Not Sell My Personal Information