0

1I have connected a square Adafruit Force Sensitive Resistor 406 up to a Raspberry Pi following the instructions given here: Using an FSR with a Raspberry Pi

I have wired everything up exactly as mentioned and used the code linked in the text.[Wiring Config]

However when I run the program the reading from the FSR is either 2047 or 0. It seems to make no difference whether I apply any force to the sensor.

I am wondering if you can give me advice on what could be causing this problem and how to resolve it?

  • Something is wired incorrectly. – joan Jan 29 '17 at 17:55
  • thanks for your comment, I have tried wiring direct to the pins and also via the breadboard but the same result each time. Could it be a possibility that the MCP3008 is faulty? I will need to buy a new analog component to test if this is the case – alkey Jan 29 '17 at 18:16
  • Yes,that is possible. Incorrect wiring is more likely. Have you wired without the cobbler? People connect the ribbon cable the wrong way around. You need to post a photo of your connections. – joan Jan 29 '17 at 18:19
  • I am pretty certain it is all wired up correctly, as I have tried with and without the cobbler. I have attached a picture of my wiring. Under the ribbon cable is a connection from the 3v3 to the live rail. – alkey Jan 29 '17 at 18:54
  • You need to show the actual text of the script you are using. Most people would use the dedicated SPI GPIO rather than bit-bang (the scripts pointed to are ancient in Pi terms). – joan Jan 29 '17 at 20:43
1

The code I copied from the linked pages is redundant. The most simple way of getting a reading using the MCP3008 with the FSR connected as illustrated above is as follows:

from gpiozero import MCP3008
from time import sleep
read = MCP3008(channel=0, device=0)

while True:
    readingVolts = read.value * 1000
    print(readingVolts)
    sleep(2)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.