Giter VIP home page Giter VIP logo

example_hm10_bluetooth's Introduction

HM-10 BTLE example for theCore embedded C++ framework

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

This example demonstrates using of HM-10 Bluetooth module using theCore. With Bluetooth application on Android device it is possible to establish communication link between the smartphone and any embedded device with HM-10 attached.

Detailed description

See theCore documentation for HM-10 Bluetooth 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, HM-10 and stm32f4discovery board wiring

  1. Connect USART2 and power to HM-10 on the Discovery board using following pins:

    PA2 (USART2 TX)

    module's RX

    PA3 (USART2 RX)

    module's TX

    +3.3V

    module's VDD

    GND

    module'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

Installing additional software on Android smartphone

BLE Terminal download app

To be able to communicate with HM-10 module via Android smartphone, a special application must be installed.

Open Play Store and find BLE Terminal app. Install it as usual.

Preparing

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

    pip3 install tcore
    tcore bootstrap
    
  2. Download the example:

    tcore init --remote https://github.com/theCore-embedded/example_hm10_bluetooth
    
  3. Step into the project directory:

    cd example_hm10_bluetooth
    

Building

tcore compile --target tiva_tm4c_launchpad

Running

  1. 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"
    
  2. 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

  3. 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
    
  4. Check minicom terminal. You should be able to see:

    Welcome to theCore
    the_core v0.3.236 b9c05be-dirty
    Starting HM-10 Bluetooth example...
    Bytes sent: 16
    Bytes received: 0
    Bytes sent: 16
    Bytes received: 0
    Bytes sent: 16
    Bytes received: 0
    
  5. Open BLE Terminal on your smartphone. You must be able to see nearby BT devices:

    BLE Terminal app main window
  6. Select HM-10 device.

  7. You will be presented with a terminal window where the data sent from device is displayed

  8. Now, type something to the terminal prompt in BLE Terminal app and tap "Send ASCII" button:

    BLE Terminal and HM-10 output window
  9. Check minicom terminal again:

    Bytes received: 0
    Bytes sent: 16
    Bytes received: 16
    data in return
    

Found a bug?

Let it out! File an issue or create a pull-request, if you already have an idea how to fix it.

example_hm10_bluetooth's People

Contributors

forgge avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

forgge

example_hm10_bluetooth's Issues

Cannot make

When I try to run tcore compile --target stm32f4_disc it gives me this error:

In file included from /home/antonio/Documents/TESI/example_hm10_bluetooth/build/stm32f4_disc/core/generated/export/aux/uart_cfg.hpp:20,
                 from /home/antonio/.theCore/theCore/platform/stm32/export/platform/console.hpp:21,
                 from /home/antonio/.theCore/theCore/platform/common/export/common/console.hpp:11,
                 from /home/antonio/.theCore/theCore/lib/debug/assert.cpp:7:
/home/antonio/.theCore/theCore/platform/stm32/export/aux/usart_bus.hpp:93:52: error: static assertion failed: The instance of this generic class should never be instantiated. Please write your own template specialization of this class. See documentation.
   93 |     static_assert(std::is_integral<decltype(dev)>::value,
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
make[2]: *** [core/lib/debug/CMakeFiles/dbg.dir/build.make:80: core/lib/debug/CMakeFiles/dbg.dir/assert.cpp.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:1168: core/lib/debug/CMakeFiles/dbg.dir/all] Error 2
make: *** [Makefile:101: all] Error 2
2020-05-10 19:48:33 [ERROR   ] failed to run command: . /home/antonio/.nix-profile/etc/profile.d/nix.sh && nix-shell  --run "make -j1" /home/antonio/.theCore/theCore/

I had also to modify a nix script and substitute gcc-arm-embedded-5 with gcc-arm-embedded-9, because it gave an error regarding buildInputs and undefined variable. I don't think that this is the source of the problem.

Rename BTLE to BLE

Currently the description says
HM-10 BTLE example for theCore embedded C++ framework , but the standard specifies only BLE abbreviation, so it can be confusing.

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.