[Solved] Programm Stopping Analog Read

Hello I am trying to run the grove_sound_sensor.py tutorial, but the program doesn’t go past the sensor_value = grovepi.analogRead(sound_sensor). We have put a print statement before and after this line, but it constantly stops at the sensor_value line.

Our setup:
We are using the grovepi+ with the raspberry pi
The sound sensor is connected to A0 and the led is connected to d5. The LED works, but not sure whats happening with the sound sensor.

Hello @player1

This sounds like a potential mismatch between the driver and the firmware.
Did you install the grovepi library recently (within the last 2 months, or so)?

I suspect it’s not running the latest firmware. Are you using Raspbian for Robots? Or plain Raspbian?

Cleo

Hi @cleoqc ,
I am encountering the same problem. I connected the Temperature Sensor v1.2 to the A0-Port of the GrovePi, which is connected to my Raspberry 3(model B+).
I updated the library using the commands:

sudo curl -kL dexterindustries.com/update_grovepi | bash
sudo pip install grovepi
reboot

But when I am running the script:

import time
import grovepi

#Sensor connected to A0 Port 
sensor = 14     # Pin 14 is A0 Port.
grovepi.pinMode(sensor,"INPUT")
while True:
    try:
        print("test1")
        sensor_value = grovepi.analogRead(sensor)
        print("test1")

        print ("sensor_value = %d" %sensor_value)
        time.sleep(.5)

    except IOError:
        print ("Error")

using Thonny Python IDE, the only output I get is ‘test1’.

Do you have a suggestion on what I am doing wrong?

Greetings

Okay so I just looked for all kinds of Updates you can make with the GrovePi and I found this site, describing a firmware update. After running “firmware_update.sh” my Code works now. So maybe @player1 might wanna try out this update too and give us an notification, if this solved his problem.
Greetings

1 Like

Hello @stich-joe

  1. the 1.4 firmware is highly recommended
  2. do not run sudo pip install grovepi as that installs a really old version of the library.

So, for the newest version you just update using sudo curl -kL dexterindustries.com/update_grovepi | bash ?
Thanks for the response!

1 Like