With motherhood always requiring extra effort, and wearable electronic devices becoming more prevalent these days, it is possible with simple technologies to keep an eye on your baby, especially during their first adventurous walks.
This system simply notifies you via an Android app when your child is in another room, for example, and has fallen. It consists of an IMU sensor module (H0BR40) that detects acceleration when walking/falling, an RGB LED module (H01R0x) that sends a visual alarm and a Bluetooth module (H23R1x) that sends the alarm event directly to the mobile phone via "Hexabitz Fall Detection" dedicated app.
Tools used in this projectWe'll list the tools and modules used in this project:
1) Hexabitz IMU module (H0BR40):
H0BR4x is a 3-axis inertial measurement unit (IMU) combined with a 3-axis digital compass module [1].
2) Hexabitz RGB LED module (H01R0x):
H01R0x is a smart RGB LED module [2].
3) Hexabitz Bluetooth/BLE module (H23R1x):
H23R1x is a Bluetooth/BLE module [3].
4) User Tools Kit:
This kit includes the tools that are essential for programming, debugging, and powering Hexabitz modules.
- FTDI USB to UART Serial cable:
The 4-pin USB 2.0 to UART serial cable is an indispensable tool for Hexabitz development! It incorporates FTDI’s USB to UART interface [4].
- Hexabitz BitzClamp:
Hexabitz BitzClamp is a modified Kelvin current clamp soldered to two 2.56 mm-pitch male jumper wires [5].
- STLINK-V3MODS Programmer (H40Rx):
H40Rx is a programmer module which contains STLINK-V3MODS stand-alone debugging and programming mini probe for STM32 microcontrollers (Hexabitz modules and other MCUs) [6].
- E-Z-Hook Programming Kit:
Instead of soldering SMD connectors there, you could use a nice off-the-shelf E-Z-Hook kit that we assembled for you [7].
We'll mention step by step instructions from designing to implementing of the project:
1. Planning the array and assembling the hardware:
First, we prepare the project parts and plan our array design by aligning the three modules side by side. Then we solder the modules together using Hexabitz Fixture.
2. Writing codes with STM32CubeIDE software:
This project uses a technique based on the principle of detecting changes in the motion and body position of a baby wearing a sensor by tracking the changes in acceleration in the x-axis direction.
After creating the topology for the three modules and setting their configurations, we add the topology for each module. See this link for help in creating a topology file.
First, we define our sensor accelerometer variables in the main.c file of the module IMU (H0BR40):
/* Private variables ---------------------------------------------------------*/
float ax = 0.0f;
float ay = 0.0f;
float az = 0.0f;
Then we obtain the filtered and calibrated values of the accelerometer in units of g using the following API from the H0BR40 factsheet:
In the UserTask function, we now write our repeated code that checks if the baby is moving regularly. Here, the value of the x-axis is in the range of (ax ≤ 0.99 g). In this case, we send a message to the module RGB LED, so that it lights green (save mode).
Otherwise, if the baby has fallen, the value of the x-axis briefly changes to a range of values above 1 g. In this case, the color of the LED module changes to red in dim mode, the fall alarm mode. A message is then sent to the Bluetooth module, which is received in the same time in the Android app on your phone and triggers an audible alarm with a red message on the screen.
These values were first monitored using the STM32CubeIDE debugging function to monitor our accelerometer live expressions, as shown in Figure (10).
SampleAccG(&ax, &ay, &az);
if(ax<=0.99){
messageParams[0] = 0;
messageParams[1] = GREEN;
messageParams[2] = 15;
SendMessageToModule(2, CODE_H01R0_COLOR, 3);
}
else if(ax>1){
messageParams[0] = RED;
messageParams[1] = RGB_DIM_UP_DOWN_WAIT;
messageParams[2] = (uint8_t)(30000>>24);
messageParams[3] = (uint8_t)(30000>>16);
messageParams[4] = (uint8_t)(30000>>8);
messageParams[5] = (uint8_t)(30000);
messageParams[6] = (uint8_t)(1000>>24);
messageParams[7] = (uint8_t)(1000>>16);
messageParams[8] = (uint8_t)(1000>>8);
messageParams[9] = (uint8_t)(1000);
messageParams[10] = 0;
messageParams[11] = 0;
messageParams[12] = 0;
messageParams[13] = 1;
SendMessageToModule(2, CODE_H01R0_DIM, 14);
writePxMutex(P3, (char*)"a",1 , cmd50ms, HAL_MAX_DELAY);
}
3. Building an Android app using MIT App Inventor:
Figure (11) shows the application screen and the cases created for the application user:
- Not Connected: You will see this screen if you are not yet connected to the Bluetooth module (H23R1x) in the system (first check the pairing in your phone's Bluetooth list, then click the "Not Connected" list picker to pair with the module in the app).
- Connected: If you are successfully connected to the module, this screen will be displayed and remain stable if no fall detection has occurred, unless a byte is received from the Bluetooth module (representing a fall event). Then the screen will display the message "Your baby is at DANGER!" with an audible alarm.
Figure (12) shows the blocks used to establish the connection between the Hexabitz modules and the Android app using Bluetooth technology [8].
The following video shows the final results of our project, enjoy watching!
References
[1]: IMU and Digital Compass (H0BR4x) – Hexabitz
[2]: RGB LED (H01R0x) – Hexabitz
[3]: Bluetooth/BLE (H23R1x) – Hexabitz
[4]: 4-Pin USB-Serial Prototype Cable – Hexabitz
[5]: Hexabitz BitzClamp – Hexabitz
[6]: STLINK-V3MODS Programmer (H40Rx) – Hexabitz
Comments
Please log in or sign up to comment.