Build Your Own Tremor Sensor-inator

by Jochem in Circuits > Arduino

1119 Views, 1 Favorites, 0 Comments

Build Your Own Tremor Sensor-inator

arduino strapped to arm.png

I am a final year BA student at the HAN University of Applied Sciences studying Embedded Systems Engineering (ESE). For my final project, I have developed a tremor sensor for Parkinson’s patients.


What you will make

In this tutorial you will learn how to use an Arduino Nano 33 BLE Sense as a tremor sensor, which can be used to track the effects that exercises and/or medication are achieving for a Parkinson’s patient’s tremor.


What you will learn

·        Know how to add boards to the Arduino IDE

·        Know how to add software libraries in the Arduino IDE

·        Know how to use the built-in inertial measurement units (IMUs) of the Arduino board

·        Some basic Digital Signal Processing (DSP)

Background

Parkinson's disease (PD) is a neurodegenerative disorder that affects predominately dopamine-producing (“dopaminergic”) neurons in a specific area of the brain called substantia nigra.

Symptoms generally develop slowly over years. The progression of symptoms is often a bit different from one person to another due to the diversity of the disease. People with PD may experience:

·        Tremor, mainly at rest and described as pill rolling tremor in hands. Other forms of tremor are possible

·        Bradykinesia

·        Limb rigidity

·        Gait and balance problems

The cause remains largely unknown. Although there is no cure, treatment options vary and include medications and surgery. Research has shown[1] that exercise can improve gait, balance, tremor, flexibility, grip strength and motor coordination. Exercise such as treadmill training and biking have all been shown to benefit, along with Tai Chi and yoga.

For any physiotherapist or neurologist, it is important to know what effects their treatments are having, and also for the patients it is important to know what the exercises do for them. Tremors are currently measured with a tremor/vibration sensor.


[1] https://www.parkinson.org/Understanding-Parkinsons/Treatment/Exercise/Neuroprotective-Benefits-of-Exercise#:~:text=Research%20has%20shown%20that%20exercise,with%20Tai%20Chi%20and%20yoga.

Supplies

Arduino.jpg
Cable.jpg
Arduino.png
ElasticBands.jpg

Hardware

1x Arduino Nano 33 BLE Sense

1x Micro USB cable

2x Elastic band

Software

Arduino IDE

https://www.arduino.cc/en/software

 

Installing Arduino

FZ1SWPDL03UWEU8.png
Install boards.png
Boards Manager.png

The first step of this instructable is to get and install the Arduino IDE and set it up such that the required libraries are installed.

You can get the Arduino IDE from this website: https://www.arduino.cc/en/software

Once downloaded, follow the instructions to install it.



Installing Arduino Board


Installing Required Libraries

Use correct board.png
Manage Libraries.png

Installing required libraries

Now that you’ve got the Arduino software, we will need to install some libraries and tell the IDE which Arduino Board you are using.

Firstly, to install the required libraries, in the Arduino software open the library manager, head to:

Tools  ->  Manage Libraries

Or simply press Ctrl + Shift + l.

Now that you’ve opened the Library Manager, we will need to install two required libraries for this project.

The first is a library called ‘Arduino_LSM9DS1’, this library is required to read the inertial measurement unit (IMU) data from your Arduino Nano board. To install this library simply enter “Arduino_LSM9DS1” in the search bar of the library manager, and it should be the first result.

Additionally, we will need the newest version of the arduinoFFT library by Enrique Condes. This library will be used to perform some digital signal processing on the raw data produced by the IMU you’ve just installed the libraries for. The first attached image for this step shows the libraries you will need.

Install the Arduino Nano Drivers

Boards Manager.png
Install boards.png
Use correct board.png

Now that you’ve got the libraries installed, the next step is to install necessary drivers using the Boards Manager.

The Arduino IDE comes with may boards installed by default, but the Arduino Nano 33 BLE Sense is not one of them.

You will find this option near the library manager in:

Tools  ->  Board: “name of current board”  ->  Boards Manager…

In the Boards Manager, simply type “Arduino Mbed OS Nano Boards”, this will show you the results as in the image above. Install the board, and you will be good to go for the rest of the instructable!

