Five FSRs on one breadboard help
Moderators: adafruit_support_bill, adafruit

Five FSRs on one breadboard help

by shessj on Thu Sep 26, 2013 1:29 am

I would like to use five force sensor resistors on one bread board. Each FSR has one LED that, when the FSR is pressed, lights up. Please help me with the wiring. I am able to do one FSR and one LED on the breadboard so far using the directions from the "Experimenter's Guide for Arduino." How do I add on the other four?

I would appreciate any help!!
Thank you,
Michaela
shessj
 
Posts: 18
Joined: Sat Sep 21, 2013 7:24 pm

Re: Five FSRs on one breadboard help

by adafruit_support_bill on Thu Sep 26, 2013 5:28 am

The wiring for the other 4 should be the same as for the first - except that you connect the signal wire to A1, A2, A3 etc.

Coding also will be the same except that your analogRead() calls will specify different analog pins for the extra sensors.
User avatar
adafruit_support_bill
 
Posts: 31070
Joined: Sat Feb 07, 2009 10:11 am

Re: Five FSRs on one breadboard help

by shessj on Thu Sep 26, 2013 9:20 am

So I tried to match the wiring for a second set of FSR and LED. The analog pin is 3 and the LED is pin 10. I verified the code and it was okay. However, when I pressed the FSR, the LED did not light up. I'm not sure where my wiring went wrong. I attached an image of my wiring. Can anyone tell me where I went wrong?

photo.JPG
photo.JPG (133.92 KiB) Viewed 211 times
shessj
 
Posts: 18
Joined: Sat Sep 21, 2013 7:24 pm

Re: Five FSRs on one breadboard help

by adafruit_support_rick on Thu Sep 26, 2013 10:03 am

Hard to say. The problem could be in your code. can you post it?

adafruit_support_rick
 
Posts: 13096
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Five FSRs on one breadboard help

by adafruit_support_bill on Thu Sep 26, 2013 10:08 am

Also post an overall photo showing your connections to the Arduino.
User avatar
adafruit_support_bill
 
Posts: 31070
Joined: Sat Feb 07, 2009 10:11 am

Re: Five FSRs on one breadboard help

by shessj on Thu Sep 26, 2013 11:36 pm

I got the second LED to light up when I pressed the FSR. Then I attached a third LED and FSR. Now I can't figure out how to get the third LED to light up when I put pressure on the on the third FSR. My goal is to get five FSRs and five LEDs on one breadboard. I played with different combinations and I am not sure what I am doing wrong. Thank you so much for your replies. I appreciate the help!


photo 3.JPG
photo 3.JPG (143.69 KiB) Viewed 182 times

photo 2.JPG
photo 2.JPG (149.69 KiB) Viewed 182 times

photo 1.JPG
photo 1.JPG (158.6 KiB) Viewed 182 times
shessj
 
Posts: 18
Joined: Sat Sep 21, 2013 7:24 pm

Re: Five FSRs on one breadboard help

by pburgess on Fri Sep 27, 2013 1:49 am

On your long breadboard, see the gap in the red and blue stripes near row #30? That indicates it has split power rails...it's not contiguous down the entire breadboard. Put a couple wire jumpers across those connections and you might find this fixes things on the second half of the board.
User avatar
pburgess
 
Posts: 2703
Joined: Sun Oct 26, 2008 2:29 am

Re: Five FSRs on one breadboard help

by shessj on Fri Sep 27, 2013 9:39 am

Thank you, pburgess!!! That was the problem.

Next item!

Pasted below is the code I am using. How do I change the code so that I can use all four FSRs and LEDs at the same time? Currently I change the analog and the pin to the FSR and LED that I am working on. I want to be able to press three FSRs, for example, and have three of the LEDs light up.

Thank you, thank you!
(I have both the screen shoot and pasted the code I am using)

Code: Select all | TOGGLE FULL SIZE
/*
 * Force Sensitive Resistor Test Code
 *
 * The intensity of the LED will vary with the amount of pressure on the sensor
 */

