Raspberry Pi Zero Helmet Impact Force Monitor

How much impact can the human body handle? Whether it’s football, rock climbing, or a bicycle accident, knowing when to seek immediate medical attention after a collision is incredibly important, especially if there are no obvious signs of trauma. This tutorial will teach you how to build your very own impact force monitor!

CoverPhoto-SystemALRTHelmetForceMonitor

 

This open-source project uses a Raspberry Pi Zero W and an LIS331 accelerometer to monitor and alert the user of potentially dangerous G-forces. Of course, feel free to modify and adapt the system to suit your various citizen science needs.

Required Materials

To follow along with this tutorial, you will need the following materials. You may not need everything though depending on what you have. Add it to your cart, read through the guide, and adjust the cart as necessary.

The items in the wishlist include:

  • Raspberry Pi Zero W Basic Kit
    • microSD Card w/ NOOBS OS
    • USB OTG Cable (micro-B to Female A USB)
    • Mini HDMI to HDMI
    • Micro-B Wall Adapter (5V)
    • Also Recommended: USB Hub
  • Raspberry Pi 3 Header Pins
  • LIS331 Accelerometer Breakout Board
  • Battery Pack w/ Micro-B Connector
  • LED – Basic Red 5mm
  • 1kΩ Resistor
  • 6″ Heat Shrink Tube or Electrical Tape
  • 4x Header Pins
    • 8x Pins for Accelerometer
    • 2x Pins for LED
  • 6x Female-to-Female Jumper Wires

Tools

You will also need the following tools.

  • Soldering Iron, Solder, and Accessories
  • Epoxy (Or Other Permanent, Non-Conductive Liquid Adhesive)
  • Scissors (Optional)

But Wait! What is Impact Force??

Fortunately, the term “impact force” is pretty straightforward: the amount of force in an impact. Like most things though, measuring it requires a more precise definition. The equation for impact force is:

Force Equation

where F is the impact force, KE is the kinetic energy (energy of motion), and d is the impact distance, or how much the object crunches.

There are two key takeaways from this equation:

  • Impact force is directly proportional to the kinetic energy, meaning that the impact force increases if the kinetic energy increases.
  • Impact force is inversely proportional to impact distance, meaning that the impact force decreases if the impact distance increases. (This is why we have airbags: to increase the distance of our impact.)

Force is typically measured in Newtons (N), but impact force may be discussed in terms of a “G-Force”, a number expressed as a multiple of g, or earth’s gravitational acceleration (9.8 m/s2). When we use units of G-force, we are measuring an objects acceleration relative to free fall towards the earth. Technically speaking, g is an acceleration, not a force. However, it is useful when talking about collisions because acceleration (the change in speed and/or direction) is what damages the human body.

For this project, we’ll use G-force units to determine if an impact is potentially dangerous and deserving of medical attention. Research has found that g-forces above 9G can be fatal to most humans (without special training), and 4-6G can be dangerous if sustained for more than a few seconds.

Knowing this, we can program our impact force monitor to alert us if our accelerometer measures a G-force above either of these thresholds. Hooray, science!

For more information, read about impact force and G-force on Wikipedia!

Configure the Pi Zero W

Gather your Raspberry Pi Zero and peripherals to configure the Pi to be headless!

PiZeroKit-2HelmetForceMonitor

 

  • Connect the Pi to a monitor and associated peripherals (keyboard, mouse), plug in the power supply, and log in.
  • Update software to keep your Pi speedy & secure. Open the terminal window and type these commands:
    • Type and enter:sudo apt-get update
    • Type and enter:sudo apt-get upgrade
    • Reset:sudo shutdown -r now

Enable WiFi, SSH, and I2C.

  • Click the WiFi icon on the upper right corner of the desktop and connect to your WiFi network.
  • In the terminal type this command to bring up the Pi’s Software Configuration Tool:sudo raspi-config

PiZero-RaspPiConfig1

 

  • Select “Interfacing Options”, then “SSH”, and choose “Yes” at the bottom to enable.
  • Go back to “Interfacing Options”, then “I2C”, and select “Yes” to enable.
  • In the terminal, install remote desktop connection software:sudo apt-get install xrdp
    • Type ‘Y’ (yes) on your keyboard to both prompts.
    • Find the Pi’s IP address by hovering over the WiFi connection (you might also want to write it down).

