Giter Club home page Giter Club logo

sp_weather's Introduction

SP_Weather Module User Guide

中文

Directory Structure

Directory Description
doc Reference documentation
img Images
script Maixpy script example
src C program example based on the standalone sdk

Introduce

SP_Weather has two sensors, magnetic sensor QMC7983, which is a triaxial magnetic sensor with built-in sensitivity compensation and NTC, with excellent dynamic range and precision as well as ultra-low power consumption. The temperature, humidity and barometric pressure sensor BME280 can simultaneously measure temperature, humidity and barometric pressure. The data of the two sensors can be read according to their different device addresses.

See Specification for more information

Pin figure

Mode connection

MCU:FUN(IO) SP_Weather
I2C:SDA(IO_7) SDA
NC(IO_15) NC
NC(IO_20) NC
NC(IO_21) NC
NC(IO_8) NC
I2C:SCL(IO_6) SCL
3.3V 3.3V
GND GND

MCU configuration

IO port configuration

The corresponding IO port in the MCU schematic diagram is configured as I2C function pin.

  • C

      fpioa_set_function(WEATHER_SCL, FUNC_I2C0_SCLK + WEATHER_I2C_DEVICE * 2); // WEATHER_SCL: 6;
      fpioa_set_function(WEATHER_SDA, FUNC_I2C0_SDA + WEATHER_I2C_DEVICE * 2); // WEATHER_SDA: 7;
  • MaixPy

Configure in I2C initialization

I2C initialization

  • C

      maix_i2c_init(WEATHER_I2C_DEVICE, 7, 400000); // WEATHER_I2C_DEVICE: 0;
  • MaixPy

      i2c_bus = I2C(I2C.I2C0, freq=100*1000, scl=6, sda=7) # scl: io_6, sda: io_7

SP_Weather configuration

Usage

  • Process

    1. Initializing sensor
    2. Read sensor data
  • C

      rslt = qmc_init(); // Magnetic sensor QMC7983 init 
      rslt = bme280_init(&dev); // Temperature, humidity and pressure sensors BME280 init 
      stream_sensor_data_normal_mode(&dev); // read and print sensor data
  • MaixPy

      weather=SPWEATHER(i2c=i2c_bus) # create sp_weather
      while 1:
          time.sleep_ms(500)
          print(weather.qmc_read_xyz) # QMC7983 read data
          print(weather.bme_values) # BME280 read data

Runtime enviroments

Language Boards SDK/Firmware version
C MaixCube kendryte-standalone-sdk v0.5.6
MaixPy MaixCube maixpy v0.5.1

Result

  • C

  • MaixPy

LISENCE

See LICENSE file.

Other information

Version Editor Date
v1.0 vamoosebbf 2020.12.2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.