Of late, there has been a boom in the use of wearable devices across multiple markets. This is mainly because of their convenience and the surplus of information they can offer. Medical devices like the Qardio®Arm blood pressure cuff, activity trackers like Samsung’s Gear Fit2, and even Under Armor’s UA SpeedForm® Gemini 3 Record-Equipped shoes are some of the examples. These devices can provide users with a range of feedback, including sleep quality, activity levels, VO2 levels, and running and walking cadence, among other data points.
Developing wearable devices requires incorporation of peripherals to sense and display different types of data as well as store and retrieve data in the cloud. This project uses the Pegasus Rapid Development Platform, from Maxim Integrated™ (Maxim), which simplifies development by integrating core peripherals into the development board as well as into Maxim’s 700-MAXREFDES117# heart-rate monitor reference design. Rounding out the project technologies, Mouser Electronics uses Ubidots for cloud services, an Mbed operating system (OS) for cloud-based programming, and Android Studio software for the cloud interface.
Using these in-built features, reference designs, and cloud programming tools will put a designer (or a “DIYer”) a step ahead at the starting line. The following sections identify essential project materials and help you program the device, wire the development boards, compile and load the Android app, and convey data to a cloud service.
Project Materials and Resources
Mouser Electronics recommends gathering the following materials and resources prior to starting this project.
Project’s Bill of Materials (BOM)
Refer the project’s BOM on Mouser.com for these essential components:
- Maxim’s 700-MAX32630FTHR# development platform, powered by the MAX32630 Arm® Cortex® M4F microcontroller and accompanied by the MAX14690 PMIC battery charge management device
- Maxim’s 700-MAXREFDES117# heart-rate monitor with heart-rate/pulse oximeter sensor, a step-down DC-DC converter, and logic-level translator
- Lithium polymer battery
- Mouser HRM GitHub repository
- Mouser HRM Mbed repository
- Jumper wire or regular wire
- Soldering iron
- Header pins
- Expansion peripherals (optional)
- Oscilloscope (optional)
- Digital multimeter (optional)
Accounts and Software
- An Mbed.org account
- A Ubidots Cloud service account
- Android Studio software
Project Technology Overview
This is an intermediate to advanced project aimed at engineers and DIYers who possess programming and soldering skills. The company has designed this project using the following technologies.
Maxim MAX32630FTHR Pegasus Development Platform
Maxim’s new MAX32630FTHR Pegasus Development Platform (Figure 1) is what drives this project. Powered by the MAX32630 Arm® Cortex® M4F microcontroller and accompanied by the MAX14690 PMIC battery charge management device, this platform can help engineers in fast prototyping. This feature-packed board comprises of several integrated peripherals, such as an accelerometer/gyroscope and dual-mode Bluetooth as well as UART, I2C, 66 GPIO, SPI, and much more. The MAX32630FTHR small form factor matches a number of off-the-shelf expansion boards as well as standard breadboards, presenting innumerable possibilities. If you are inquisitive about some of the options available, Mouser Electronics has provided a link under the expansion peripherals.
Figure 1. Maxim’s MAX32630FTHR# Pegasus Development Platform is powered by an Arm® Cortex® M4F microcontroller and comes with a PMIC power management device.
Maxim MAXREFDES117# Heart-Rate Module Reference Design
Maxim’s popular MAXREFDES117# heart-rate module reference design (Figure 2) is tiny yet comprises of MAX1921 step-down DC-DC converter, Maxim’s MAX30102 heart-rate/pulse oximeter sensor, and MAX14595 logic-level translator. This versatile design can be used within both the Mbed and Arduino platforms for rapid integration. Example firmware is available for both platforms and offers the user with a very standard algorithm for establishing heart-rate and SpO2, to help launch them.
Figure 2. Maxim’s popular MAXREFDES117# heart-rate module reference design is tiny yet comes equipped with a pulse rate/oximeter sensor, a step-down DC-DC converter, and a logic-level translator.
Mbed OS for Cloud-Based Programming
Mbed OS offers a convenient cloud-based programming tool to help streamline and accelerate the formation of Internet of Things (IoT) platforms. Mbed offers the tools to help collaborate on, contribute to, and publish software for existing code, and simultaneously helping to maintain a comprehensive revision history. Using Mbed is as simple as opening an account and searching and selecting the hardware you wish to use. If you already have an account, you can navigate to the Mbed repository and import the provided code into your compiler to start.
Ubidots for Cloud Servicing
Ubidots offers an excellent jumping-off point for anyone aiming to start a cloud or IoT project. Besides having tutorials available for various development platforms, Ubidots offers tutorials on developing an interface between their service and Android apps created in Android Studio. The credit system offers a simple and economical way to develop and maintain your projects and offers numerous methods for acquiring more credits when needed.
Android Studio for Cloud Interfacing
You will need an interface to move data from your Maxim board and sensor to the cloud. This can be performed through a mobile device, such as a cell phone or tablet. For this project, Mouser Electronics stayed within the limits of the Android framework and used Android Studio for app creation to aid in visualizing the information Mouser Electronics’ sensor provides.
Developing the Heart-Rate Monitor
Working with Mbed
If you already have an Mbed account, use the Mouser HRM Mbed repository and import the provided code into your compiler.
For first-time users:
- Go to Mbed.org
- Click the Mbed OS link, which will take you to the developer site
- Click “Log in/Sign up” and provide the required information
After registering, you can start a new project either by choosing the highlighted “Compiler” link or by accessing the Mouser HRM Mbed repository and importing the code to the compiler. You can select, add, review, or change platforms within the Compiler screen by clicking the link in the top right corner. You will find quite a few other Maxim products and software samples also supported through Mbed.
Wiring the Board and Reference Design
Wiring the MAX32630FTHR and MAXREFDES117 together requires just a few connections and can be breadboarded to make this simpler. To achieve this, use the following steps:
- Link the SCL and SDA lines from the heart-rate sensor with P3_5 and P3_4 on the MAX32630FTHR and the INT on the heart-rate device to pin P3_0 (Figure 3)
- The VIN for the heart-rate sensor needs between 2.5 and 5.5 V, but it is recommended to derive power from the 3V3 or SYS connected with the battery. When attempting to use 5 V, there have been several issues between the two.
- Connect your ground pin
Figure 3. Pin mapping from Maxim MAX32630FTHR# datasheet.
Programming the Board
Programming the board is as stress-free as dragging and dropping a file from one folder to another. The MAX32630FTHR comes with a debug interface used for uploading your code to the board.
- Connect the polarized 10-pin connector from the interface board to the MAX32630FTHR. Pay close attention to Pin 1 if the connection is not shrouded.
- Link the micro USB connector labeled HDK (on the interface board) to your PC USB port, which should automatically begin driver installation. Based on which DAPLINK you have received, you may have many connections or only one (either Figure 4 or 5, depending). After the drivers have completed installation, a new drive labeled DAPLINK will be available in your File Explorer.
- Provide power to the MAX32630FTHR either through the JST battery connector or micro USB.
Figure 4. DAPLINK with multiple inputs
Figure 5. DAPLINK with single input
After you have made your connections and interfaced to the board, you will need to compile the code to create the .bin file required to program the MAX32630FTHR. From the Mbed Compiler screen toolbar:
- Click “Compile” or use the drop-down menu and choose the option you want to use. After a few moments, the software will add a file to your Downloads folder labeled bin, which you will want to find.
- Go ahead and locate that .bin file in the Downloads folder
- Open a new Explorer window, which will currently display a new, available DAPLINK drive. This is your interface board.
- Drag or copy the newly created .bin file from its download location to the DAPLINK folder to start programming the board.
The DAPLINK board LEDs must blink rapidly while the programming is happening. Once done, the LED will either remain off or blink steadily and slowly on DAPLINK.
- Click the reset button on the MAX32630FTHR to start the programmed code.
Once the board resets, a red LED on both boards will switch on and stay steady.
After signing in, you will find yourself on the Dashboard page, and from here, you can pick numerous options such as view created devices, review your profile, view available events, and see how many credits are available on your account. A few things to keep in mind, which will be required for any project, are the API tokens, devices, and variable IDs.
Viewing API Tokens
The “Profile” icon in the top right of the screen must be clicked to view the API token. Then, select “API Credentials”; this will drop down a field showing the API token on the left. The API token is exclusive to each user and is created when the account is created. This is what halts data conveyed from your device from going to the wrong account.
Variable IDs are formed within each new device when a variable is added. To commence, start by incorporating a device:
- Verify that you are on the “Devices” screen (Figure 6)
- Press the yellow circle with the plus symbol in the top right corner
- Rename the device from “My Data Source” to anything you want
- Click anywhere in the window to finalize the device. You will see a short pop-up message signifying the successful creation.
Figure 6. Start with the “Devices” screen.
The “device” signifies your project in its entirety, allowing you to have many projects under one account. The “variable ID” is what helps each created device to identify the particular sensors and inputs assigned to, or integrated into, your device and what points them to the display in the right location. This helps you maintain several projects and sensors that are independent or shared between devices.
Creating Variable IDs
Variable ID creation is a lot like creating the device:
- Click the “New Device” icon, which will open this device and enable you to form individual variables
- Click the yellow circle with the plus symbol in the top right corner to create your new variable
- Rename the variable
- Click anywhere within the window. A short pop-up message will show that you have successfully created the ID.
Clicking this new icon will display the “Created Variable” screen (Figure 7), which will show numerous pieces of information along the left-hand side. It is possible to edit much of the information along the left column, which includes API label, unit of measurement, allowed range, and similar (the key item to note is the ID, which will identify where the data from your program should be located).
Figure 7. Ubidots “Variable” screen
It is best to review the tutorial documentation located through the drop-down menu by hovering over your “Profile” icon. Plenty of great information is available on topics such as HTTP API and MQTT interfaces together with tutorials on other IoT devices.
You will need an interface to transfer data from the Maxim board and sensor to the cloud. This can be performed through a mobile device, such as a cell phone or a tablet. For this project, Mouser Electronics stayed within the limits of the Android framework and used Android Studio for app creation to aid in visualizing the information Mouser Electronics’ heart-rate sensor provides.
To save time, the example app BluetoothLeGatt was used primarily, which allows you to scan for available Bluetooth devices, link to those devices, and see the resources available. This can offer you a good example for constructing your own Bluetooth-enabled apps (if you decide to go that route). Ubidots also provides a tutorial on connecting and transmitting data through the app to their service. Here, it is recommended that you review for instructions on where to put your API and variable tokens.
Importing the Code
From Mouser’s GitHub, download the files labeled BLEHR.7z needed for import into Android Studio. As a result of file-size restrictions, the project code is archived twice and will entail you to extract it.
The code can be imported into Android Studio either by clicking “Open an existing Android Studio project” from the main start screen or by going to the FileàOpen menu. From here, you can review how the API for Ubidots (Figure 8) has been changed and implemented.
(Note: Remember to change the token keys prior to building your program, as stated earlier. If the keys are not updated before building, your data will not be shown on Ubidots.)
Figure 8. Android Studio Ubidots API token code
Building the App
To test and debug code, you can:
- Construct an app to sideload to your device. Use this option if you do not plan to adjust the code beyond updating the API and variable tokens.
- Make use of the “Developer’s” option to enable USB debugging. This will also permit you to use your phone or tablet as a virtual test bed by plugging it straight into the PC you are programming on. Either through a web search or by using the tutorials in Android Studio, you can locate instructions on how to enter the “developer mode.”
If you choose to use a device as a development tool, you can just click “Run” from the menu bar and pick your device to begin building and operating the app. Once loaded, the app should appear on your chosen device. (Note: You cannot use this app from a virtual device because Bluetooth is not supported.)
If you decide to just sideload, you will have to first build the code by selecting “Build,” then “Build APK(s).” This will form a new file, which you can then copy to your preferred device to install.
Even though sideloading the app is an option that functions well if you do not plan to make alterations to the software, it is advisable to use a device of your choice as a test bed. Using a device in “USB debug mode” will allow you to update, rebuild, and run your code over and over again, which can be very beneficial in programming and debugging.
Putting It All Together
Once you have had a chance to load the app and launch it, you can see a “Scan” icon in the top-right corner that will permit you to scan for any Bluetooth devices in range. If you have wired and programmed the MAX32630FTHR and MAXREFDES117 properly and the device is powered on, you should be able to see a device labeled HRM in the list of devices that populates.
Ready to see the results?
- Confirm that location permissions are enabled. If you are not sure where this option can be found, refer to your device’s online documentation or help.
- Select HRM to open a new screen. You will see several pieces of data: device address, data output, and current state.
- Click the “Connect” button in the top-right corner to permit connection to the device and to see the list of services via a drop-down menu.
- Finally, select “Heart-Rate Measurement,” and you will see data start to populate the screen (Figure 9).
Figure 9. When you select “Heart-Rate Measurement,” you will see data start to populate the screen.
If you have updated the code to include the right API and variable tokens, you should currently be able to log into your Ubidots account and view available data within the device, through the “Device” tab.
You can now generate a dashboard for a quick view of the information in several different formats based on your requirements (Figure 10). Ubidots has newly released a beta Android app that you can set up to view your dashboard and devices, from either a tablet or phone (Figure 11).
Figure 10. Ubidots Android App Dashboard
Figure 11. Ubidots Website Dashboard
Wearable devices are valuable tools that can add convenience to everyday lives. These devices can offer users with a range of feedback, including sleep quality, activity levels, VO2 levels, and walking and running cadence, among other data points. Furthermore, they can help you keep track of your health and communicate to healthcare providers by transmitting information, such as daily blood glucose levels or blood pressure.
Building wearable devices requires incorporating peripherals to sense, store, display, and retrieve data. The Pegasus Rapid Development Platform has eased development by incorporating core peripherals into the development board, and the 700-MAXREFDES117# heart-rate monitor reference design is user-friendly to use. Ubidots, Mbed OS, and Android Studio software have rounded out the technologies for cloud servicing, cloud-based programming, and cloud interfacing, respectively.
Mouser Electronics is a worldwide leading authorised distributor of semiconductors and electronic components for over 600 industry-leading manufacturers. We specialise in the rapid introduction of new products and technologies for design engineers and buyers. Our extensive product offering includes semiconductors, interconnects, passives, and electromechanical components.
In 2007, Mouser became part of the Warren Buffett Berkshire Hathaway family of companies. Today, Buffett's holdings include insurance and finance subsidiaries and a host of almost fifty businesses ranging from jewellery and furniture to manufactured homes.
Mouser has a strong commitment to customer service. That’s why we’ve won awards for our legendary worldwide customer service excellence. We understand the value of having a knowledgeable person there to answer your questions quickly. Mouser is redefining customer-focused distribution.
Worldwide Customer Service
Mouser is the only component distributor to consistently receive an audited award for Customer Service Excellence. With 22 locations located strategically around the globe, we speak your language (supporting 17 different languages) and are able to transact business in 27 currencies. This translates into the flexibility of not requiring a minimum order and same-day shipping. At Mouser, our commitment to unsurpassed service and support knows no boundaries.
State-of-the-Art Warehouse Operations
When you need the right part right now, think Mouser. Selection, speed and accuracy are the core of Mouser’s state-of-the-art warehouse with sophisticated equipment enabling us to process orders 24/7. The wireless warehouse management system is streamlined to nearly perfect pick-and-ship operations delivering a 5-Sigma confidence rating, better than 99%. Orders are processed and ready to ship in 15 minutes in most cases, enabling same-day shipping on most orders to nearly 500,000 customers in 170 countries. It’s about doing what’s right for the customer, and that’s getting the order right and delivered on time every time.
Sponsored Content Policy: News-Medical.net publishes articles and related content that may be derived from sources where we have existing commercial relationships, provided such content adds value to the core editorial ethos of News-Medical.Net which is to educate and inform site visitors interested in medical research, science, medical devices and treatments.