Giter VIP home page Giter VIP logo

example_sensor_htu21d's Introduction

HTU21D temperature and humidity sensor example for theCore embedded C++ framework

https://travis-ci.org/theCore-embedded/example_sensor_htu21d.svg?branch=master

Detailed description

HTU21D example shows how to read humidity and temperature samples using theCore. See theCore documentation for HTU21D example for more information.

Supported targets (boards)

Target name Configuration file Description
stm32f4_disc stm32f4_discovery.json STM32F4 discovery board

Wiring

STM32F4 Discovery board

UART and HTU21D example wiring for stm32f4discovery board

  1. Connect HTU21D to I2C1 on the Discovery board using following pins:

    PB6 (I2C1 SCL)

    sensor's SCL

    PB9 (I2C1 SDA)

    sensor's SDA

    +3.3V

    sensor's VDD

    GND

    sensor's GND

  2. Attach any preferable UART-to-USB converter such as this module according to following pinout:

    PD8 (USART3 TX)

    module's RX

    PD9 (USART3 RX)

    module's TX

    GND

    module's GND

Preparing

  1. Install and initialize theCore (if not done previously):

    pip3 install tcore
    # Or if python3-pip is default: pip install tcore
    tcore bootstrap
    
  2. Download the example:

    tcore init --remote https://github.com/theCore-embedded/example_sensor_htu21d
    cd example_sensor_htu21d
    

Building

Run compile command using theCore CLI:

tcore compile --target stm32f4_disc

Running

Firmware will be flashed via openocd debugger and flash command.

  1. Connect stm32f4 Discovery board to USB cable and connect USB <-> UART converter to the PC.

  2. Launch minicom with device associated with USB <-> UART converter. (/dev/ttyUSB0 here used as an example):

    # From new terminal
    tcore runenv "minicom -D /dev/ttyUSB0"
    

    Or the same, but with superuser permissions:

    # From new terminal
    tcore runenv --sudo "minicom -D /dev/ttyUSB0"
    
  3. Determine stm32f4discovery board revision.

    If you don't remember your board revision, check FAQ section https://forgge.github.io/theCore/faq.html#how-to-check-stm32f4-discovery-board-revision.html

  4. Launch flash command in separate terminal, as shown below.

    For old STM32F407G-DISC boards, with STLINK/V2:

    tcore flash --sudo
    

    For new STM32F407G-DISC1 boards, with STLINK/V2.1:

    tcore flash --sudo --debugger-config stlink-v2.1
    

Expected output

Observe console output in the minicom:

Welcome to theCore
the_core v0.3.0.321 90f4894-dirty
Starting HTU21D sensor...
Reset done
Temperature: 25.362 Celsius   Humidity: 45.162%
Temperature: 25.362 Celsius   Humidity: 45.170%
Temperature: 25.362 Celsius   Humidity: 45.155%
Temperature: 25.362 Celsius   Humidity: 45.147%
Temperature: 25.351 Celsius   Humidity: 45.155%

example_sensor_htu21d's People

Contributors

forgge avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

forgge

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.