Using I2C class to run Click Boards on BeagleConnect Freedom

This blog covers the use of Temperature and Humidity 13 Click and Air Quality 4 Click on BeagleConnect Freedom using the Zephyr Port of MicroPython

Table of contents

  1. Prerequisites
  2. Temperature and Humidity 13 Click
  3. Air Quality 4 Click
  4. References

Prerequisites

  1. Before taking the Zephyr Port of MicroPython into use we must flash the MicroPython application firmware,for which you can follow my previous blog
  2. To access the prompt over USB-serial you need to use a terminal emulator program. On Windows TeraTerm is a good choice, on Mac you can use the built-in screen program, and Linux has picocom and minicom.For example to install picocom on Linux you can run:

sudo dnf install picocom

  1. Changing permissions on serial ports: Use this command to change permission- sudo chmod 666 /dev/ttyUSB0
  2. Starting off please enter into the terminal emulator program by running the following command :

picocom /dev/ttyUSB0 -b115200

This will make REPL available for usage.

  1. I would suggest running it on a dedicated Python IDE like Thonny.The link to download it is : https://thonny.org/

Temperature and Humidity 13 Click:

Temp&Hum 13 Click is a Click board which is suited for measuring the relative humidity (RH) and temperature. The Click board is equipped with the HTU21DF, an accurate and reliable sensor IC, packed in a miniature 3x3mm DFN package

Temperature and Humidity 13 Click can measure the humidity in the range from 0 to 100 %RH and temperature in the range from -40 °C to +125 °C, with the typical accuracy of ±2 %RH and ±0.3 ℃. It consumes small amounts of power while in operation, delivering processed and calibrated measurement values over the I2C interface.

This Click board can be used for the development of the many different relative humidity and temperature measuring applications, including weather stations, reliable monitoring systems, asset tracking and HVAC/R based applications.

The MicroPython driver code with appropriate comments for clear explanation can be seen as follows: https://github.com/Yadnik1/Temperatureandhumidityclick

The output from the sensor is as follows: The Temperature and Humdity value can be seen changing as I blow close to the sensor ic.

image alt text

The Humidity while taking the reading from sensor was around 80% and Temperature was 29 °C(The Temperature Reading was slightly high due to the warm BeagleConnect device).

A relatively detailed visual explanation can be seen from my video: https://www.youtube.com/watch?v=aolzc100qJQ

Air Quality 4 Click:

Air quality 4 click is an advanced air quality sensing device that combines multiple metal-oxide sensing elements on a chip to provide detailed information of the air quality parameters. This click can output a TVOC value readings as well as the CO2 equivalent concentration readings in an indoor environment. The sensor IC used on Air quality 4 click, is the SGP30 from Sensirion, a multi-pixel gas sensor for indoor applications. This sensor is actually a system of several metal-oxide sensing elements on a chip (pixels), used to measure and process readings of various gasses in the air and output them in a form of two complementary air quality readings - Total Volatile Organic Compounds (TVOC) [ppb] and CO2 equivalent signal [ppm]. It is a perfect solution for various air conditioning systems, ventilation systems and other IoT applications where accurate, detailed and reliable air quality readings are required.

The MicroPython driver code with appropriate comments for clear explanation can be seen as follows: https://github.com/Yadnik1/AirQuality-CLICK/blob/main/AirQualClick_SGP30.py

The output from the sensor is as follows: The TVOC and Co2 Equivalent values can be seen changing as I blow close to the sensor ic.

image alt text

The general range of TVOC is around 1-3 ppm in my locality and the exact CO2 Equivalent value of air is 409.8 ppm.Hence we infer that our readings are pretty accurate. A relatively detailed visual explanation can be seen from my video: https://www.youtube.com/watch?v=5JYqfM9MkSU

References:

https://docs.micropython.org/en/latest/library/machine.I2C.html https://github.com/micropython/micropython/blob/master/ports/zephyr/README.md https://github.com/jadonk/beagle_connect_zephyr_board

 Share!

 
comments powered by Disqus