AttysScope an Android app for the Attys which displays, analyses, records and allows in-app-sharing of data, for example on google drive.
- DC and mains interference removal
- Displays signals from V down to uV and adjustable timebase
- Saves both filtered and raw signals in data format which can be easily processed in MATLAB(tm), OCTAVE, R or excel
- Displays peak to peak voltage, root mean square and heartrate as both plots or just text overlay
- Fourier spectrum of the signal
- Works on a wide variety of devices
Just make sure you have paired your phone/tablet with the Attys. In older Android versions you might need to type in a security code which is ‘1234’. Then start AttysScope.
AttysScope saves data as tab separated values where every column of a tsv file represents a channel:
- Timestamp in secs (from the moment REC is pressed)
- Acceleration X in m/s^2
- Acceleration Y in m/s^2
- Acceleration Z in m/s^2
- Magnetic field X in T
- Magnetic field Y in T
- Magnetic field Z in T
- Analogue channel 1 (unfiltered) in V
- Analogue channel 2 (unfiltered) in V
- Analogue channel 1 (filtered) in V
- Analogue channel 2 (filtered) in V
For example if you want to work with the 1st analogue channel then you extract column #8.
This data format is accepted by python, MATLAB(tm), OCTAVE, GNUPLOT and many other plotting applications.
The data files can directly be loaded into Python. Check out the github repository for an example script and you’ll see how easy it is to process data with python.
How to install
- Records from multiple Attys at the same time. For example, you can attach two Attys to both the upper and lower arm to measure muscle activity, acceleration and orientation.
Tested BT dongles which work with more than one Attys:
- ASUS-BT400: four Attys
- Belkin: two Attys
- Select the channels you’d like to see on screen and you’d like to save
- Saves data as tab separated values which can be directly imported into Python, MATLAB ™, OCTAVE, R, GNUPLOT and many other software packages.
- Change the gain, filter out DC, 50/60Hz mains interference and smooth the signal on screen.
- Compiles under Windows and Linux (QT5) and is of course open source!
We recommend the Belkin USB bluetooth dongle, the ASUS-BT400 or internal laptop bluetooth adapters for optimal performance.
Download attys_scope.msi and double click on it.
Attys Scope uses QT5.7 under the LGPL which requires us to host its source code. You can download QT5 here.
Check out the source from github and compile with “qmake” and “make”. You need to have the QT5 development packages installed.
Just make sure your Attys is paired with your computer and then start the application.
Science Journal (Android)
Science Journal is an initiative by google to inspire the next generation of scientists! It’s been widely used in STEM education with more than 100,000 mobile phone / tablet installations.
It allows you to record sensor signals from both the Attys and the internal mobile phone/tablet sensors, document them in an electronic lab book and share the results.
You can configure the Attys to measure Volt, millivolt, microvolt and resistance so that it allows a wide range of experiments, for example in Physics education measuring the voltage induced in a coil, in Chemistry to measure pH or Biology to measure signals such as ECG, EMG, EOG and EEG.
This is the trace shown in the clip above when moving a magnet over an improvised coil to show the induced voltage:
How to install
AttysECG is a specialised ECG program for Attys which displays all frontal leads: Einthoven I,II,II and the augmented leads aVR,aVL,aVF using just 3 electrodes: two on the shoulders/wrists and one on the leg/hip.
- Heartrate plot which allows you to see heartrate variability (HRV) and changes of the heartrate after exercise. It calculates the average BPM, the standard deviation, and the RMSSD.
- Vector ECG which is a realtime visual representation of the electrical heart axis not just for R but also for P and T.
- PQRST inspector: pan/zoom into a single PQRST complex and do precise measurements of the timings and amplitudes
- Single channel mode, for example for Vets or if you just want to record Einthoven II:
- Heartbeat ‘beep’ sound
- The data can be loaded straight away into Python, OCTAVE, MATLAB(tm), GNUPLOT, R, …
- Works on a wide variety of screens in both landscape and portrait mode (Android Fragments)
Recording the ECG
You just need three electrodes:
- right arm: “-” connected to Channel 1
- left arm: “GND”
- left leg: “+” connected to Channel 1.
Data formatThe ECG is saved as a text file containing human readable numbers. You can always check the content with a text editor. Every row corresponds to a moment in time and the columns contain the different channels:
- time in secs
- Einthoven I (V)
- Einthoven II (V)
- Einthoven III (V)
- Augmented lead aVR (V)
- Augmented lead aVL (V)
- Augmented lead aVF (V)
- heartrate (BPM)
Python can directly load the data files so that you can plot and process the recorded data. Check out the “python” folder on github for an example script which plots all 6 ECG channels.
How to install
AttysEEG is our EEG Android app and has especially been designed for displaying and analysing EEG in realtime on your tablet or phone. You can easily extend it by adding so called Android Fragments for your specific analysis needs which then show up on the right hand side of the app.
- Realtime EEG plotting and recording on your phone or tablet
- Plots alpha, beta, gamma, delta and theta bands
- Histograms of the different bands either in microvolts or normalised
- Auditory evoked potentials (AEP) by playing click sounds or custom sounds through the headphone jack
- Visually evoked potentials (VEP) by using a standard inverting chequerboard stimulus
- Beta Ratio and PowerFastSlow which is used to determine the depth of anaesthesia
- Saves the raw EEG, the different bands and the analysis results as tab separated files for analysis in MATLAB(tm), OCTAVE, R, excel, …
- Easily extensible using Android Fragments
Every column represents one channel:
- time (sec)
- raw EEG (V)
- filtered EEG with mains and DC removed (V)
- delta band, below 4Hz (V)
- theta band, 4-8Hz (V)
- alpha band, 8-13Hz (V)
- beta band, 13-30Hz (V)
- gamma band, above 30Hz (V)
These files can directly be loaded into Python (csv.reader or numpy.loadtxt), Octave and MATLAB(tm).
The bands are created by 2nd order low- and highpass Butterworth filters.
How to installInstall AttysEEG from google play:
Process your data with Python straight away
Generally, all Attys apps (AttysScope, AttysECG and AttysEEG) export the data in a Python compatible format so that you can load the data directly into two dimensional arrays. All data is exported as tab separated data which is supported by both python’s CSV reader and numpy’s loadtxt command.
import numpy as np
import pylab as pl
data = np.loadtxt('demo_ecg.tsv');
Both numpy and pylab are feature rich libraries which allow you to do signal processing and analysis of your data.
Check out github for examples.
Filtering of data
Python’s scipy library has powerful functions to process the data. Here is an example which first performs a highpass filtering of the input signal and then a bandstop filtering at 50Hz to remove mains interference.
# sampling rate
fs = 250
# highpass Butterworth filter
cutoff = 0.25
# create a 4th order highpass
b, a = signal.butter(2, cutoff/fs*2.0, 'highpass')
# filter the signal adc1
adc1filt = signal.lfilter(b, a, adc1)
# create a 2nd order order stopband filter at 50Hz
# to remove the 50Hz mains
f1 = 45
f2 = 55
b, a = signal.butter(2, [f1/fs*2.0, f2/fs*2.0 ], 'bandstop')
# filter the 1st ADC channel
adc1filt = signal.lfilter(b, a, adc1filt)
Record data directly with Python
For the pure Python enthusiasts we have Python scripts on github which demonstrate how to directly read data from the Attys, process and display it.
OCTAVE allows you to filter, plot and post-process the data you’ve recorded with the Attys.
Loading tab separated data in a matrix
With the command
you load the TSV file into the matrix ‘mysignal’. The different channels are now in the different columns of the matrix. Every row contains the samples from one moment in time.
Extracting one channel
Let’s extract the analogue channel which is in column 8:
This command stores channel one in the vector ‘y’.
Plotting the channel
Use use the ‘plot’ command to create a graph of the signal:
The plot command can also plot time against data so if you extract the time
t=mysignal(:,1); as well then you can plot your data against the
Filtering of the signalWith just three commands one can filter the signal. For example, a lowpass filter at cutoff frequency 10Hz can be set up with these commands:
pkg load signal
[b,a]=butter(4,10/250*2); % filter coefficients
y2=filter(b,a,y); % filter the signal
This sets up a 4th order Butterworth lowpass filter with a cutoff frequency of 10Hz where the sampling rate of the Attys has been at 250Hz. Type ‘help butter’ how to set up other filters.
GNUPLOT is a plot program which can read the Attys data files straight away. It uses simple text commands to plot the data. It’s available for a myriad of different platforms, for example for Windows, MAC, Linux and Android.
The plot command is central in gnuplot:
plot "mysignal.tsv" using 1:8 with lines
The ‘using’ keyword selects the columns (here 1 against 8) and ‘with lines’ tells gnuplot to join the datapoints with lines.
Saving the plot as a graphics file
gnuplot can save in many different formats. As an example let’s say we’d like to export the plot as a PNG image for a web page:
set term pngwhich replots the last plot but into the PNG image ‘channel1.png’.
set output "channel1.png"