Habitatt

Re-ink your habits: Temporary Tattoos for emotional well-being

IntermediateFull instructions provided16,211
Habitatt

Things used in this project

Hardware components

SparkFun Audio-Sound Breakout - WTV020SD
SparkFun Audio-Sound Breakout - WTV020SD
×1
SparkFun Audio Jack Breakout
×1
SparkFun Audio Jack 3.5mm
×1
Adafruit Capacitive Touch Sensor
×1
Adafruit PowerBoost 500 Charger
×1
Arduino Micro
Arduino Micro
×1

Story

Read more

Custom parts and enclosures

Enclosure base

Base of the enclosure that houses the PCB and hardware components. Has slots for USB, headphone jack, and wires connecting to tattoo.

Enclosure top

Top lid of the enclosure. Features the Habitatt graphic.

Enclosure belt clip

Belt clip attachment for the enclosure. The clip slides into the base and is designed such that other wearable modalities are possible (arm band attachment, etc).

Schematics

PCB Board

PCB made on Eagle that holds the Arduino Micro, audio jack, capacitive breakout board, SD card breakout board, and external battery charger.

Audio Schematic

Wiring for the audio breakout and audio jack, connected to Arduino Uno.

Capacitive Sensor Schematics

Wiring diagram for Adafruit MPR121 12 key capacitive touch sensor breakout

Code

Untitled file

Plain text
No preview (download only).

Habitatt_code

C/C++
Code for the Arduino Micro that detects touch and triggers the audio file.
//AUDIO HEADER
#include <WTV20SDBreakout.h>

//MPR121 HEADERS
#include <Wire.h>
#include "Adafruit_MPR121.h"

//AUDIO PIN SETUP
int resetPin = 4;  // The pin number of the reset pin.
int clockPin = 5;  // The pin number of the clock pin.
int dataPin = 6;  // The pin number of the data pin.
int busyPin = 7;  // The pin number of the busy pin.

WTV20SDBreakout wtv020sd16p(resetPin,clockPin,dataPin,busyPin);

//MPR121 SETUP
// You can have up to 4 on one i2c bus but one is enough for testing!
Adafruit_MPR121 cap = Adafruit_MPR121();

// Keeps track of the last pins touched
// so we know when buttons are 'released'
uint16_t lasttouched = 0;
uint16_t currtouched = 0;

void mpr121setup() {
  while (!Serial);        // needed to keep leonardo/micro from starting too fast!

  Serial.begin(9600);
  Serial.println("Adafruit MPR121 Capacitive Touch sensor test"); 
  
  // Default address is 0x5A, if tied to 3.3V its 0x5B
  // If tied to SDA its 0x5C and if SCL then 0x5D
  if (!cap.begin(0x5A)) {
    Serial.println("MPR121 not found, check wiring?");
    while (1);
  }
  Serial.println("MPR121 found!");
}

void audioSetup() {
    //Initializes the module.
  Serial.begin(9600);
  wtv020sd16p.reset();
  wtv020sd16p.volume(1);
}

void setup() {
  mpr121setup();
  audioSetup();
}

void loop() {
  // Get the currently touched pads
  currtouched = cap.touched();
  
  for (uint8_t i=0; i<12; i++) {
    // it if *is* touched and *wasnt* touched before, alert!
    if ((currtouched & _BV(i)) && !(lasttouched & _BV(i)) ) {
      Serial.print(i); Serial.println(" touched");
        wtv020sd16p.playVoice(0);
    }
    // if it *was* touched and now *isnt*, alert!
    if (!(currtouched & _BV(i)) && (lasttouched & _BV(i)) ) {
      Serial.print(i); Serial.println(" released");
    }
  }

  // reset our state
  lasttouched = currtouched;

  // comment out this line for detailed data from the sensor!
  return;
  
  // debugging info, what
  Serial.print("\t\t\t\t\t\t\t\t\t\t\t\t\t 0x"); Serial.println(cap.touched(), HEX);
  Serial.print("Filt: ");
  for (uint8_t i=0; i<12; i++) {
    Serial.print(cap.filteredData(i)); Serial.print("\t");
  }
  Serial.println();
  Serial.print("Base: ");
  for (uint8_t i=0; i<12; i++) {
    Serial.print(cap.baselineData(i)); Serial.print("\t");
  }
  Serial.println();
  
  // put a delay so it isn't overwhelming
  delay(100);
}

Credits

cecile basnage

cecile basnage

4 projects • 5 followers
Haley Rowland

Haley Rowland

4 projects • 9 followers
Alison Ong

Alison Ong

3 projects • 3 followers
Shubham Garg

Shubham Garg

6 projects • 9 followers
Ian Shain

Ian Shain

3 projects • 2 followers

Comments