Project Overview
The purpose of this project is to create a fitness smartwatch. The functions of the smartwatch are displaying the time/date, and counting the user’s steps (pedometer).
The smartwatch contains an LCD on the front of the watch to display the time/date and step count. A DRV2605L connected to an LRA has the ability to provide haptic feedback to the watch wearer, and the watch also contains an IMU with a 3-axis accelerometer to capture motion data. A custom connector PCB is attached to the Launchpad and connects the LCD, DRV2605L, and IMU to the MSP432. Power is delivered to the Launchpad, and the Launchpad distributes the proper voltage and current to the other system components. A custom 3D-printed watch case houses the components and have wrist straps.
The time/date and motion data are displayed on the watch’s LCD. The purpose of the project is to create a smartwatch that monitors the fitness of its users by collecting their step count.
Project Scope
The steps for developing this project are developing a connector PCB, UART display driver, accelerometer driver, utilizing the MSP432P401R RTC (Real Time Clock), 3D printing a custom watch case, and designing a battery pack. The components required for this project are a custom connector PCB, LCD, IMU, MSP432P401R Launchpad, DRV2605L, LRA, and a custom 3D-printed watch case.
The purpose of the custom connector PCB is to connect all of the project components together. The connector PCB provides the ability to connect all of the components with less noise and clutter than a breadboard. The Launchpad contains two 10x2 male header pins, and our connector PCB mounts onto the Launchpad through these 10x2 male header pins. In addition to the two 10x2 female header pins to interface with the Launchpad, the connector PCB contains six female header pins to connect the LCD, five female header pins to connect the IMU, and six female header pins to connect the DRV2605L.
The IMU contains a 3-axis accelerometer. Accelerometer data is utilized to collect x, y, and z-axis motion data. The smartwatch collects the accelerometer data and displays it on the LCD. Communication with the accelerometer requires a custom I2C driver.
The MSP432 contains a RTC. One of the functions of our project is displaying the time and date on an LCD. The RTC is utilized to initialize, update, and display the time and date on an LCD. The LCD controlled by a custom UART driver.
Our project is in the form-factor of a smartwatch, and a custom 3D-printed watch case has been created to enclose the electronics on the user’s wrist.
Our team has access to an Arduino UNO and tested the functionality of our hardware components prior to completion of our drivers and other firmware written for the MSP432. The LCD, DRV2605L, and the IMU are on SparkFun’s website. All of the product listings for those components contain thorough documentation and Github repositories that contain Arduino code to test the hardware. The LCD is able to display characters and activate its RGB backlight properly. The IMU is able to properly capture x, y, and z-axis accelerometer force data. In addition to this, the LRA provides haptic feedback.
Functional Block Diagram
Software Diagrams
Wiring Diagrams
PCB Schematic
Our group designed a custom connector PCB to connect all of the project components. The Launchpad contains two 10x2 male header pins, and the connector PCB utilizes these two sets of header pins to interface with all of the components. The LCD, IMU, and DRV2605L are all contained on breakout boards that contain voltage and current regulators. Our group thoroughly studied the documentation and technical specifications for our project peripherals. Although our PCB does not contain electrical components designed to regulate voltage and current, the peripherals are all being connected to pins on the Launchpad that provide safe and within-range voltages and currents.
PCB Layout
Our schematic was translated into a PCB that measures 2.05in x 1.24in. The custom connector PCB is a two-layer design, and the top and bottom layers of the board are ground planes. This PCB is designed to mount directly on top of the Launchpad, similar to Texas Instruments MSP432 BoosterPacks, and three sets of female header pin slots are on the PCB to organize the wiring of our peripheral project components.
Fabricated PCB
Our custom connector PCB was ordered from Oshpark. Oshpark provides free shipping, fast turnaround time, good build quality, and low prices for multiple boards.
The PCB does not contain any electrical components because all of our sensors and peripherals contain voltage and current regulators. Our connector PCB is designed to reduce clutter, lessen noise, and organize the internal wiring for the smartwatch. Populating the PCB required soldering four 10x2 female header pins, two 6x1 male header pins, and one 5x1 male header pin strip.
The PCB was tested, integrated, and verified within the system by mounting it to the Launchpad, and connecting the system components (LCD, IMU, DRV2605L) to their designated pins. All of the components contain LEDs for power, and all of the component PWR LEDs are activated when connected to the PCB. In order to test if individual components are able to receive data through the PCB, each component was tested in isolation. A script was successfully deployed on the LCD to display characters and activate the backlight over UART. A script was successfully deployed on the IMU to collect motion data and display the data in the Code Composer console over I2C. A script was successfully deployed on the DRV2605L to drive the LRA and continuously vibrate over I2C.
Pin Map
LCD
Pins on LCD
GND
RAW
RX
Pins on MSP432P401R
GND
3.3V
P3.3
DRV2605L
Pins on DRV2605L
GND
VCC
SDA
SCL
IN
EN
Pins on MSP432P401R
GND
5V
P1.6
P1.7
P2.4
P2.5
IMU
Pins on IMU
GND
VIN
SDA
SCL
Pins on MSP432P401R
GND
3.3V
P6.4
P6.5
Drawings for Housing
Code
https://github.com/stephenla0/Final_proj
Project Requirements
Identify components
Identify placement of components in watch
Identify footprints and create custom if needed
Create layout on PCB
Check correct pins for operation
Check correct pins for analyzing
Check correct power lines
Label pins
Finalize files
Order PCB
Create bottom mount
Create bottom mount cover
Create top shield
Create assembly points
Create cooling system
Create LCD mount
Create files for printing
3d print
Test screws and assembly
Assemble
Choose BCD or hexadecimal
Configure registers
Configure dividers
Config BCLK to 32768Hz
Config RTC protection
Config RTCRDY/RTCRDYIFG
Config RTC
Config crystal error
Config temp
Write driver
Test RTC
Send data to LCD
Solder headers
Test LCD works
Create LCD operation drivers
Create LCD UART drivers
Test LCD
Solder connections
Mount LCD to housing
Connect to PCB
Solder PCB connections
Select scale range
Set power mode
Config regs
Config interrupts
Process data
Use i2c driver
Test accelerometer
Mount
Retest in housing
Trade Study
The MSP432 and ICM-20948 were selected because we are already in possession of these components. Since one of the project requirements is to use UART, we selected a UART compatible LCD, which is the LCD-14072. This LCD requires a 3.3V logic level, which the MSP432 can provide. We already have a piezo. We will print from Oshpark again due to free shipping, quick turnaround time, low prices, multiple boards, and good build quality. We will most likely print the housing in the ITLL with a CAD file Stephen creates in Solidworks.
Theoretical Analysis
We need to utilize the RTC on the MSP432 to generate the time and date, the accelerometer to generate the pedometer fall detection functionality, and Solidworks to design a 3D-printed housing for the smartwatch.
The voltage needed for all components is a standard output of the msp, and our current draw is well within the parameters of the msp, so we should not have any issues with too much power draw. Our battery pack will have 4 aa batteries, and the batteries will probably have 2-4 Wh. Ignoring the DRV, the worst scenario is 0.018513 W, which will give us a little over 108 hours with the worst rated Wh batteries. The power draw of the msp and drv won’t be so significant that the batteries will die during expo. However, we will have a nuclear solution and bring our laptop in case it somehow dies and we will power it through the usb port that will be cut out on the case.
Our design is to connect the board pins to headers on a pcb mounted to the msp. It will be mounted by attaching female headers on the pcb to the male headers on the msp.
Thermal issues should not be an issue since these boards have large ambient temperature ranges and we will likely be running below 10 mA. However, we will have cooling vents on the walls of the watch to allow ventilation.
Our sensor, which is the accelerometer, was selected because we have already purchased it from the lab kit and it would be extremely dumb and financially unfeasible to purchase a different one.
Code
UART: First, enable driverlib.h. Then, configure pins for data transfer and use eusci to configure and use uart. Set the clock frequency to 12mHz, which is about the clock of the lcd (11.0592 mHz). Use the transmitdata and transmitaddress functions to transmit data to the lcd.
RTC: The purpose of the RTC code is to calibrate the Real Time Clock on the MSP432 and configure its interrupts in order to display the time on the LCD. In order to configure the RTC, unlock RTC key protected registers; and then RTC enable, BCD mode, RTC hold; enable RTC read ready interrupt; enable RTC time event interrupt; and set time event interrupt to trigger when minute changes.
IMU: The first step us to use the i2c drivers currently developed to communicate with the IMU. Since it is a sensor, a filter will likely have to be developed to filter out erroneous data. Then, form a threshold and determine if a step has been taken by detecting a peak in an axis. If there is a step, add it to a counter of steps and send the updated data to the lcd.
Github Repository Link: https://github.com/stephenla0/Final_proj
Logic Analyzer:
The debugger was primarily used for solving issues with the RTC. We used the debugger to try and retrieve data from registers, but was not successful. Afterwards, we used the debugger to debug the counter, which had some issues. The first issue we solved was an initialization error. We used the debugger to watch the counter values during the configurations, and realized order mattered for some. Once this issue was solved, another arose. The debugger was used to see the configurations caused the RTC to send 2 interrupts, so we added a start buffer to the counter function to counteract that. The project then worked as intended.
A portion of this project involved writing a custom IMU driver. In addition to reading the IMU datasheet, a logic analyzer was used to determine how to initialize the IMU. The logic analyzer was utilized to intercept I2C communication between an Arduino UNO and the IMU. The advantage of using the logic analyzer is that it collects the register being read/written to, and the data that is being transmitted. The logic analyzer collected data as the IMU was being initizlied, so the registers required for IMU initialization were recorded. The data from the logic analyzer was exported to a csv, and along with the IMU datasheet, a IMU driver was created.
Logic analyzer intercepting communication between Arduino UNO and IMU
Configuring logic analyzer settings for I2C communication
First attempt capturing data with logic analyzer. Noticed coupling on the graph, and realized the logic analyzer was not grounded.
Successful data capture with logic analyzer
Final Product:
The original idea for this project was to have a smartwatch with user interaction, and to have the ability to switch between displaying the time and displaying a pedometer step count. In addition to this, the smartwatch was going to have the ability to detect when the user falls over (trips, faints, etc), and play noise, cycle the rgb backlight, and vibrate haptics in order to alert the watch wearer and others around them for potential medical attention.
These described features had to be removed from the project because of the complexity, and physical form factor of the project. Writing the I2C driver from scratch, discovering how to use the logic analyzer, and writing the IMU driver from scratch took longer than expected. Therefore user interaction and a step count algorithm were not able to get developed. In addition to this, the physical body of the smartwatch is quite large, and our watch strap is not secure enough to be able to sustain rapid physical movement.
The final functionality of the smartwatch is displaying the time and date, and collecting motion data from the IMU.
Comments