paulvha / SVM30_on_raspberry

Set parameters and read and calculate values from SVM30 on Raspberry Pi
GNU General Public License v3.0
2 stars 0 forks source link

Using the program #1

Open hockenator opened 4 years ago

hockenator commented 4 years ago

Paul, thanks for your great work. I'm currently like to connect an SVM to a RasPi for an indoor tVOC sampling and logging campaign. I followed your recommended steps in compiling the bcm2835 driver. Everything was fine, but: What I have to do now? My goal is to use a SVM30 library in a python code... I'm a little bit confused, because "a new kid on the block". Can you give a hint please?

paulvha commented 4 years ago

Hi, thanks for the feedback. Make sure to read the SVM30.odt on how to compile and create an object and use it from the command line.

For another project (scd30) I got some good advice how to integrate that with Python. I took the following from that project that you can tailor to your need :

Stay Safe, Paul


Received the following code from Aeolus1364 (credits to him) . import subprocess, shlex def run_command(command): process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE) while True: output = process.stdout.readline() if output == '' and process.poll() is not None: break if output: print(output.strip()) rc = process.poll() return rc

run_command("./scd30") It was part of an issue to integrate the scd30 program in Python and capture the output. To enable this the p_printf() changes were applied (version 3.0.2). p_printf() performs a ‘fflush(stdout)’ after each write which seems to be necessary for the integration to work well. Normally a line is detected after newline (which is performed as well in do_output()). His full code is posted on : https://github.com/Aeolus1364/SCD30_Python_Library

hockenator commented 4 years ago

THX for your fast response and hints. I’m gonna try. 😊

Von: paulvha notifications@github.com Gesendet: Montag, 13. April 2020 17:35 An: paulvha/SVM30_on_raspberry SVM30_on_raspberry@noreply.github.com Cc: hockenator hockenator@gmail.com; Author author@noreply.github.com Betreff: Re: [paulvha/SVM30_on_raspberry] Using the program (#1)

Hi, thanks for the feedback. Make sure to read the SVM30.odt on how to compile and create an object and use it from the command line.

For another project (scd30) I got some good advice how to integrate that with Python. I took the following from that project that you can tailor to your need :

Stay Safe, Paul


Received the following code from Aeolus1364 (credits to him) . import subprocess, shlex def run_command(command): process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE) while True: output = process.stdout.readline() if output == '' and process.poll() is not None: break if output: print(output.strip()) rc = process.poll() return rc

run_command("./scd30") It was part of an issue to integrate the scd30 program in Python and capture the output. To enable this the p_printf() changes were applied (version 3.0.2). p_printf() performs a ‘fflush(stdout)’ after each write which seems to be necessary for the integration to work well. Normally a line is detected after newline (which is performed as well in do_output()). His full code is posted on : https://github.com/Aeolus1364/SCD30_Python_Library

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/paulvha/SVM30_on_raspberry/issues/1#issuecomment-612951203 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AHSF3BIT3YYS6JMON2TS2MDRMMWKJANCNFSM4MHA4FKQ . https://github.com/notifications/beacon/AHSF3BKQBTQ3OMMPWURO26DRMMWKJA5CNFSM4MHA4FK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOESEOJIY.gif