Cannot read value from Round Force Sensor

Hi,



I wanted to read data from Round Force Sensor FSR402. Unfortunately there’s no sample code for Raspberry Pi & GrovePi+. So I used other analog sensor as a reference: Grove Gas Sensor MQ2. At the end of the day I created code like this:
[code]
import grovepi

sensor = 0
grovepi.pinMode(sensor, “INPUT”)
print(“AAA”)
value = grovepi.analogRead(0)
print(“BBB”)
[/code]

The output of this code is:

AAA



Probably analogRead is wating for a data and cannot get them. I plugged sensor into the A0 port. Could you please help me to figure this out?

Hi there~



It is related with GrovePi+ firmware issue. Please follow below instruction to update the firmware. thanks.

[code]pi@dex:~/Dexter/GrovePi/Firmware $ sudo ./firmware_update.sh
Updating the GrovePi firmware

http://www.dexterindustries.com/grovepi
Run this program:
sudo ./firmware_update.sh

=============================
Do you want to update the firmware? [y,n]y
Make sure that GrovePi is connected to Raspberry Pi
Firmware found
Press any key to start firmware update
. . .

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: reading input file “0xFF”
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying …
avrdude: 1 bytes of lfuse verified

avrdude: safemode: Fuses OK

avrdude done. Thank you.

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: reading input file “0xDA”
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xDA:
avrdude: load data hfuse data from input file 0xDA:
avrdude: input file 0xDA contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying …
avrdude: 1 bytes of hfuse verified

avrdude: safemode: Fuses OK

avrdude done. Thank you.

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: reading input file “0x05”
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0x05:
avrdude: load data efuse data from input file 0x05:
avrdude: input file 0x05 contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying …
avrdude: 1 bytes of efuse verified

avrdude: safemode: Fuses OK

avrdude done. Thank you.

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file “grove_pi_firmware.hex”
avrdude: input file grove_pi_firmware.hex auto detected as Intel Hex
avrdude: writing flash (18860 bytes):

Writing | ################################################## | 100% 5.48s

avrdude: 18860 bytes of flash written
avrdude: verifying flash memory against grove_pi_firmware.hex:
avrdude: load data flash data from input file grove_pi_firmware.hex:
avrdude: input file grove_pi_firmware.hex auto detected as Intel Hex
avrdude: input file grove_pi_firmware.hex contains 18860 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 4.73s

avrdude: verifying …
avrdude: 18860 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done. Thank you.

pi@dex:~/Dexter/GrovePi/Firmware $ ccd …/Software/Python/
pi@dex:~/Dexter/GrovePi/Software/Python $ python grove_gas_sensor.py
(‘sensor_value =’, 0, ’ density =’, 0.0)
(‘sensor_value =’, 1, ’ density =’, 0.0)
(‘sensor_value =’, 0, ’ density =’, 0.0)
(‘sensor_value =’, 0, ’ density =’, 0.0)
(‘sensor_value =’, 0, ’ density =’, 0.0)
(‘sensor_value =’, 680, ’ density =’, 0.0)
(‘sensor_value =’, 689, ’ density =’, 0.0)
(‘sensor_value =’, 672, ’ density =’, 0.0)
(‘sensor_value =’, 640, ’ density =’, 0.0)
(‘sensor_value =’, 551, ’ density =’, 0.0)
(‘sensor_value =’, 688, ’ density =’, 0.0)
(‘sensor_value =’, 689, ’ density =’, 0.0)
(‘sensor_value =’, 689, ’ density =’, 0.0)
(‘sensor_value =’, 690, ’ density =’, 0.0)
(‘sensor_value =’, 680, ’ density =’, 0.0)
(‘sensor_value =’, 692, ’ density =’, 0.0)
(‘sensor_value =’, 0, ’ density =’, 0.0)
(‘sensor_value =’, 0, ’ density =’, 0.0)
(‘sensor_value =’, 0, ’ density =’, 0.0)
(‘sensor_value =’, 0, ’ density =’, 0.0)[/code]