0

I am completely new on Raspberry Pi.

As of my IoT project i am planning to detect amount of Methane and Carbon dioxide from the biogas combustor, and maintain a log in real time.

I am planning to use Windows 10 IoT as operating system on Raspberry Pi and MQ-2 sensor for the gas detection.

Most of the available samples and codes are on python. I am not familiar with python and it's library.

Is there any built in library in c# (for detection of composition of methane and CO2) for these purposes? can you provide me some head start for these? like library to import, namespaces for the sensor, some idea about the calibration of gases?

Python Code:

Links i followed for Python which uses MQ-2 sensor for LPG and other but not for Methane

C# Code:

Code for BreathAnalyzer

0

I suppose you will have to build your own library.

The majority of your implementation will probably consist of handling the pin inputs. You can set the inputs/outputs from the namespace Windows.Devices.Gpio.

From my experience on building/working on raspberry pi projects, you should use the data you get from the sensor (from the digital/analog pins shown here) and build your code around the results from the sensor.

For example, if the sensor returns the data 0502, maybe the percentage of the gas at some point is "050"% and the gas is the one with ID:2

Just to give you a general idea of how data from sensors USUALLY works (in my experience).

You can probably take a look at the functions in the python code you posted. See how the programmer handles the data in python and then move the code to C# (I see some logarithmic value handling in the python and it's been ages since I've been anywhere near that level of mathematics).

So, at this point, if you build your "parser" for the sensor data using the raspberry pi pins (functions for pins can be found in Windows.Devices.Gpio) , and you have human readable data, you have to choose whether you will output them on a screen or maybe just log them (maybe even post them through an API to a seperate computer).

If you want to show them on a screen attached to the raspberry pi, you should probably build an application. If you want to send the data or save them to a file, a background application with no UI would be a better choice.

Either way, if you manage to convert the data from the sensor to data that you can read, you can access them through a bunch of ways and there are a lot of implementations online whether you choose to do a UI or a background app. Focus on figuring out how to get useful information from the sensor pins.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.