Hi
I’ve got a Raspberry Pi Zero with a Grove Hat and three sound sensors plugged into the analogue ports. They are working - I get values being reported using the grove_sound_sensor example. However, they never report below 400, even in a quiet room and will often report 999 when there is little more than birdsong in the distance or one will not respond even if there is a loud noise in the immediate vicinity. Putting them linearly at 500mm spacings and making a loud test sound at one end does not always result in them reporting in the correct order, but I suspect this is a consequential error. They are definitely responding to sounds individually though. I am using this cut-down code:
import sys
import math
import datetime
from grove.adc import ADC
adc = ADC()
TH = 999
detected = []
times = []
V0 = 'v0'
V2 = 'v2'
V4 = 'v4'
print('Detecting sound...')
while True:
v0 = adc.read(0)
v2 = adc.read(2)
v4 = adc.read(4)
#if len(detected) > 0:
# print('.', end='')
# sys.stdout.flush()
if v0 >= TH and V0 not in detected:
detected.append(V0)
times.append(datetime.datetime.now().timestamp())
if v2 >= TH and V2 not in detected:
detected.append(V2)
times.append(datetime.datetime.now().timestamp())
if v4 >= TH and V4 not in detected:
detected.append(V4)
times.append(datetime.datetime.now().timestamp())
if len(detected) == 3:
break
print()
print(detected)
print(times)
Am I doing something wrong? Would I be better off switching to Loudness Sensors?
Thanks
Nick