This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RPM via GPIO pulses
#1
Hi,

I have rigged up a npn proximity switch and are using the "pulses" setup in OP.

I have glued two magnets to the flywheel for the pick up and played around with the measuring rate both in the "pulses" settings and in KIP, however the RPMs are bouncing quite a lot. I suspect that it misses one of the magnets periodically but before i glue more on or remove one, I would like to know if anybody has this running reliable and stable ?
Reply
#2
In the new version of KIP, there is a sampling option on the path menu. Try upping this and it might smooth the data out. I went about this a different way and use an ESP but I do the same thing in the esp code.

Interested in your results on this as I want to do something with pulse on the Pi.
Reply
#3
When increasing the sampling period the reading got smoother but it still lost half the counts every 10 seconds or so. Also tried to adjust the "rate" in OP GPIO pulses but that did not seem to change anything...not sure what its for actually??

Ended up removing one of the magnets from the flywheel and now have a stable reading:-)
Reply
#4
Most of the NPN proximity switches operate at plus 6V which is way to high for a RasPi or esp32. I made a solution a long time ago using any input with a pullup resistor (or using the internal one on a '32. Connect a diode to the input that blocks the 12V from hitting the pin. When the NPN activates, the voltage on the sensor line drops to zero, thus pulling the GPIO low. So, your interrupt routine must be set to FALLING_EDGE. Works perfectly. Power your NPN from 12V.
Reply
#5
Is code available for reading these rpm pulses without having OP installed? I do have SignalK running and use KIP intensively. I could do it via SensESP but I have the Raspberry nearby so would like to skip the unneeded WiFi step.
Reply
#6
I was never happy with the rpm pulse code in OpenPlotter v3.x.x. We used a python code from here (search RPM): https://abyz.me.uk/rpi/pigpio/examples.html

pigpio is no longer available in RPi5 so we have to rewrite this code. I am working in openplotter-gpio v4.x.x right now, any example of RPM in python?
Reply
#7
(2024-03-19, 07:34 PM)Sailoog Wrote: I was never happy with the rpm pulse code in OpenPlotter v3.x.x. We used a python code from here (search RPM): https://abyz.me.uk/rpi/pigpio/examples.html

pigpio is no longer available in RPi5 so we have to rewrite this code. I am working in openplotter-gpio v4.x.x right now, any example of RPM in python?

Is it still the case that the pulses do not work in GPIO 4.2.10?? I have connected both to Seatalk (not using Seatalk) data pin and GPIO 20 and the app allows me to select a SK pathway (shown in yellow), but the pathway does not appear in SK.

1 wire works fine

Running OP 4.x.x, and SK 2.16.0 on Rpi 5 with MacArthur Hat

Thanks
Reply
#8
for RPM the CPU has to count every input signal, measure its frequency and sum it up for the result.
at the same time it also has to receive wifi.
both are timecritical.
the wifi has higher priority, so there will be some events on the RPM signal getting lost.

better use an little ESP32 chip to do all the RPM input as an helper device. often little microcontrollers have an internal counter chip integrated. this will do most of the worktask. there are some good libraries to send the data to signalk. i often use SensESP for this stuff.

ym2c  - holger
Reply
#9
Hey Kalinka

as i just found out, your RPM Code also uses Interrupts, so the pi does not need to poll the port.
this task should be possible even if the cpu is really busy. so the python code can work problemless.

you could finetune it with this Constant:

self._watchdog = 200 # Milliseconds.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)