Documentation

Getting started

  1. Switch on the Attys. You should see a blue LED flashing inside.
  2. Pair the Attys with your bluetooh device. If the device asks for a PIN enter 1234. If the device shows a random number then just confirm.
  3. Download the application software you’d like to use and start using your Attys. For initial testing we recommend AttysScope.
  4. During data transmission the blue LED is continuously on.
  5. Charge your Attys with any USB charger. Once its charged the red LED will switch off and the green LED switches on instead.

Recommended bluetooth dongles for the PC

We recommend the Belkin USB bluetooth dongle, the ASUS-BT400 or internal laptop bluetooth adapters for optimal performance.

Attys command reference

The Attys communicates with with the host via the bluetooth serial port emulation called “rfcomm” which means that it transmits essentially text and receives text commands:

  • Data from Attsy to host: either CSV or BASE64
  • Data from the host to the Attys: text commands

These are the text commands you send to the Attys to change its settings. All commands need to be transmitted without any space and are in general in the form single letter, equal sign and a number. If the command has been understood the Attys reports “OK” back. Only the x=1 command (starts sending data) won’t send “OK”. Note that you first need to stop the data transmission with the command x=0 to issue any other command.

  • Stop data transmission: x=0
  • Start data transmission: x=1
  • Sampling rate:
    • 125Hz (base64/CSV): r=0
    • 250Hz (base64): r=1
  • Data format:
    Data is transmitted as unsigned integers. For the ADC converters the conversion is:
    inVolt = (raw_data - 0x800000) / 0x800000 * 2.42 / ADC_GAIN;
    where the ADC_GAIN is set by the a= and b= commands (default is a gain of 6). For the accelerometer and magnetometer the conversion is:
    inphysicalunits = (raw_data - 0x8000) / 0x8000 * fullScaleRange
    where the full scale range for the magnetometer is 4800.0E-6F and the full scale range for the accelerometer is set by the t= command (see below). The default is 16G. The timestamp is 8 bit and wraps around. If samples cannot be transmitted the timestamp might have gaps so that missing samples can be detected. adc_gpio carries in bits zero and one the internal gpio pins. Bit 7 of adc_gpio is set to one if power is connected for charging.
    • CSV data output (default): d=0
      sprintf(tmp,"01,%02x,%04x,%04x,%04x,%04x,%04x,%04x,%04x,%04x,%04x,%l06x,%l06x,%02x",
      timestamp,
      accel_x,accel_y,accel_z,
      mag_x,mag_y,mag_z,
      adc_ch1,adc_ch2,adc_gpio);
    • Base64/binary (recommended for 250Hz): d=1
      struct __attribute__((__packed__)) bin_data_t {
      uint32_t adc_ch1 : 24;
      uint32_t adc_ch2 : 24;

      uint8_t adc_gpio;
      uint8_t timestamp;

      uint16_t accel_x;
      uint16_t accel_y;
      uint16_t accel_z;

      uint16_t mag_x;
      uint16_t mag_y;
      uint16_t mag_z;

      The short version with just the ADCs transmitted is (f=0,d=1):

      struct __attribute__((__packed__)) bin_data_t {
      uint32_t adc_ch1 : 24;
      uint32_t adc_ch2 : 24;

      uint8_t adc_gpio;
      uint8_t timestamp;
  • Send status back to a terminal (for example putty): i=0
  • Master reset: m=0
  • Accelerometer full scale range:
    • 2G: t=0
    • 4G: t=1
    • 8G: t=2
    • 16G: t=3
  • Partial/full data set:
    • Full data set with all channels: f=1
    • ADC data only: f=0
      Note that this has no effect on CSV data.
  • Gain/Multiplxer: this command uses a the upper 4 bits (called here ggg) of a byte for the gain and the lower 4 bits to set the multiplexer (called here mmm):
    0ggg0mmm
    The bits ggg set the gain for the ADC at
    0: x6, 1: x1, 2: x2, 3: x3, 4: x4, 5: x8, 6: x12

    Settings for the multiplexer are
    mmm=0 for normal operation, mmm=1 for connection to GND, mmm=4 for the internal temperature sensor and mmm=6 for an internal connection between both analogue “+” inputs for ECG/Einthoven recordings on both channels.

    • Set mux/gain of ADC channel 1: a=0ggg0mmm as a decimal number, for example a=16 sets the gain to 1 because 16=00010000 and a=0 sets the gain to 6.
    • Set mux/gain of ADC channel 2: b=0ggg0mmm as a decimal number.

JAVA

The class AttysComm contains an easy to set up interface to Attys. It has both a ringbuffer for the data for delayed processing and/or an event listener so that data can be processed as it arrives. Check out the main program AttysScope how it processes data and/or Attys2ScienceJournal which provides a driver to Google’s ScienceJournal.

Python

On github you find Python scripts which show you how to record data from the Attys and how to process it.

Note that attys_scope for Windows/Linux is able to broadcast data to a Python script or any other program which makes life much easier. Check out the demo Python scripts of attys_scope.

C++ for Linux / Windows

The classes AttysComm and AttysScan are very similar to the JAVA class and feature a ring buffer for plotting of the data and also a realtime callback. attys_scope is a good example for the use of a ringbuffer and attys-vep serves as an example how to use the realtime callback.