LilyPad Vibe Board Hookup Guide a learn.sparkfun.com tutorial

Available online at: http://sfe.io/t667

Contents

Introduction

The LilyPad Vibe Board is a small vibration motor that can be sewn into projects with conductive thread and controlled by a LilyPad Arduino. The board can be used as a physical indicator on clothing and costumes for haptic feedback.

LilyPad Vibe Board

LilyPad Vibe Board

DEV-11008
$8.50
2

Required Materials

To follow along with this tutorial, you will need the following materials. You may not need everything though depending on what you have. Add it to your cart, read through the guide, and adjust the cart as necessary.

Suggested Reading

If you aren’t familiar with the following concepts, we recommend checking out these tutorials before continuing.

What is an Arduino?

What is this 'Arduino' thing anyway? This tutorials dives into what an Arduino is and along with Arduino projects and widgets.

LilyPad Basics: E-Sewing

Learn how to use conductive thread with LilyPad components.

LilyPad ProtoSnap Plus Hookup Guide

The LilyPad ProtoSnap Plus is a sewable electronics prototyping board that you can use to learn circuits and programming with Arduino, then break apart to make an interactive fabric or wearable project.

Getting Started with LilyPad

An introduction to the LilyPad ecosystem - a set of sewable electronic pieces designed to help you build soft, sewable, interactive e-textile projects.

Attaching to a LilyPad Arduino

The LilyPad Vibe Board has two sew tabs: Power (+) and Ground (--). Next to each tab is a white label for reference. For power, you can connect an input voltage anywhere between 3.3V and 5V. The motor can vibrate faster as you provide more voltage. We recommend connecting the (+) tab to a MOSFET to drive the motor when using it with an Arduino due to the amount of current each I/O pin can source . To adjust the intensity, we recommend using a PWM capable sew tab on a LilyPad Arduino.

LilyPad Vibe Board top view

To follow along with the code examples in this tutorial, connect the vibe board and transistor to a LilyPad Arduino as shown in the images below. Use alligator clips to temporarily connect the circuit. Connect the LilyPad's "+" sew tab to the "+" sew tab of the vibe board. Make another connection between the "--" sew tab and the MOSFET power controller's "--" sew tab. Keep in mind that the "--" label on the MOSFET power controller does not represent ground (GND or "--"). Ground is represented as "IN--". The "IN--" should be connected to a LilyPad Arduino's "--" sew tab.

To control the vibe board, connect a PWM pin (pin 10 in the following cases) to the "IN+". When testing the example for button feedback, simply connect A4 to the LilyPad Arduino's "--" ground sew tab. After you are finished prototyping, replace the alligator clips with conductive thread traces for permanent connection in your project.

LilyPad Arduino USB with N-Channel MOSFET Power Controller and Vibe Motor

Connecting to a LilyPad Arduino USB (Click image to enlarge).

LilyPad Protosnap Plus with N-Channel MOSFET Power Controller and Vibe Motor

Connecting to a LilyPad ProtoSnap Plus (Click image to enlarge).

Using a Button to Trigger Feedback

Note: This example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE. If you have not previously installed an Arduino library, please check out our installation guide.

Copy the code below and paste it into your Arduino IDE. Select your board (i.e. LilyPad Arduino USB for the LilyPad USB, LilyPad USB Plus for the LilyPad USB Plus, etc.) and COM port. Finally, click the upload button to upload the demo on your Arduino.

language:c
/*
  LilyPad Vibe Board: Button Feedback
  Written by: Ho Yun "Bobby" Chan
  @ SparkFun Electronics
  Date: 1/14/2019
  https://www.sparkfun.com/products/11008

  The main code checks for a button press. If there is a button press,
  the Arduino turns on the LilyPad Vibe Board for haptic feedback.
  For a visual cue, the LED will turn on too. If not, the LED and
  motor will remain off.
*/

const int motorPin = 10;     // motor connected to PWM pin 9
const int button1Pin = A4;  // pushbutton 1 pin
const int ledPin =  13;     // LED pin

int button1State;  //check state of button press

void setup() {
  //Serial.begin(9600); //setup serial monitor, uncomment Serial.print()'s to debug
  //Serial.println("Begin LilyPad Vibe Motor Tests");

  pinMode(button1Pin, INPUT_PULLUP);//set internal pull up for button
  pinMode(ledPin, OUTPUT); //visual feedback


  //Quick Test 1: Check If LED and Motor Can Turn On

  //Serial.println("Turn LilyPad Vibe Motor And LED ON");
  //digitalWrite(ledPin, HIGH);  // turn the LED on
  analogWrite(motorPin, 255);  //turn motor
  delay(300);

  //Serial.println("Turn LilyPad Vibe Motor And LED OFF");
  //digitalWrite(ledPin, LOW);  // turn the LED off
  analogWrite(motorPin, 0);   //turn motor off
  delay(300);

  //Quick Test 2: Check Intensity of Motor (turns on at about 130
  // fade in from min to max in increments of 5 points:
  for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 5) {
    // sets the value (range from 0 to 255):
    analogWrite(motorPin, fadeValue);
    //Serial.print("LilyPad Vibe Motor Intensity = ");
    //Serial.println(fadeValue);

    // wait for 100 milliseconds to see motor
    delay(100);
  }
  // fade out from max to min in increments of 5 points:
  for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -= 5) {
    // sets the value (range from 0 to 255):
    analogWrite(motorPin, fadeValue);
    //Serial.print("LilyPad Vibe Motor Intensity = ");
    //Serial.println(fadeValue);

    // wait for 100 milliseconds to see motor
    delay(100);
  }

}

