Comments: Hazardous Gas Monitor

Pages

Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • Member #1658165 / about 4 years ago / 2

    Can someone tell me where D6 goes? In the code D6 is defined as CORelayPin, but nowhere on the Fritzing does it show anything connected to D6. Should the yellow wire that is currently connected to 3V3 in the Fritzing be connected to D6 instead?

    • This question came up the other day. The 3V3 pin should not be connected to D6. You should not use an IO pin to turn on/off the relay. Microcontroller pins may not have enough power to drive the relay and there is a possibility of destroying the pin depending on the specs of the relay that you are using. In this case, the relay needs more power than the Particle Photon's I/O pins can provide to toggle the switch so it is connected 3V3 pin and MOSFET.

      While the code defines D6 as the CORelayPin and D7 as COVoltPin, JENFOXBOT did not use D6. Looking at the logic and pin D7, the code seems to be written as we expect it to from JENFOXBOT's explanation in the tutorial. When the CO gas sensor's heater needs to be in the 5V phase (turnHeaterHigh()), COVoltPin is low so the relay is off and stays on the NC pin. When the heater needs to be in the ~1.5V phase, (turnHeaterLow()), COVoltPin is high so the relay is on and switches to the NO pin.

      Thus, the lines of code that use CORelayPin on D6 can be ignored or commented out. Here's an example with them commented out. There are four instances where it is used.

      .
      .
      .
      //const int CORelayPin = D6;    //commented out, not used...
      const int COVoltPin = D7;
      .
      .
      .
      setup(){
      .
      .
      .
          //pinMode(CORelayPin, OUTPUT);     //commented out, not used...
          pinMode(COVoltPin, OUTPUT);
      .
      .
      .
      //Functions to switch heater voltage on MQ7 (CO) sensor
      void turnHeaterHigh(){
        // 5v phase
        digitalWrite(COVoltPin, LOW);     //relay is off, COM pin connected to NC @ 5V
        //digitalWrite(CORelayPin, HIGH);   //commented out, not used...
      
        heaterInHighPhase = true;
        switchTimeMillis = millis() + CO_5V_Interval;
      }
      
      void turnHeaterLow(){
        // 1.4v phase
        digitalWrite(COVoltPin, HIGH);     //relay is on, COM pin connected to NO @ ~1.5V
        //digitalWrite(CORelayPin, LOW);    //commented out, not used...
      
        heaterInHighPhase = false;
        switchTimeMillis = millis() + CO_1_5V_Interval;
      }
      

      I adjusted the Fritzing diagram a little in this tutorial and included a few notes to make it more clear.

    • Abacus / about 4 years ago / 1

      Currently wondering the same thing. Trying to adapt this for an Arduino set up currently.

  • Member #1658165 / about 4 years ago / 2

    Is that a diode between the two pins of the relay? If so, what kind? IN4004? I didn't see any mention of a diode in the list of components.

  • ciakki_g / about 6 years ago * / 2

    I think there may be some discrepancies between the description of the circuit for the MQ-7 sensor and its Fritzing representation. Could somebody more competent than me please check them? For example, the Fritzing diagram shows that a potentiometer pin should be connected to the voltage regulator output, while the description doesn't mention it at all... Which one is to be followed?

    • santaimpersonator / about 6 years ago / 3

      If I understand the described intention... They are both wrong.

      • (MQ-7 Breakout) A1- Instructions are correct, should be tied to 5V.
      • (Relay) NO- Both wrong, should be tied to 5V (same as A1, probably a typo in instruction).
      • (Potentiometer) Reference voltage pin- Both wrong, should be tied to 5V (same as A1, probably a typo in instruction).
      • (Relay) COM- Image wrong/not mentioned in instructions, should be tied to H1.

      I believe steps 7 & 8 have a typo and should be A1 not H1 to get 5V. Then H1 should be tied to the COM on the relay.

      I'll update the tutorial, but that being said... this tutorial is 3 years old and Phant is no longer in service due to operational costs and maintenance.

      • ciakki_g / about 6 years ago * / 1

        Thank you very much, I have corrected my circuit according to the updated tutorial, but something doesn't seem to work yet. It probably is because I'm using the same 3.7v LiPo battery for every power line; however, I can't change that in my project. How could I get it to work? The original tutorial does mention the possibility of swapping the AAs with some LIBs, but doesn't really go further than that...

        • santaimpersonator / about 6 years ago / 2

          Using a 3.7V LiPo on the gas sensor circuit won't work because of the voltage regulators. They are 5V regulators, which regulate higher voltages down to 5V and can't be used to step lower voltages up to 5V. That is why the tutorial uses 2 different power sources.

          There are a few options like a booster circuit, tying 2 LiPos in series to create 7.4V, etc. However, it would all be dependent on your setup. For more assistance, please post a new topic on our forums.

          For additional resources on power check out the following tutorials:

  • Member #912133 / about 8 years ago / 1

    Hi, I am doing a similar project to this and I was wondering if you had to calibrate your gas sensors before hand? Thanks!

  • Member #861048 / about 8 years ago / 1

    Hi, in the code COVoltPin is defined as D7. Who is connected to D7? Thanks.

    • Hello! Hope you were able to figure this out! If not (and for other folks who may have the same question), the D7 pin is connected to the relay ground that controls the power to the CO (MQ7) sensor. In the schematic, it's the orange wire going to the MOSFET. Hope that helps!


If you've found an issue with this tutorial content, please send us your feedback!