Getting started with the Sensorian API – Part1

Home / HowTo / Getting started with the Sensorian API – Part1

To communicate with any of the on-board modules the user will need to use the firmware drivers for each specific sensor or IO module (TFT, serial , Capacitive touch pads).

The Sensorian firmware drivers are written in both C and Python. The C language drivers make use of the BCM2835 user-space library. Python drivers use a number of low level modules. The API is found on https://sensorian.github.io/.

First step before using the Sensorian shield is to install the library from http://www.airspayce.com/mikem/bcm2835/.

The next step is to enable the I2C and SPI character devices from the raspi-config menu. This step can be skipped if using the provided images since the configuration has been already done for the user.

After completing the above steps you should be able to run the provided code examples.

The BCM2835 library allows the Raspberry Pi to communicate with the sensor and I/O via the low level SPI and I2C protocols. The Python drivers use the smbus and spidev module to communicate with some of the sensors and the TFT and memory modules.

Some of the sensors however require the use an I2C bus conditions known as repeated start. The BCM285 SoC implementation of the I2C protocol has an issue so a workaround is to use the 10bit i2C addressing mode provided by the library. This is the reason why some of the sensors use shared C libraries to access the I2C bus.
The drivers use CTYPE binding to make use of the C drivers.The usage of the C types does not affect the Python programmer however. All the programmer needs to do is import the shared library on the same folder as the sensor/module driver. Since the drivers are open source the user can port them to any framework or OS of their choice (Win10, Ubuntu).

In the next installment will take a look into some IOT applications and frameworks.

Related Posts

Leave a Comment

IMG415