One last note, make sure to select the board you’ve just installed as the board Arduino is currently working with, as follows:

Tools -> Board: “name of current board” -> Arduino Mbed OS Nano Boards -> Arduino Nano 33 BLE

Install the Tremor Sensor Software

With your Arduino environment set-up, you can now download my software package and run it on your Arduino Nano board. Alternatively, you can copy and past all the code into your own Arduino project, if you’d prefer not to download random files from the internet.

If you did download the files below, you can simply double-click on 'TremorSensor.ino'. This will open the Arduino project which should be ready to go.

Validation of Installation

Now that you've got the Arduino environment completely set-up, with the code and everything, it is time to test whether everything has been installed correctly. Verify the code by clicking the checkmark in the top-left of the Arduino IDE.

After a while the program should be done compiling, this means the installation has worked correctly!

Should an error pop-up, check that you've properly installed the libraries, selected the correct board, and have set-up the Arduino project properly, there should be 10 tabs of code within the Arduino IDE.

Run the Code on Your Arduino!

You can start measuring the tremor! Simply choose the correct COM port and deploy the code onto the board. If your Arduino is plugged into your PC with the USB cable, it will show up under one of the COM ports in:

Tools -> Port: "COMx"

With the correct port selected this should look like:

Port: "COM5 (Arduino Nano 33 BLE)"

The number of the COM port may differ, but the same board name should be there.

With that done, you can click the arrow button next the verification button you pressed earlier. This one uploads the code onto the Arduino Nano board. The board is now already running and actively looking for tremors!

Open the serial monitor (the looking glass on the top-right of the IDE), here you will see the tremor frequency and amplitude. Since you're not attached to it yet, it should show 0 on both.

Test Setup

Sample Results.png

With the Arduino board running, you can start measuring a tremor. There are a number of filters running on it, so if you shake it between 3 and 10 Hz you should see the board reacting to that in the serial monitor. Within the serial monitor it should be displaying the amplitude and frequency of your shaking!

To properly use your installation you should now strap the little Arduino board to the ligament with a tremor. The easiest mounting position, if you have a resting tremor in your arm, would be to attach the Arduino to the wrist using a pair of rubber bands. With the patient close to a cumputer you can monitor the amplitude and frequency of the tremor.


The serial monitor should show an output like shown above


Now, if you start new exercises or medication, you can track whether they are working for you by logging the tremor data and seeing whether these new exercises or medication are having positive effects on the tremor. Hopefully this will enable you to keep tabs on the effectiveness of treatment plans, pill dosages or other symptom alleviating measures.



Testing!

xyzNano.png
TremorsGraph.png
SampleTremors.png

If you would like to test your new tremor sensor yourself, and see what kind of outputs you can generate you can do a few things;

Firstly, the motion sensor on the Arduino board is capable of detecting in which direction it is being moved. So if you can simulate a tremor by shaking the arduino at a regular frequency (between 3 and 10 Hz preferably). The arduino will then tell you whether the tremor is in the x, y or z direction (as shown in the image). You can try all directions by manually shaking the sensor in various directions as indicated.

The output if the arduino is not being moved should be something like as follows:

x/y/s-axis:
tremor frequency is: 0.0000
tremor amplitude is: 0.0000

Once you start moving the tremor sensor, the output that will be displayed is the tremor with the most consistent frequency over the last 2 minutes, in the axis with the highest amplitude.

So for example, if the arduino gets shaken in the z-axis, so up and down:

z-axis:
tremor frequency is: 2.1484
tremor amplitude is: 4.1796

You could log this data and put it in an excel sheet. This way it will be easier to notice trends within tremors.

The first excel sheet attached shown some general characteristics of tremors, when they're in a certain range of amplitude and frequency. The second sheet shows some sample results I obtained by shaking the tremor sensor myself at various frequencies, with various distances between turning points of those frequencies (amplitudes).

After use with exercise plans, the hope is ofcourse that the amplitude and or frequency of a resting tremor reduce so that they are less inhibiting during day to day life. The ideal situation would be a tremor of (0, 0) (no frequency, no amplitude, because there is no tremor).