void loop() {
  // Here we'll read the current pushbutton states into
  // a variable:

  // Remember that if the button is being pressed, it will be
  // connected to GND. If the button is not being pressed,
  // the pullup resistor will connect it to Vcc.

  // So the state will be LOW when it is being pressed,
  // and HIGH when it is not being pressed.

  // Now we'll use those states to control the LED.
  // Here's what we want to do:

  button1State = digitalRead(button1Pin);

  if (button1State == LOW)  // if we're pushing button 1
  {
    //Serial.println("Button has been pressed, turn LilyPad Vibe Motor And LED ON");
    digitalWrite(ledPin, HIGH);  // turn the LED on
    analogWrite(motorPin, 255);  //turn motor on
    delay(300);                  //slight delay for feedback
  }
  else
  {
    digitalWrite(ledPin, LOW);  // turn the LED
    analogWrite(motorPin, 0);   //turn motor off
    delay(300);
  }
}

After uploading, you should see the built-in LED on the LilyPad Arduino and the vibe motor turn on and off. The LilyPad Arduino will then slowly increase and decrease in intensity. The vibe motor will turn on when the Arduino's PWM output is around 130. Once we start looping in the loop() function, the LilyPad Arduino will check to see if there is a button press. If the button is pressed (i.e. or when A4 is connected to ground), the built-in LED and vibe motor will turn on. There is a slightly longer delay after this happens so there is enough time to detect when the motor is turned on as feedback. If there is no button press, both will remain off.

Sewing Into a Project

Once you are finished prototyping your project using the LilyPad Vibe Board, you can replace any temporary connections with conductive thread. For an overview of sewing with conductive thread, check out this guide:

LilyPad Basics: E-Sewing

December 17, 2016

Learn how to use conductive thread with LilyPad components.

You can also make your own button by using metal snaps or any conductive material.

LDK Experiment 5: Make Your Own Switch

October 2, 2013

Learn to create and integrate your own handmade switch into an e-textile circuit.

Making Your Project Portable with Batteries

As you start embedding your circuit into your project, we recommend connecting a LiPo battery to the LilyPad's JST connector to regulate the voltage. There are also LiPo charge IC's built into LilyPad Arduinos to recharge the LiPo batteries so that it does not have to be removed from the circuit.

LilyPad Arduino USB, MOSFET Power Controller, and Vibe Board with LiPo Battery LilyPad Protosnap Plus: MOSFET Power Controller, and Vibe Board with LiPo Battery
Circuits with LiPo batteries for remote power. Click on images for a closer view.

For more information about using LiPo batteries with LilyPad, check out the tutorial for Powering Your Project.

LilyPad Basics: Powering Your Project

September 24, 2018

Learn the options for powering your LilyPad projects, LiPo battery safety and care, and how to calculate and consider power constraints on your projects.

Project Examples

Thermal Alert Project

By adding a temperature sensor to the circuit, you can trigger the motor whenever it gets too hot. For more information, check out the thermal alert project from the Lilypad Development Board Activity Guide. Just make sure to redefine the LilyPad Arduino's pins in code.

Thermal Alert Project from the LilyPad Development Board Actibity Guide

Highlighted components used for the thermal alert project. Click on the image for more information.

LilyPad Simblee Fitness Bracer

This fitness bracer uses two vibe boards to alert the wearer when they have been inactive for 60 minutes.

Demo video of the Bluetooth Fitness Bracer project.

Slouch Alert Shirt by Lara Grant

This posture-sensing wearable is built with a LilyPad, conductive fabric, and vibe board provides feedback when your shoulders hunch forward. Learn how to build this project and more wearables with LilyPad in the Instructables Wearable Electronics class.

Slouch Alert Shirt GIF

GIF of finished Slouch Alert shirt project courtesy of Wearable Electronics Class.

Bats Have Feelings Too by Lynne Bruning

Lynne created a jacket that uses an LV-MaxSonar ultrasonic range finder, LilyPad Arduino, and vibe board to alert the wearer to solid objects in their path.

Model wearing Bats Have Feelings Too - a haptic jacket for the blind

"Bats have feelings too" coat, a haptic coat for the blind. Photo by Carl Snider.

Bristlebots

The LilyPad Vibe Motor is not limited to just haptic feedback. You can also build a neat little bristle bot with the vibe motor, battery holder, and coin cell. You can even add a light sensor and MOSFET to have the robot react to your environment!

SparkFun Live 3/24/15 - Build Your Own Bristlebot!

March 18, 2015

Build Your Own Bristlebot on today's SparkFun Live!

March 24, 2015

Resources and Going Further

Here are some resources for e-textiles and planning a project with the LilyPad Vibe board.

Or, you can check out some of our other wearables tutorials:

Heating Pad Hand Warmer Blanket

DIY Project Idea: Create a custom hand warmer blanket using heating pads.

21st Century Fashion Kit: Inflation

Learn how to use a blower and thin sheet plastic to create designs that change shape and volume!

Sound Reactive EL Wire Costume

Learn how to make your EL wire costumes sound reactive in this project tutorial.

LilyPad Basics: E-Sewing

Learn how to use conductive thread with LilyPad components.

Looking for more information about haptic motors and wearable project ideas? Check out the following tutorials.

Insulation Techniques for e-Textiles

Learn a few different ways to protect your conductive thread and LilyPad components in your next wearables project.

Planning a Wearable Electronics Project

Tips and tricks for brainstorming and creating a wearables project.

Haptic Motor Driver Hook-Up Guide

Good vibes only. Getting started with the Haptic Motor Driver.

Or check out some of the following projects for more tutorials and ideas.


learn.sparkfun.com | CC BY-SA 3.0 | SparkFun Electronics | Niwot, Colorado