Using FSRs to turn on vibration motorsor

Tonight I was working on putting together some of the pieces for my Android Pet Plant.

To make the plant vibrate, I plan to use the 1″ FSRs around the flower pot which will trigger at least 2 vibration motors. To test this out, I cut open a cardboard Diamond Crystal salt container and stuck a piece of foam in the bottom of the container. Then I poked holes through the foam and through them I shoved some leaves that I got from someone’s fruit and the two motors, which I taped to the leaves with electrical tape.

On the outside of the container, I attached the FSRs with masking tape and then covered them in this fake leather stuff, which I flipped over so the soft part faced out. I wrote Pet Me on them, too. All of that went into the Arduino and, when I switched it on, I got vibration when I “petted” the pot.

motors
motors


The code was fairly simple. I simply reused something I’d written before. I suppose I should change the code from LEDs to motors, but I’m just trying to make it work for now.

int analogFSR = 4; // FSR analog input
int motorpin = 10; // Motor pin
int FSRValue = 1; // Value of the FSR

void setup() {
  // initialize serial communications at 9600 bps:
  Serial.begin(9600);
}

void loop() {
  FSRValue = analogRead(analogFSR); // read the left FSR value
  analogWrite(motorpin, FSRValue/4);
  Serial.println(FSRValue); // print the FSR value back to the

  delay(500); // gives a 10 millisecond delay
}

One thought on “Using FSRs to turn on vibration motorsor”

Leave a Reply

Your email address will not be published. Required fields are marked *