Introduction: An Application of an Extendable Button With Vibration Feedback

In this tutorial, we are first going to show you how to use an Arduino Uno to control a vibration motor via an extended button. Most tutorials on push buttons involve the button on the physical breadboard, whereas in this tutorial, the button has been modified to be connected to the breadboard via jumper cables instead. This button will allow you to control the strength and vibration pattern of the motor. Following that, we will show a possible prototype of a wearable technology making use of this set-up. This wearable is a glove with extendable fingertips with buttons attached to the end, programmed to give unique vibration feedback to the wearer based on the specific button pushed.

Step 1: Components Needed for Button to Vibration Motor Set-Up

Step 2: Schematics for Button to Vibration Motor Set-Up

The preceding diagram was created with Fritzing.org.

Step 3: The Set-Up of Button to Vibration Motor Set-Up

Step 1: Solder the edge connector to the vibration motor driver. Solder the wires of the coin vibrator into the terminals of the vibration motor driver.

Step 2: Connect the 4 pin jumper cable to the button breakout.

Step 3: Using one of the jumper wires, connect the GRD pin on the Arduino to a row on the breadboard.

Step 4: Using another jumper wire, connect the Volt 3.3 pin on the Arduino to a different row on the breadboard.

Step 5: Now we will connect the vibration motor driver to the Arduino. Using a third jumper wire, connect the GND pin on the vibration motor driver to the same row on the breadboard as the GRD pin from the Arduino. Do the same with another wire for VCC (volt) on the vibration motor driver, to the volt row of the breadboard.

Step 6: Use yet another wire to connect the SDA pin on the vibration motor driver to the SDA pin directly on the Arduino. Again, do the same with the SCL pins on both. Alternatively, follow a similar approach to step 5 and connect the SDA and SCL pins on the Arduino to their own rows on the breadboard via jumper wires. Then run a wire from the row where the SDA pin is connected on the breadboard to the SDA pin on the motor driver. Do the same for the SCL row on the breadboard to the SCL pin on the motor driver.

Step 7: Now we will finish up by connecting the button to the vibration motor driver and Arduino. Use another jumper wire to connect the GRD from the 4 pin jumper wire connected to the button breakout to the same row as the other GRD wires on the breadboard. Do the same with volt once again (VCC).

Step 8: Connect a final write from SIG on the button breakout to a pin on the Arduino (for the purposes of our code, we used pin 7).

Step 9: Plug in the Arduino and upload the code, and watch it work!

Step 4: The Code

Button-Vibration-Motor.c

/* Code adapted from https://learn.sparkfun.com/tutorials/haptic-motor-driver-hook-up-guide?_ga=2.227031901.1514248658.1513372975-1149214600.1512613196 */
#include<Sparkfun_DRV2605L.h>//SparkFun Haptic Motor Driver Library
#include<Wire.h>//I2C library
SFE_HMD_DRV2605L HMD; //Create haptic motor driver object
int button = 7; // choose the input pin 7 for pushbutton
int button_val = 0; // variable for reading the pin status
voidsetup()
{
/* Initialize Haptic Motor Driver Object */
HMD.begin();
Serial.begin(9600);
HMD.Mode(0); // Internal trigger input mode -- Must use the GO() function to trigger playback.
HMD.MotorSelect(0x36); // ERM motor, 4x Braking, Medium loop gain, 1.365x back EMF gain
HMD.Library(2); //1-5 & 7 for ERM motors, 6 for LRA motors
}
voidloop()
{
/* Start the vibration motor */
HMD.go();
button_val = digitalRead(button);
if(button_val== HIGH) {
/* This outputs to log that button has been pressed, use for debugginh*/
Serial.println("Button pressed.");
/* The waveform library has 0-122 different types of waves */
HMD.Waveform(0, 69);}
else{
/* If button not pushed then stop the vibration motor */
HMD.stop();
}
}

Step 5: Video of Button to Vibration Motor Set-Up

Step 6: Prototype of Glove Extendable

One possible application of the button to vibration motor is the glove shown above. We have modified cheap accessible materials such as syringes in order to make extendable "fingertips". We attached the grove buttons to the end of the modified syringes using velcro, cut holes in the fingertips of a glove and placed each syringe through the holes. The 4 pin jumper wires of the buttons are threaded through the syringes and are long enough that you can extend the syringes out to their full length. The Arduino and breadboard are attached via velcro to the top of the glove, which allows the wires of the buttons to be easily connected through a small slit on the base of each fingertip. The motor driver is attached to the underside of the glove by the opening, in order to stick the vibration motor to the inside of the glove. When the wearer has the glove on, the vibration motor sits at the underside of wearer's wrist. When the wearer touches a surface and depresses one of the buttons, a unique feedback vibration is given through the motor.

The thought process behind such a glove would be to allow someone wearing it to "touch" things beyond the range of their regular fingertips, and receive feedback that they are touching these surfaces. The vibration feedback changes depending on which finger is touching the surface, so that it is possible for the user to tell which finger is touching the surface based on the vibration pattern.

There are many ways to take the prototype further, such as making the fingers more extendable, or making the feedback change based off of the type of surface being touched. Ideally, extendable fingers would be created via 3D printing, for better telescoping options. A temperature sensor could be used in place of the buttons, to allow for feedback on how hot the surface the user is touching is, or a moisture sensor for similar purposes. A way to sense how far the "finger" has been extended could be implemented, to allow the user to know how far away the object they are touching is. These are only a few possible options for taking this prototype further.

This glove can be made with common materials as an easy way to extend your senses and create feedback that the user can feel and understand.

Step 7: Code for Multiple Buttons With Unique Vibration Output

mutliple_buttons_to_vibmotor.ino

/* Code Adapted from SparkFun https://learn.sparkfun.com/tutorials/haptic-motor-driver-hook-up-guide */
#include<Sparkfun_DRV2605L.h>//SparkFun Haptic Motor Driver Library
#include<Wire.h>//I2C library
SFE_HMD_DRV2605L HMD; //Create haptic motor driver object
int button_middle = 7;
int button_index = 5; // choose the input pin for pushbutton
int button_ring = 9;
int button_pinky = 3;
voidsetup()
{
HMD.begin();
Serial.begin(9600);
HMD.Mode(0); // Internal trigger input mode -- Must use the GO() function to trigger playback.
HMD.MotorSelect(0x36); // ERM motor, 4x Braking, Medium loop gain, 1.365x back EMF gain
HMD.Library(2); //1-5 & 7 for ERM motors, 6 for LRA motors
}
voidloop()
{
HMD.go(); // start the vibration motor
/* Check which button is pushed and output waveform 0-122 */
if(digitalRead(button_middle)== HIGH) {
Serial.println("Button pressed.");
HMD.Waveform(0, 112);}
elseif(digitalRead(button_index) == HIGH){
HMD.Waveform(0,20);
}
elseif(digitalRead(button_ring) == HIGH){
HMD.Waveform(0,80);
}
elseif(digitalRead(button_pinky) == HIGH){
HMD.Waveform(0,100);
}
/* If no button pushed then stop */
else{
HMD.stop();
}
}