![]() |
Forum Index : Microcontroller and PC projects : Help with Raspberry pico MMBasic Tachometer
Author | Message | ||||
vhofst![]() Newbie ![]() Joined: 29/01/2024 Location: ChilePosts: 4 |
Hello everyone !!! Some time ago I have had a small problem, which is not being able to measure rpm. I use a CPU fan as a reference to be able to measure, but the readings always come out at 0. attached the reference image. I set OPTION COUNT gp6,gp7,gp8,gp9 on SETPIN i try PIN,CIN, and FIN. and the code i use the same in page 46 of last MMBASIC manual. ![]() In advance, thank you very much for your help. |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3348 |
Try outputting a PWM signal to a pin connected to pin 3 on your connector. If your count then works, that tells you that there's a problem with the wiring to your actual device. If it doesn't work, there's a problem with your code. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5023 |
Typically, a 3 wire fan has power, ground, and pwm control for fan speed. Fans with a 4 wire connection have a tacho output and pwm. Are you sure your 3 wire fan has tacho out? Note that a tacho output needs a pullup resistor (10k to 3.3v when used with a pico) to work. Volhout Edited 2025-06-28 07:01 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
vhofst![]() Newbie ![]() Joined: 29/01/2024 Location: ChilePosts: 4 |
The green wire of the CPU fan gives the signal to measure RPM, the problem is that not work, this wire have more than 3.3V and Ground(when sense). I used another sensor through an optocoupler, where pin(gp7) has pullup (10k to 3.3V) and the optocoupler connects to ground. This scheme did work. |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2579 |
First check that the Pico is reading frequency correctly, as Lizby suggested. Put a jumper from GP2 to GP7 then enter the following at the command prompt:- > setpin gp2, pwm : pwm 1, 1234, 50 : setpin gp7, fin : Pause 2000 : ? pin(gp7) If the output is 1234 after 2 seconds then that is working. The pause is needed to allow time for the PWM to start and then to count pulses for 1 second.1234 > Remove the jumper. To reduce the 5V signal to 3.3V use a voltage divider. 18kΩ from fan output to GP7 and 33kΩ from GP7 to ground. Then run the fan and try this:- > setpin gp7,fin : do : ? pin(gp7) : Pause 1000 : loop |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |