MQ-7 sensor sending same value to Lopy4
-
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 machineadc = 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 machineadc = 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 -
@Benjamin-Mavinga an adc value if 4096 means overflow. The input range of the ADC is wrong.
-
@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?
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