PiZero-EasyIPAddr

 

  • Change the Pi’s password with the passwd command.

Restart the Pi and Log In Remotely.

We can now ditch the HDMI and peripherals, woohoo!

  • Setup a remote desktop connection.
    • On a PC, open Remote Desktop Connection (or PuTTY if you’re comfy with that).
    • For Mac/Linux, you can install this program or use a VNC program.
  • Enter the IP for the Pi and click “Connect” (Ignore warnings about unknown device).

RemoteDesktopConnection

 

  • Log in to the Pi using your credentials and away we go!

Build it: Electronics!

Here’s the electrical schematic for this project:

ImpactForceMonitor-FritzingSchematic_bb

 

Here’s the pinout for the Pi Zero W for reference:

PiZero_1

 

LIS331-HeadersBackHelmetForceMonitor

PiZero-Closeup_HeadersHelmetForceMonitor

Connect the LIS331 Accelerometer to the Pi’s GPIO

Then connect jumper wires between the LIS331 breakout board and Pi between the following pins:

LIS331 Breakout Board Raspberry Pi GPIO Pin
GND GPIO 9 (GND)
VCC GPIO 1 (3.3V)
SDA GPIO 3 (SDA)
SCL GPIO 5 (SCL)

To make it easier to connect the sensor to the Pi Zero, a custom adapter was made by using a female header and jumper wires. Heat shrink was added after testing the connections.

PiZero-LIS331HelmetForceMonitor

 

Add an Alert LED!

Solder a current limiting resistor to the negative LED leg (shorter leg) and add shrink wrap (or electrical tape) for insulation.
LED-ResistorHelmetForceMonitorLED-ShrinkTubeHelmetForceMonitor

Use two jumper cables or header pins to connect the positive LED leg to GPIO26 and the resistor to GND (header positions 37 and 39, respectively).

Completed Setup

Connect the battery pack to the Pi’s input power to complete the setup!

 

FullSystem-Electronics_OFFHelmetForceMonitor

Program It!

The Python code for this project is open-source! Here’s a link to the GitHub repository.

IMPACTFORCEMONITOR GITHUB REPO

For Folks New to Programming:

  • Read through the program code and comments. Things that are easy to modify are in the “User Parameters” section at the top.

For Folks More Comfortable w/ the Technical ‘Deets:

  • This program initializes the LIS331 accelerometer with default settings, including normal power mode and 50Hz data rate. Read through the LIS331 datasheet and modify initialization settings as desired.

All:

  • The maximum acceleration scale used in this project is 24G, because impact force gets big real quick!
  • It is recommended to comment out the acceleration print statements in the main function when you are ready for full deployment.

Before you run the program, double check that the accelerometer address is 0x19. Open the terminal window and install some helpful tools with this command:
sudo apt-get install -y i2c-tools
Then run the i2cdetect program:
i2cdetect -y 1
You’ll see a table of I2C addresses displayed as shown in the image below. Assuming this is the only I2C device connected, the number you see (in this case: 19) is the accelerometer address! If you see a different number, take note and change in the program (variable addr).

Pi-I2C_DetectAddress

 

Quick Overview

The program reads the x, y, and z acceleration, calculates a g-force, and then saves the data in two files (in the same folder as the program code) as appropriate:

  • AllSensorData.txt – gives a timestamp followed by the g-force in the x, y, and z axes.
  • AlertData.txt – same as above but only for readings that are above our safety thresholds (absolute threshold of 9G or 4G for more than 3 seconds).

G-forces above our safety thresholds will also turn on our alert LED and keep it on until we restart the program. Stop the program by typing “CTRL+c” (keyboard interrupt) in the command terminal.

Here’s a photo of both data files created during testing:

Having a hard time seeing the data? Click the image for a closer look.

 

Having a hard time seeing the data? Click the image for a closer look.

Read More Info….

Raspberry Pi Zero Helmet Impact Force Monitor


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top