Custom Lab

Drag and Drop the sensors with your Raspberry Pi  View Source

In this project, we will show how to use the custom lab with your Raspberry Pi.

Get Started

Signup with iotify.io if you haven’t yet. The free account will have sufficient credits to run this project. Once you are logged into the IoTIFY main application, go to the Virtual lab Top menu and click on the Custom Lab project.

Provide a unique name for your project.

Drag and drop sensors you will need into the workspace as follows.

The top row in the workspace indicates various General Purpose Input/Outputs (GPIOs) available in the system. Each GPIO has an associated icon that indicates if the GPIO is being configured as input or output: in the first case, the icon depicts the symbol of a switch, otherwise it depicts an LED. Clicking on an icon will change the Input to Output and vice versa. A GPIO pin will automatically gray out in case you use a sensor which uses that GPIO pin. E.g. in case of HCSR04 sensor, the GPIO pins 5 and 6 will be grayed out, as they will be used by the sensor.

Once you have all the sensors, simply click launch. The project takes 3-5 minutes to launch. The project state will automatically change to running once it is ready. You could then simply click the Open button and it will launch a new window with the Workspace of Custom Lab project.

Clone the sample source

Once the project is up and running, default sample code will be automatically cloned for you in the custom-lab directory of your Raspberry Pi. In case you would like to look at the source code, it is available at

https://github.com/iotify/custom-lab.git

Supported devices

Below is a list of supported Sensor types in the custom lab and the code required to use them.

TI ADS 1115

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.
Example 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

Afterwards, you could simply run the sample code as

cd ~/custom-lab
sudo python ads1115.py

You could modify the voltage value from the Web UI for each channel and see it reflected in the read values.

APDS 9301

Avago APDS-9301 ambient light photosensor with I2C interface. The address for this sensor is 0x29 and default Lux value is 500
Example Python code to use APDS-9301 is available at apds9301.py in our github project.

cd ~/custom-lab
sudo python apds9301.py

BMP 180

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-lab
sudo python bmp180.py

DRV 8834

Texas Instruments DRV8834 stepper motor driver. This chip uses multiple GPIO pins. The sample code is available in drv8834.py

cd ~/custom-lab
sudo python drv8834.py

HCSR 04

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-lab
sudo python hcsr04.py

SHT 2x

Sensirion SHT20/SHT21/SHT25 humidity and temperature sensor with I2C interface.
Example Python code to use an SHT2x sensor is available at sht2x.py.

cd ~/custom-lab
sudo python sht2x.py

Looking for some other sensors or have some feedback? Let us know by posting your comment below.