Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:57 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Help with Raspberry pico MMBasic Tachometer

     Page 1 of 2    
Author Message
vhofst

Newbie

Joined: 29/01/2024
Location: Chile
Posts: 8
Posted: 08:36pm 27 Jun 2025
Copy link to clipboard 
Print this post

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 States
Posts: 3378
Posted: 08:45pm 27 Jun 2025
Copy link to clipboard 
Print this post

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: Netherlands
Posts: 5089
Posted: 08:56pm 27 Jun 2025
Copy link to clipboard 
Print this post

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: Chile
Posts: 8
Posted: 01:18am 01 Jul 2025
Copy link to clipboard 
Print this post

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: Australia
Posts: 2640
Posted: 02:24am 01 Jul 2025
Copy link to clipboard 
Print this post

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)
 1234
>
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.
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
 
vhofst

Newbie

Joined: 29/01/2024
Location: Chile
Posts: 8
Posted: 02:52am 16 Jul 2025
Copy link to clipboard 
Print this post

Hello everyone,

I really appreciate the help you've given me.

I finally found the problem. The issue was that I have different RBPico boards; black, green, purple, and the small ones (nano). Only the green one worked with FIN and CIN, obviously using the 10k pull-up resistor you suggested.

I tested the purple boards on GP7 with a switch, and they can be read (with and without the pull-up), and it works, but not with FIN. I also tested them with DOUT, and they work as well, so now I'm left wondering what makes the green board different, since both use the same RBPico2040 and firmware version 6.

Once again, thank you for the references you provided.

My best regards.
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5089
Posted: 05:38am 16 Jul 2025
Copy link to clipboard 
Print this post

Check OPTION LIST
Doe any of these boards have the text PICO OFF

If one Has pico off, them you could need OPTION COUNT GP6

Pico has many OPTION preset, unless It thinks It is a non genuine board, and that shows with pico off.
To allow counting, a set of 4 pins must be assigned. Default that is gp6/7/8/9

Volhout
Edited 2025-07-16 15:39 by Volhout
PicomiteVGA PETSCII ROBOTS
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2640
Posted: 08:10am 16 Jul 2025
Copy link to clipboard 
Print this post

Tested a 16MB Purple RP2040 module that has OPTION PICO OFF and the default COUNT pins still apply.
> setpin gp7, fin  'link GP7 to GP0
> setpin gp0, pwm
> pwm 0, 1234, 50 'wait 1 second
> ? pin(gp7)
1234
> pwm 0, 5678, 50 'wait 1 second
> ? pin(gp7)
5678
>
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5089
Posted: 08:39am 16 Jul 2025
Copy link to clipboard 
Print this post

hi vhofst,

So many different boards, blue, purple, green, black, nano.

As far as I know the green one is (in most cases) a RP compatible pico. There are many chineese copies, but up to now most of them adhere to the RP standard. For PicoMite these are the easiest boards to use. They should not need any fixes.

We have looked at the purple board once, and (at that time) the purple had a different pinout (I remember that it did not reserve GP23/24/25/29 for special functions as the genuine boards do).

The black and blue are in most cases versions with added functionality (i.e. a lipo charger added, PSRAM added, etc..) but you need to analyze the schematics to see if they are compatible.

I did not look at the nano, but have used the pico zero. And the zero does have a frequency counting option on GP7 (just tested it).

Volhout
PicomiteVGA PETSCII ROBOTS
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2640
Posted: 08:46am 16 Jul 2025
Copy link to clipboard 
Print this post

  Quote  We have looked at the purple board once, and (at that time) the purple had a different pinout
Yes, this is one of those. It has all the GPIO pins brought out so OPTION PICO OFF allows normal access to the extra pins, including an analogue one.
 
vhofst

Newbie

Joined: 29/01/2024
Location: Chile
Posts: 8
Posted: 01:57am 21 Jul 2025
Copy link to clipboard 
Print this post

Hi!

A few days ago, I received a Raspberry Pi Pico W from AliExpress, but the WebMite firmware didn’t work because the Wi-Fi chip is an ESP8285.

I’ll have to use it as a regular Micromite, either via USB or VGA Firmware.

From now, I’ll need to be very careful when choosing a Raspberry Pi Pico to use with WebMite.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 08:23am 21 Jul 2025
Copy link to clipboard 
Print this post

Usually you can follow this for the Chinese clones:

"Green" - usually ok if from the same supplier ass "purple" and "black type C"

