Wearables and IoT
The wearables market is booming with predictions of more than a $10B market size by 2020. Despite the encouraging numbers, this is not an easy market to access. Designing smartwatches or fitness bracelets is a tough challenge as consumers expect lots of functionality alongside with a compact form-factor, lightweight, and long battery life.
From a technological point of view, wearables could be one of the greatest applications of the Internet of Things and Zerynth’s contribution to enable this world is reality.
Hexiwear meets Python thanks to Zerynth
As reported in this thread in the Zerynth Community Forum, we’re happy to announce that Zerynth officially supports Hexiwear, one of the most loved wearable IoT development platforms!
Why programming Hexiwear using Zerynth?
Hexiwear has been designed by MikroElektronika in collaboration with NXP to better support projects and products by accelerating their time to market, reducing development costs and securing their migration from prototype to production. A vision that matches perfectly with Zerynth, with its platform for developing embedded devices in Python using paradigms and features typical of personal computer (PC) and mobile programming.
This open-source reference design brings together everything developers need to design their next wearable IoT application.
The main element is its power-efficient Kinetis K64F MCU, featuring:
- ARM® Cortex®-M4 core;
- max frequency up to 120MHz;
- 1024KB Flash, 256KB RAM;
- many peripherals (16-bit ADCs, DAC, Timers);
- interfaces (USB Device Crystal-less, UART, SPI, I2C, I2S, SD-card).
Integration is also a key feature of Hexiwear, with a Bluetooth Low Energy (BLE) SoC (Kinetis KW40z) and 8 Sensors onboard:
- 6-axis Accelerometer and Magnetometer combo (FXOS8700CQ);
- 3-axis Gyroscope (FXAS21002CQ);
- Pressure sensor accurate up to Altitude sensing (MPL3115A2);
- Temperature and humidity combo (HTU21D);
- Ambient light sensor (TSL2561);
- Optical Heart rate sensor (Maxim MAX30101).
It also includes a 1.1” OLED color display and a 190mAh 2C Li-Po battery with a charger (MC34671).
Along with the Hexiwear device, you also need the Hexiwear Docking Station, that allows developers to easily program their code and expand the board features with up to three click boards™ among a portfolio of more than 200 references.
Get started with Hexiwear and Python
Download and Install Zerynth Studio
First of all, of course, you have to download and install Zerynth Studio, our professional IDE that provides a platform for developing your Python (or hybrid C/Python) code and managing your boards. It includes a compiler, debugger and an editor, alongside tutorials and example projects for an easy learning experience.
Zerynth Studio is cross-platform. If you didn’t do it yet, download it here for free! Once you’ve installed it, open Zerynth Studio and create a Zerynth user account.
Connect and Virtualize the board
To start using Hexiwear with Zerynth Studio, first you have to connect the device to your PC through the Hexiwear Docking Station. In particular, it has an onboard DAP Link circuitry that exposes a serial port over USB. You can find it below the Power LED, as shown in the following figure.
DAP Link should be supported natively by all platforms. So you don’t need to install any driver!
Once connected to your PC, Hexiwear device can be seen as a Virtual Serial port and it is automatically recognized by Zerynth Studio. The next steps are:
- Select Hexiwear on the Device Management Toolbar. To complete this step a “Disambiguate” operation may be required because the docking station shares the same hardware of other Zerynth supported boards. Just click on the field above “Ambiguous Devices” to “disambiguate” it and then choose “Hexiwear (Docking Station)”.
- Register the device by clicking the “Z” button from the Zerynth Studio. If you notice it’s taking too long, press the left reset button on the Docking Station.
- Create a Virtual Machine for the device by clicking the “Z” button for the second time;
- Virtualize the device by clicking the “Z” button for the third time. Flash the Zerynth Virtual Machine into the device.
Once you have installed the Virtual Machine you are ready to program the board.
Clone the example and uplink it to the Hexiwear
Zerynth Studio includes a specific example for the Hexiwear, that you can clone with just a few clicks. You can find the example in the “Examples Browser” panel or you can use the “Quick Search” feature, searching for “Hexiwear”.
Once you have cloned the example, uplink the code to your board.
Let’s take a look at the original code in the “main.py” file: here is where you develop the logic of your Python script.
This specific example shows the use of the Hexiwear library with all its peripherals enabled. Following is shown the output on the serial monitor and on the OLED of the board.
You can start from the original code and then you can edit the script to develop your specific project.
Check out the official doc of the Hexiwear library to get more info on how to use it. This module contains the driver for enabling and handling all Hexiwear onboard sensors and features. The HEXIWEAR class permits an easier access to the internal peripherals and exposes all functionalities in simple function calls.
More documentation and tutorials?
Tutorials and guides are available under the section Zerynth Academy.
Have questions and feedback?
Post them on Zerynth Community Forum. And don’t forget to share your projects on Hackster!
Power saving is the key for wearables success
One of the most important challenges of the wearable technology is how to maximize the battery life. To meet this specification, Zerynth VM Premium includes “Power Saving” and other industrial features like:
- Selectable RTOS
- Over the Air update development
- Hardware-driven Secured Firmware burned on the device at industrial volumes
- …and many more