Software

AttysScope (Android)

AttysScope an Android app for the Attys which displays, analyses, records and allows in-app-sharing of data, for example on google drive.

Features

  • 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

Running AttysScope

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.

Data format

AttysScope saves data as tab separated values where every column of a tsv file represents a channel:

Column number:

  1. Timestamp in secs (from the moment REC is pressed)
  2. Acceleration X in m/s^2
  3. Acceleration Y in m/s^2
  4. Acceleration Z in m/s^2
  5. Magnetic field X in T
  6. Magnetic field Y in T
  7. Magnetic field Z in T
  8. Analogue channel 1 (unfiltered) in V
  9. Analogue channel 2 (unfiltered) in V
  10. Analogue channel 1 (filtered) in V
  11. 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.

Python scripts

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

You can also install from source by compiling it with Android Studio.

AttysScope (Windows/Linux)

Features

  • 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!

Windows installation

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.

You can also install from source by compiling it with the (free) Visual Studio C++ community edition or under Linux with QT5-dev installed.

Linux installation

Check out the source from github and compile with “qmake” and “make”. You need to have the QT5 development packages installed.

Running AttysScope

Just make sure your Attys is paired with your computer and then start the application.

Science Journal

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:

Google science journal talking to ATTYS

How to install

  1. Install AttysScope which contains the driver for ScienceJournal
  2. Install ScienceJournal from google play:

AttysECG

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.

Features:

  • Heartrate plot which allows you to see heartrate variability and changes of the heartrate after exercise
  • 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
  • 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:

  1. right arm: “-” connected to Channel 1
  2. left arm: “GND”
  3. left leg: “+” connected to Channel 1.

Data format

The 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:
  1. time in secs
  2. Einthoven I (V)
  3. Einthoven II (V)
  4. Einthoven III (V)
  5. Augmented lead aVR (V)
  6. Augmented lead aVL (V)
  7. Augmented lead aVF (V)
  8. heartrate (BPM)

Python

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

Install AttysECG from google play:

You can also install from source by compiling it with Android Studio.

AttysEEG

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.

Features

  • 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

AttysEEG on github

Dataformat

Every column represents one channel:

  1. time (sec)
  2. raw EEG (V)
  3. filtered EEG with mains and DC removed (V)
  4. delta band, below 4Hz (V)
  5. theta band, 4-8Hz (V)
  6. alpha band, 8-13Hz (V)
  7. beta band, 13-30Hz (V)
  8. 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 install

Install AttysEEG from google play:

You can also install from source by compiling it with Android Studio.

Python

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. This example code loads an ECG file recorded with AttysECG and plots it:


import numpy as np
import pylab as pl
#
data = np.loadtxt('demo_ecg.tsv');
#
pl.plot(data[0:1000,0],data[0:1000,2]);
pl.xlabel('time/sec');
pl.ylabel('II/V');
pl.show();

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.

Do realtime processing of the incoming Attys Data with Python

We have Python scripts on github which demonstrate how to read data directly from the Attys. The one script asks the Attys to transmit the data in the form of comma separated values (CSV) and the other script as BASE64 (recommended for 250Hz).

OCTAVE

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

load mysignal.tsv

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:

y=mysignal(:,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:

plot(y)

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 timestamps:

plot(t,y);

Filtering of the signal

With 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

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.

Plotting

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 png
set output "channel1.png"
replot
which replots the last plot but into the PNG image ‘channel1.png’.