I am using pwmio to drive a fan, and pin_counter to read the fan tachometer.
Code: Select all
fan = pwmio.PWMOut(board.GP7, frequency=25000, duty_cycle=0)
pin_counter = countio.Counter(board.GP13, edge=countio.Edge.RISE)
Code: Select all
async def fanspeed(interval):
now = time.monotonic()
while True:
lapsed_time = time.monotonic() - now
print("elapsed time = ", lapsed_time)
if lapsed_time >= fan_speed_time:
fan_count = pin_counter.count
print("count = ", fan_count)
rpm = ((fan_count/2)/(lapsed_time))*60
print("rpm = ", rpm)
F2tag = str(8)
F2packet = (F2tag + str(rpm))
print(F2packet)
pin_counter.reset()
print(pin_counter.count)
now = time.monotonic()
if not rfm9x.send_with_ack(F2packet.encode("utf-8")):
print("No Ack F")
await asyncio.sleep(interval)
Question:
Can the solderless protoboard with jumper wires be so noisy that the edge counts are bouncy? Something else?
Roger