int sensePin = 1;    // the pin the FSR is attached to
int ledPin = 6;     // the pin the LED is attached to (use one capable of PWM)

void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);  // declare the ledPin as an OUTPUT
}

void loop() {
  int value = analogRead(sensePin) / 4; //the voltage on the pin divded by 4 (to scale from 10 bits (0-1024) to 8 (0-255)
  analogWrite(ledPin, value);        //sets the LEDs intensity proportional to the pressure on the sensor
  Serial.println(value);              //print the value to the debug window
}

Screen Shot 2013-09-27 at 6.37.24 AM.png
Screen Shot 2013-09-27 at 6.37.24 AM.png (38 KiB) Viewed 160 times
Last edited by adafruit_support_rick on Fri Sep 27, 2013 9:45 am, edited 1 time in total.
Reason: please use [code][/code] tags when posting code
shessj
 
Posts: 18
Joined: Sat Sep 21, 2013 7:24 pm

Re: Five FSRs on one breadboard help

by adafruit_support_rick on Fri Sep 27, 2013 9:51 am

Just duplicate the code you already have, just as you duplicated the FSRs and LEDs:
Code: Select all | TOGGLE FULL SIZE
int sensePin_1 = 1;    // the pin FSR 1 is attached to
int ledPin_1 = 6;     // the pin the LED 1 is attached to (use one capable of PWM)

int sensePin_2 = 2;    // the pin FSR 2 is attached to
int ledPin_2 = 7;     // the pin the LED 2 is attached to (use one capable of PWM)

int sensePin_3 = 3;    // the pin FSR 3 is attached to
int ledPin_3 = 8;     // the pin the LED 3 is attached to (use one capable of PWM)

..etc...

Code: Select all | TOGGLE FULL SIZE
void setup() {
  Serial.begin(9600);
  pinMode(ledPin_1, OUTPUT);  // declare the ledPin as an OUTPUT
  pinMode(ledPin_2, OUTPUT);  // declare the ledPin as an OUTPUT
  pinMode(ledPin_3, OUTPUT);  // declare the ledPin as an OUTPUT

…etc...
}


Code: Select all | TOGGLE FULL SIZE
void loop() {
  int value = analogRead(sensePin_1) / 4; //the voltage on the pin divded by 4 (to scale from 10 bits (0-1024) to 8 (0-255)
  analogWrite(ledPin_1, value);        //sets the LEDs intensity proportional to the pressure on the sensor
  Serial.println(value);              //print the value to the debug window

  value = analogRead(sensePin_2) / 4; //the voltage on the pin divded by 4 (to scale from 10 bits (0-1024) to 8 (0-255)
  analogWrite(ledPin_2, value);        //sets the LEDs intensity proportional to the pressure on the sensor
  Serial.println(value);              //print the value to the debug window

  value = analogRead(sensePin_3) / 4; //the voltage on the pin divded by 4 (to scale from 10 bits (0-1024) to 8 (0-255)
  analogWrite(ledPin_3, value);        //sets the LEDs intensity proportional to the pressure on the sensor
  Serial.println(value);              //print the value to the debug window

…etc...
}

adafruit_support_rick
 
Posts: 13096
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Five FSRs on one breadboard help

by shessj on Fri Sep 27, 2013 8:10 pm

You guys are amazing!! Thank you!

So, I am going in baby steps. My next step is to use the other side of the breadboard with FSRs and LEDs. But the ground pins and the 5v are already taken up on the Arduino Uno. How can I use the other side of my breadboard if there is no space on the Arduino to place the extra wires??
shessj
 
Posts: 18
Joined: Sat Sep 21, 2013 7:24 pm

Re: Five FSRs on one breadboard help

by adafruit_support_rick on Fri Sep 27, 2013 8:13 pm

Just jumper a pair of wires from one side to the other.

adafruit_support_rick
 
Posts: 13096
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY