Below is a list of supported Sensor types in the custom lab and the code required to use them.
Texas Instruments ADS1115 is a 4 channel analog-to-digital converter with I2C interface. The I2C address used by the device is fixed to 0x48. Python code to use ADS1115 is available at ads1115.py. To run this sample, please install Adafruit_ADS1x15 package as follows:
sudo pip install Adafruit_ADS1x15
After that, we can simply run the sample code as
cd ~/custom-labsudo python ads1115.py
We can modify the voltage value from the Web UI for each channel and see it reflected in the read values.
Avago APDS-9301 ambient light photosensor with I2C interface. The address for this sensor is 0x29 and default Lux value is 500 Python code to use APDS-9301 is available at apds9301.py in our Github project.
cd ~/custom-labsudo python apds9301.py
Bosch Sensortec BMP180 is a digital pressure and temperature sensor with I2C interface. The I2C address for this sensor is 0x77. The sample code is available in bmp180.py.
This code requires a package from Adafruit.
sudo pip install Adafruit_BMP
Once the package is installed, please run
cd ~/custom-labsudo python bmp180.py
Texas Instruments DRV8834 stepper motor driver. This chip uses multiple GPIO pins. The sample code is available in drv8834.py.
cd ~/custom-labsudo python drv8834.py
HC-SR04 ultrasonic ranging module. Currently, GPIO pin 5 is used as a trigger and 6 as Echo. Example Python code to use HC-SR04 is available at hcsr04.py
cd ~/custom-labsudo python hcsr04.py
Sensirion SHT20/SHT21/SHT25 humidity and temperature sensor with I2C interface. Python code to use an SHT2x sensor is available at sht2x.py.
The webview after opening the custom-labs project is as shown below