Bluetooth mesh is a new Bluetooth technology which allows secure networks of thousands of devices to be formed and one of the primary applications that Bluetooth mesh was created for is the truly smart, connected building. It was designed from the outset with reliability, security and scalability as key goals and with the ability to meet the sophisticated and technically challenging engineering requirements of the smart building and smart industry.
This class will start by exploring the concepts, technicalities and uses of Bluetooth mesh networking. Attendees will then be led through a series of practical coding exercises which will provide hands-on experience of implementing the firmware for Bluetooth mesh products.
In this session, you will learn:
Concepts and terminology a developer needs to know when working with Bluetooth mesh technology
How to use the Zephyr SDK to develop firmware for Bluetooth mesh devices
About the generic onoff client and server models and their implementation in code
About the generic level client and server models and their implementation in code
Please read the pre-requisites! You won't be able to participate in the workshop without the pre-requisites!
Developers attending this session should have experience programming in C/C++ to intermediate level. Attendees should be comfortable working with command line tools rather than GUI based IDEs.
- A laptop running Windows or Linux or a Macbook.
- A micro:USB cable which can be used with your laptop. i.e. it should have a micro USB plug at one end, for connecting to a BBC micro:bit and whatever USB plug your laptop accepts at the other.
Your laptop needs the following installed on it:
- The Zephyr SDK. See https://www.zephyrproject.org/
- A text editor
Setting up the Zephyr SDK
Zephyr can be used in a Windows, Mac OS or Linux environment. Follow the relevant instructions at the Zephyr web site to set up the Zephyr SDK on your machine. See http://docs.zephyrproject.org/gettingstarted/gettingstarted.html
Important: The Zephyr Getting Started instructions will require you to choose a toolchain of either x86 or ARM during the setup process. You must install the toolchain for ARM.
IMPORTANT: you must use version 1.12.0 of the Zephyr SDK. This may not be the latest release but it's what this course is based on. As part of your set up procedure therefore, the full zephyr repository must be cloned and then version 1.12.0 checked out like this:
git clone https://github.com/zephyrproject-rtos/zephyr.git cd zephyr git checkout tags/v1.12.0
There are choices in how you set up your Zephyr environment and we leave this to you to decide.
Checking the Zephyr SDK
cd to the samples\hello_world\ folder inside the folder which contains your zephyr SDK and execute the following commands:
mkdir build cd build cmake -GNinja -DBOARD=bbc_microbit .. ninja
If your SDK is installed properly, you should get results very similar to these:
C:\workspaces\zephyr\samples\hello_world>mkdir build C:\workspaces\zephyr\samples\hello_world>cd build C:\workspaces\zephyr\samples\hello_world\build>cmake -GNinja -DBOARD=bbc_microbit .. CMake Deprecation Warning at C:/workspaces/zephyr/cmake/app/boilerplate.cmake:38 (cmake_policy): The OLD behavior for policy CMP0000 will be removed from a future version of CMake. The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD. Call Stack (most recent call first): CMakeLists.txt:2 (include) -- Found PythonInterp: C:/Users/Martin/AppData/Local/Programs/Python/Python35/python.exe (found suitable version "3.5.1", minimum required is 3.4") -- Selected BOARD bbc_microbit Zephyr version: 1.12.0 Parsing Kconfig tree in c:/workspaces/zephyr/Kconfig Using C:/workspaces/zephyr/boards/arm/bbc_microbit/bbc_microbit_defconfig as base Merging C:/workspaces/zephyr/samples/hello_world/prj.conf CMake Warning at C:/workspaces/zephyr/cmake/toolchain.cmake:14 (message): ZEPHYR_GCC_VARIANT is deprecated, please use ZEPHYR_TOOLCHAIN_VARIANT instead Call Stack (most recent call first): C:/workspaces/zephyr/cmake/app/boilerplate.cmake:242 (include) CMakeLists.txt:2 (include) -- Generating zephyr/include/generated/generated_dts_board.h -- Cache files will be written to: C:\Users\Martin\AppData\Local/.cache/zephyr -- The C compiler identification is GNU 7.2.1 -- The CXX compiler identification is GNU 7.2.1 -- The ASM compiler identification is GNU -- Found assembler: C:/gccarmemb/bin/arm-none-eabi-gcc.exe -- Performing Test toolchain_is_ok -- Performing Test toolchain_is_ok - Success -- Configuring done -- Generating done -- Build files have been written to: C:/workspaces/zephyr/samples/hello_world/build C:\workspaces\zephyr\samples\hello_world\build>ninja [1/127] Generating always_rebuild Building for board bbc_microbit [122/127] Linking C executable zephyr\zephyr_prebuilt.elf Memory region Used Size Region Size %age Used FLASH: 44476 B 256 KB 16.97% SRAM: 9116 B 16 KB 55.64% IDT_LIST: 132 B 2 KB 6.45% [127/127] Linking C executable zephyr\zephyr.elf
Martin Woolley works for the Bluetooth SIG, the technical standards body for Bluetooth. He’s an industry veteran with over 30 years’ experience working with computers large, small and ….. getting smaller. He still has a Sinclair ZX81 somewhere. He was a part of the BBC micro:bit team and designed the micro:bit’s Bluetooth profile.