Feedback!

Wireless Massage

Views: 4682 Difficulty: 3 Status: Complete
Xbee_massage

XBEE radio modules, force-sensitive resistors, and vibration motors allow you to give massages over radio waves.

These massage gloves allow you to touch people over a distance! They are great for when you can't be in the same room as a loved one but want to be touching them. Now you can! We map five force-sensitive resistors sewn into the fingertips of a glove into five vibration motors embedded in the fingertips of another glove. The sensor readings are transmitted using XBEE radio modules and received by the XBEE module on the glove with motors. The motor corresponding to the finger that was just touched vibrates according to the force that was applied. (Want to learn more about XBEE Modules? Check out our 5V XBEE breakout board tutorial, we use those modules in the massage gloves.)

Massage Gloves Wired

Massage_gloves3
The first prototypes of the massage gloves were wired. It is a good practice whenever you want to use radio to first make your widget work when its wired, then try to make it wireless, otherwise there are just too many things that can go wrong.

Massage Gloves Vibrating

Bzzzzzzzz!

Massage Glove Video

Demoing the massage gloves in SFO airport.

Here is the Arduino code for the two massage gloves. Both gloves run the identical code. Each glove has 4 vibration motors hooked up (through transistors) to 4 PWMc outputs and 4 tactile buttons as digital inputs. When a button is pressed on one glove it triggers the corresponding motor on the other glove. The beauty of using XBEE radio modules (with our 5V XBEE breakout board) is that we can treat the radio link as though it were a regular serial port connection. The heart of the code that passes the data between the two gloves goes like this:
     for(int i = 0; i < motors; i++) {
        if(digitalRead(btn_pins[i]) == HIGH){
          Serial.write(i);
          for(int i = 0; i < 3; i++) digitalWrite(leds[i],HIGH);
        }
     } 
     while (Serial.available()){
        int getData = Serial.read();  //if yes, read it
        motor_vals[getData] = 58;
     }
In this code we first iterate over the four buttons and check if any of them are being pressed. IF one is being pressed then we will send its index number, i, out over the serial port in the line:
 Serial.write(i);
Then we read from the Serial port to see if any data is available from the other glove. If there is data waiting for us (i.e. Serial.available() is true) then we get the data and write a value of 58 to the vibration motor. 58 gives us a nice soft vibration on the motor. If you want a super powerful vibration you can change this number to 255.
Grab the entire code below:
/*  LucidTronix XBEE massage gloves
 *  Buttons Control Vibration motors over a radio link
 *  Pictures, explanation and tutorial at:
 *  http://lucidtronix.com/tutorials/38
 */

  const int motor_pins[] = {5,6,9,10};     
  const int btn_pins[] = {14,15,16,17};      
  const int leds[] = {2,3,4};
  const int motors = 4;
  int motor_vals[] = {0,0,0,0};
  void setup() {
    Serial.begin(9600); //initialize serial
    for(int i = 0; i < motors; i++) pinMode(motor_pins[i], OUTPUT);
    for(int i = 0; i < 3; i++) pinMode(leds[i], OUTPUT);
    for(int i = 0; i < motors; i++) pinMode(btn_pins[i], INPUT);
    for(int i = 0; i < 3; i++){
      digitalWrite(leds[i],HIGH);
      delay(200);
    }
    for(int i = 0; i < 3; i++)digitalWrite(leds[i],LOW);
  }

  void loop() { 
     for(int i = 0; i < motors; i++) {
        analogWrite(motor_pins[i], motor_vals[i]);
     }
     for(int i = 0; i < motors; i++) motor_vals[i] = 0;
     for(int i = 0; i < 3; i++) digitalWrite(leds[i],LOW);
     for(int i = 0; i < motors; i++) {
        if(digitalRead(btn_pins[i]) == HIGH){
          Serial.write(i);
          for(int i = 0; i < 3; i++) digitalWrite(leds[i],HIGH);
        }
     } 
     while (Serial.available()){
        int getData = Serial.read();  //if yes, read it
        motor_vals[getData] = 58;
     }
     delay(20);       
  }

Parts

Title Description # Cost Link Picture
Vibration Motor Cute little vibration motor. 2-3.6V operating range Value: 2-3.6V 1 $4.95 Link Vibrationmotor-01-l
ATMEGA168A-AU IC MCU AVR 16K FLASH 32TQFP Value: 1.8 V ~ 5.5 V 20MHz 1 $2.43 Link Screen_shot_2012-12-28_at_7.31.53_pm
Crystal CRYSTAL 16.00000 MHZ 20PF SMD Value: 16MHz 1 $0.53 Link Ecs-270-20-3x-en-tr
Voltage Regulator 3v3 SMD IC REG LDO 3.3V .15A SOT23 Up to 6V input output 3.3V 150mA (Max) Value: 3.3V 1 $0.46 Link Sot-23-3_pkg
Transistor Darlington BJT NPN 30V SOT23-3 Value: NPN 1 $0.24 Link Sot-23-3_pkg
Resistor Array RES ARRAY 10K OHM 4 RES 1206 Value: 10k 1 $0.12 Link Vishay_-_cra06s-8
Resistor Array RES ARRAY 300 OHM 4 RES 1206 Value: 300 1 $0.02 Link Vishay_-_cra06s-8
Permalink: http://lucidtronix.com/tutorials/38
Control the Heart Matrix LED display wirelessly, using XBEE radio modules....
Wearable digital compass displays the direction in green LEDs....
Use the Wearable Wayfinder and the MCP79410 Real time clock chip to make an Arduino alarm clock....
Rainbow flower necklace using the TLC5940....
Two LED matrices give 70 LEDs to light up a necklace with messages....
Handheld gaming machine, based on the Arduino Leonardo, equipped with joystick, SD card and more....
Connecting the MCP79410 real-time clock chip and our Heart Matrix you can show the time with love....
Combine an electret microphone, Arduino and a heart matrix for a sound-sensitive wearable device....