MQ-135 addon

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
ulfh2018
Normal user
Posts: 39
Joined: 19 Feb 2018, 06:11
Location: Oslo Norway

MQ-135 addon

#1 Post by ulfh2018 » 21 Feb 2018, 04:15

I'm want to implement a mq-135 addon following the instructions at https://diyprojects.io/esp-easy-develop ... oziGfZuaUk but have to admit I'm not very familiar with the programming. I have tried to copy all the information I find in the article, and it looks like this:

#include <SPI.h>
#define PLUGIN_135
#define PLUGIN_ID_135 135
#define PLUGIN_NAME_135 "Indoor Air Quality-MQ135"
#define PLUGIN_VALUENAME1_135 "CO2"

boolean Plugin_135(byte function, struct EventStruct *event, String& string)
{
Device[++deviceCount].Number = PLUGIN_ID_135;
Device[deviceCount].Type = DEVICE_TYPE_ANALOG;
Device[deviceCount].VType = SENSOR_TYPE_SINGLE;
Device[deviceCount].Ports = 0;
Device[deviceCount].PullUpOption = false;
Device[deviceCount].InverseLogicOption = false;
Device[deviceCount].FormulaOption = true;
Device[deviceCount].ValueCount = 1;
Device[deviceCount].SendDataOption = true;
Device[deviceCount].TimerOption = true;
Device[deviceCount].GlobalSyncOption = true;
break;
}
string += F("<TR><TD>CO2 Level ref.:<TD><input type='text' name='plugin_135_ATMOCO2' value='");
string += Settings.TaskDevicePluginConfigFloat[event->TaskIndex][4];
string += F("'>");
String plugin5= WebServer.arg("plugin_135_ATMOCO2");
Settings.TaskDevicePluginConfigFloat[event-&gt;TaskIndex][4] = plugin5.toFloat();

This will not compile, at least not alone, but maybe inside the mega project?

I have tried compiling the mega project using Arduino IO, but did not succeed, so I switched to Atom, where the compilation of mega worked like a charm, but I want to have the code for the plugin correct before I continue.

Anyone who can help me?

berend
Normal user
Posts: 10
Joined: 16 Feb 2018, 19:19

Re: MQ-135 addon

#2 Post by berend » 21 Feb 2018, 12:20

I din't get my MQ sensors running (yet..), because I thought the measurements where too erratic. On the BB at least.

But the trick is the sensors needs some burn in time, and then for measurements requires alternating cycles of heating and low heating and measurement. I think the sheets have the one or two alternative ways of timing that. The Arduino site should have all the details too.
https://playground.arduino.cc/Main/MQGasSensors

There's no need to copy out the plugin from a far more complex project like ESPEasy. And it looks like you only have found the code to the plugin (HTML) UI and registry, but not the actual measurement routine.

I'd look for a simple Arduino breadboard setup first. One digital output and some parts to drive it and an analog pin for measurement.

Edit: I see you *want* to develop a plugin, I misunderstood. In that case, can't you start from the Travis build or isn't there a docker that sets up a good part of the toolchain?

Post Reply

Who is online

Users browsing this forum: No registered users and 100 guests