Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    MQ-7 sensor sending same value to Lopy4

    Scheduled Pinned Locked Moved Comments & Feedback
    3 Posts 3 Posters 24 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B Offline
      Benjamin Mavinga
      last edited by Benjamin Mavinga

      Hi,

      I am trying to interface my CO carbon monoxide sensor (MQ 7) to the Kopy4 and expansion board. i have wired the system up as its shown on the tutorial linked below. https://core-electronics.com.au/tutorials/temperature-sensing-pycom-tmp36-tutorial.html
      I am aware that that tutorial uses the TMP36 but the wiring are the same. I'm using pymakr atom plugin IDE. Program A is the program listed on the tutorial and program B is the minor details i changed but as you can see i just changed the print statements. I wanted to outline this to avoid any confusion. The output is what I'm getting below.

      At first I thought it was working but when I tested it with a lighter the figures didn't change and that ADC count = 4095 and CO value = 60.0 C was the only data I'm receiving. Any help with this would be much appreciated

      (A)-------------------------------------------------------------------------------
      import time
      import machine

      adc = machine.ADC() # create an ADC object
      apin = adc.channel(pin='P16') # create an analog pin on P16 & connect TMP36
      while True:
      print("")
      print("Reading CO Sensor...")
      value = apin()
      print("ADC count = %d" %(value))

      # LoPy  has 1.1 V input range for ADC
      temp = ((value * 1100 ) / 4096 - 500) / 10
      print("CO value = %5.1f C" % (temp))
      
      time.sleep(10) 
      

      (B)---------------------------------------------------------------------------------
      import time
      import machine

      adc = machine.ADC()
      apin = adc.channel(pin='P16')
      while True:
      print("")
      print("Reading CO Sensor...")
      value = apin()
      print("ADC count = %d" %(value))

      # LoPy  has 1.1 V input range for ADC
      temp = ((value * 1100 ) / 4096 - 500) / 10
      print("CO value = %5.1f C" % (temp))
      
      time.sleep(10)
      

      Reading CO Sensor...
      ADC count = 4095
      CO value = 60.0 C

      robert-hhR J 2 Replies Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @Benjamin Mavinga
        last edited by

        @Benjamin-Mavinga an adc value if 4096 means overflow. The input range of the ADC is wrong.

        1 Reply Last reply Reply Quote 0
        • J Offline
          jcaron @Benjamin Mavinga
          last edited by

          @Benjamin-Mavinga I'm not sure how the wiring could be the same? The TMP36 has 3 pins, the MQ7 has 6, and you need to supply a variable voltage to the MQ7 to change temperature of the heating element and measure the resulting change in conductivity?

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • 1 / 1
          • First post
            Last post

          Pycom on Twitter

          Pycom