Updated Readme

This commit is contained in:
Connor
2019-06-28 20:48:10 +10:00
parent 32fbd10821
commit db9d78bcf8

View File

@@ -1,31 +1,29 @@
RPI_SGP30 SGP30
========= =========
Library to read |eCO_2| and TVOC from the `SGP30 sensor <https://www.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/9_Gas_Sensors/Sensirion_Gas_Sensors_SGP30_Datasheet_EN.pdf>`_. Based on the smbus2 i2c library for ease of use. Library to read eCO2 and TVOC from the [SGP30 sensor](https://www.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/9_Gas_Sensors/Sensirion_Gas_Sensors_SGP30_Datasheet_EN.pdf). Based on the _smbus2_ i2c library for ease of use.
It should be compatible with both python 2 and 3 but is currently only tested under Python 2.7 It should be compatible with both Python 2 and 3
Quick usage-example: Quick usage-example:
-------------------- --------------------
::
from smbus2 import SMBusWrapper from smbus2 import SMBusWrapper
from sgp30 import Sgp30 from sgp30 import SGP30
import time import time
with SMBusWrapper(1) as bus: with SMBusWrapper(1) as bus:
sgp=Sgp30(bus,baseline_filename="/tmp/mySGP30_baseline") #things thing with the baselinefile is dumb and will be changed in the future sgp = SGP30(bus, baseline_filename=BASELINE_FILENAME+".TESTING")
print("resetting all i2c devices") print("resetting all i2c devices")
sgp.i2c_geral_call() #WARNING: Will reset any device on teh i2cbus that listens for general call sgp.i2c_general_call()
print(sgp.read_features()) print(sgp.read_features())
print(sgp.read_serial()) print(sgp.read_serial())
sgp.init_sgp() sgp.init_sgp()
print(sgp.read_measurements()) for i in range(300):
print("the SGP30 takes at least 15 seconds to warm up, 12 hours before the readigs become really stable" print(sgp.read_measurements())
for i in range(20): time.sleep(0.1)
time.sleep(1) sgp.store_baseline()
print(".",end="") bus.close()
print()
print(sgp.read_measurements())
Current design considerations: Current design considerations:
------------------------------ ------------------------------
@@ -41,9 +39,8 @@ Features that are known to be missing (listing in rough order of importance):
Hardware notices: Hardware notices:
----------------- -----------------
If you have the Adafruit board with built in level shifters and voltage regulator it is should work if you just plug in `SDA to pin 3, SCL to pin 5, VCC to pin 17 and GND to pin 20 <https://pinout.xyz/pinout/i2c>`_. You should then be able to find the SGP30 an address 0x58 using `i2cdetect -y 1`. If you get an error message you probably need to enable i2c in the kernel using `raspi-config and reboot <https://learn.sparkfun.com/tutorials/raspberry-pi-spi-and-i2c-tutorial>`_ If you have the Adafruit board with built in level shifters and voltage regulator it is should work if you just plug in [SDA to pin 3, SCL to pin 5, VCC to pin 17 and GND to pin 20](https://pinout.xyz/pinout/i2c). You should then be able to find the SGP30 an address 0x58 using `i2cdetect -y 1`. If you get an error message you probably need to enable i2c in the kernel using [raspi-config and reboot](https://learn.sparkfun.com/tutorials/raspberry-pi-spi-and-i2c-tutorial>)
Feel free to contact me with bugs, questions or issues. Feel free to contact me with bugs, questions or issues.
.. |eCO_2| replace:: eCO\ :sub:`2`