"Pico W" - not OK unless it is a lot more expensive than the clone version! As you've discovered the Chinese version is incompatible with the real Pico W.

"Purple" - NOT pin compatible, it's completely different. Personally I'd avoid it unless it's going to be soldered in place and therefore unlikely to get swapped accidentally.

"USB 16MB" seems to be the same as the YD-RP2040 and "Black type C". This is a good board but the power supply pins are different and the AVREF and 5VEN pins have different purposes so not strictly pin compatible. Slower than the Pico RP2040 but in some ways I prefer it to the original Pico.

"USB 4MB" - very similar to the above, but I seem to remember that it's faster.

RP2040-Zero - an excellent cut-down Pico RP2040. Obviously not pin compatible but I've found it to be very usable.

Note that none of the above Chinese clones are as good as the Raspberry Pi modules if you want battery operation as they all use linear regulators instead of a high efficiency switcher.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 1383
Posted: 09:30am 21 Jul 2025
Copy link to clipboard 
Print this post

  Mixtel90 said  
"USB 16MB" seems to be the same as the YD-RP2040 and "Black type C". This is a good board but the power supply pins are different and the AVREF and 5VEN pins have different purposes so not strictly pin compatible. Slower than the Pico RP2040 but in some ways I prefer it to the original Pico.


Hi Mick,

I think we covered this previously; didn't you figure that you had an older one or something because I have at least ten of these and they all run happily @378MHz.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 11:12am 21 Jul 2025
Copy link to clipboard 
Print this post

I know that at one point the 16MB was definitely slower than the 4MB. That may not be the case now, things move on.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
vhofst

Newbie

Joined: 29/01/2024
Location: Chile
Posts: 8
Posted: 11:26pm 21 Jul 2025
Copy link to clipboard 
Print this post

One of the things that fascinated me about the Raspberry Pi Pico is the possibility of using MicroMite Basic, for the simple reason that before I used to think "how to do it", now I think "what to do". I enjoy programming in Basic, and MicroMite on the Raspberry Pico gives you the ability to do great things easily. I use also the esp8266 with espbasic, its great.

Unfortunately, the different versions of Raspberry Pico boards are not all the same in terms of functionality, and problems arise like the one I mentioned in this forum. But even so, quite a lot can be done without major issues.

Is there a channel to share experiences and information about the different boards with those developing MicroMite Basic? (For example, about the Pico W with ESP8285 chip.)

By the way, the RP2040-Zero is a very good format, but it happens to lack all the necessary pins to use PicoMite VGA. Is it possible to reassign them?

My best regards.
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2640
Posted: 02:01am 22 Jul 2025
Copy link to clipboard 
Print this post

  Manual said  OPTION VGA PINS HSYNCpin, BLUEpin
  VGA VERSION ONLY
Changes the pins used for VGA display output allowing more flexibility in PCB design or wiring.
“HSYNCpin” defines the start of a pair of contiguous GP numbered pins that are connected to HSYNC and VSYNC
“BLUEpin” defines the start of four contiguous GP numbered pins that are connected to BLUE, GREEN_LSB, GREEN_MSB, and RED
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5089
Posted: 06:01am 22 Jul 2025
Copy link to clipboard 
Print this post

This only works with the VGA version of the firmware.
And that version uses gp8 and gp9 for ps2 keyboard. Make sure these are not causing conflict.

Volhout
Edited 2025-07-22 16:04 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 06:50am 22 Jul 2025
Copy link to clipboard 
Print this post

I've not tried it, Volhout, but doesn't OPTION KEYBOARD PINS work in the VGA firmware?
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2640
Posted: 07:20am 22 Jul 2025
Copy link to clipboard 
Print this post

  Manual said  OPTION KEYBOARD PINS clockpin, datapin
Allows the user to select the pins to be used for connecting a PS2 keyboard.
The default is pin 11 (GP8) and pin 12 (GP9).
The PS2 keyboard must first be disabled (OPTION KEYBOARD DISABLE)
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5089
Posted: 08:19am 22 Jul 2025
Copy link to clipboard 
Print this post

Mick,

Correct. Should work. Problem is that the defaults for VGA and PS2 could conflict right after installing the firmware , until the moment they are repositioned.

Noted, VGA starts sending VGA on GP17...21, and that could cause problems when these pins are attached to other chips or sd card. Better not put a sd card in until the pins are correctly configured.

PS2 is most likely not that much of a problem.

Volhout
PicomiteVGA PETSCII ROBOTS
 
     Page 1 of 2    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025