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.

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.

In case the baud rate matters on your system set it to 115,200baud or 230,000baud.

These are the text commands you can send to 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 (start 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.
  • ADC gain / channel selection: every bit within this command byte has a certain function. The bits ggg set the gain for the ADC at 0=x6, 1=x1, 2=x2, 3=x3, 4=x4, 5=x8, 6=x12 and the mmm bits switch the multiplexer. For example a=16 sets the gain of channel 1 to g=x1.

    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 Einthoven recordings on both channels.

    • Set mux/gain of ADC channel 1: a=0ggg0mmm as a decimal number, for example a=16
    • Set mux/gain of ADC channel 2: b=0ggg0mmm as a decimal number.

JAVA

The class AttysComm.java in AttysScope 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. The class is also able to save data in comma-, tab- or space-separated values. Check out the main program AttysScope how it processes data and/or Attys2ScienceJournal which provides a driver to Google ScienceJournal.

C++ for Linux / Windows

The class AttysComm.cpp in attys_scope is very similar to the JAVA class and features a ring buffer for plotting of the data, for example in QT.