Firstly I must apologize for asking such a newbie question that may appear completely dumb to those frequenting these forums. My background is programming and not hardware, this in part is why I am having difficulties, as I understand that data sheets hold all the answers, but unfortunately in most cases they look like foreign language to me. Nonetheless I am trying to learn and while I am posting here I am continuing to google and read up on things as well. So please take it easy on me. I come in peace and seek knowledge.
I took an embedded programming class back in college. I am in California, our fires are making our air really bad right now (I am sure you have all seen on the news). I thought... hey, I still have that ATMEGA32 and breadboard, and I love tinkering, I can make my own Air Quality sensor! I ordered an MQ135 sensor, it arrived yesterday, I hooked everything up and am able to read values from the analog pin.
My goal: To get a local (indoor) reading in same units that a typical weather app uses. As seen here (random image from google): https://imgur.com/a/RO3TEMY
and that follows this chart: https://imgur.com/ppW2NIN
The measurement is in PPM. And as far as I understand MQ135 is capable of capturing this information (this is one of those parts where I may be saying dumb things). I know MQ135 measures only a select few gases, and is unable to split out that information, instead it basically shows the highest reading based on resistance, it has no idea which gas actually caused it. And I dont care (should I?), I want to know relative to the chart above how bad the air in my house is. If its smoky outside I am ok with just assuming its the smoke thats causing the number to be what it is.
Now here is where I am now:
I am using Atmel Studio and ATMEL-ICE to program the ATMEGA32. I have output going to a 2x16 LCD. I am capturing analog pin's output to pin ADC4 on Atmega (I plan to introduce LEDs for ADC0 through ADC3 once I get the reading done).
Now, the reading I am getting from the sensor, I am not doing anything to them right now, they are just raw data, I am getting around 35. I took it outside in the smoky weather (Weather app says in my area AQI is around 130) and it actually went down to 28. Really weird :/
I understand that the analog is just a value with little to no meaning between 0 and 1024.
Where I need help:
Now I am struggling to make sense of the analog value and convert it to AQI. I understand that each sensor is different and needs to be calibrated individually, unfortunately beyond the weather app I do not have any other means of calibration, so Ill worry about that at a later stage, at this stage I need to understand how to convert the analog value to AQI. Ive googled a bunch, and came across various equations, some of which use things like Ro and Ri, I know what those stand for, but how to get those, I have no idea. I came across something that said to simply divide by 1024 then multiply by 5. Which gives me something like 0.154.... nonsensical number?
So, I come here in hopes of you guys nudging me in the right direction to learn, or to teach me how to do this. Unfortunately most of my googling leads to people using MQ135 with Arduino boards, Ive yet to find anyone using ATMEGA32.
I am using an old phone charger to supply power 5v 0.7A, I do not have any resistors installed between power supply and ATMEGA32, only a 0.1uf capacitor. MQ135 does have an on board variable resistor (which I have not touched). So schematic is very simply, I can draw it out if it would help.