pin count is waaayyy to high!

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Rcayot
 
Posts: 321
Joined: Sat Feb 08, 2020 6:48 pm

pin count is waaayyy to high!

Post by Rcayot »

this isn't necessarily a CP question, but there isn't a PICO forum here.

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)
this has worked in the past. I have a fan speed function:

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)
That appears to determine the fan RPM accurately from the pincounter.count value. The trouble is that the pin counts are about 1000 times high! I am getting 3.5 million counts over 180 seconds. In the past, I had this project on a permanent proto board, soldered in place. Now, I have it on a solderless protoboard so I can re-arrange a few thins as the project continues to grow.

Question:
Can the solderless protoboard with jumper wires be so noisy that the edge counts are bouncy? Something else?

Roger

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: pin count is waaayyy to high!

Post by adafruit_support_mike »

Rcayot wrote: Mon Nov 21, 2022 1:47 pm Can the solderless protoboard with jumper wires be so noisy that the edge counts are bouncy? Something else?
That's certainly possible, and should be fairly easy to detect. Leaving the fan standing still, do you get counts if you move the protoboard or the wiring around?

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”