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:
  • 5 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Introducing OpenPlotter hats!!!
#68
(2018-03-08, 08:21 AM)CVL Wrote: yep, I felt adventurous and tried to do a bit of python-coding on myself. Not that I am expert - if anybody has a better idea how to transform pulses in speed measurement, I am glad to learn:

Code:
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
import os

GPIO.setmode(GPIO.BCM)
GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_UP)

path = "/var/run/nmea.fifo"
os.mkfifo(path)

fifo = open(path, "w")
fifo.write('$VWVHW,,,,,0,00,N,,K\r\n')
fifo.close()

impulse_count = 0
NUM_CYCLES = 10
Counter = 10
while 1:
   start = time.time()
   for impulse_count in range(NUM_CYCLES):
       GPIO.wait_for_edge(24, GPIO.FALLING)
   duration = time.time() - start

   Counter = Counter + 10
   distance = Counter / 54737
   distancer = round(distance,2)
   speed = 15.2047222222 / duration
   speedr = round(speed,2)
   nmea = '$VWVHW,,,,,' + str(speedr) + ',N,,K\r\n$VWVLW,,N,' + str(distancer) + ',N\r\n'

   fifo = open(path, "w")
   fifo.write(str(nmea))
   fifo.close()

   time.sleep(0.5)

GPIO.cleanup()

The code counts 10 pulses and measures the time it takes. The paddlewheel documentation for the VDO says it counts  54737 pulses per 1nm, so this gives a basis for calculating speed in knots.

Then the values are transformed into NMEA-sentences and piped via a FIFO to kplex, which sends the NMEA to the cockpit.
Code:
[file]
name=logge
filename=/var/run/nmea.fifo
direction=in
persist=yes
checksum=no
strict=no

The script is started from rc.local so it runs as root. Security concerns are not so high on a standalone-system

Certainly there are ways to do this in a more elegant fashion... but I am not really a programmer.
Hope it helps though.

fair winds
Christian

Thank you for sharing Christian!  I may give this a go myself.

Much Appreciated!

Geoff
Reply


Messages In This Thread
Introducing OpenPlotter hats!!! - by Sailoog - 2017-11-20, 07:36 PM
RE: Introducing OpenPlotter hats!!! - by PaddyB - 2017-11-20, 07:56 PM
RE: Introducing OpenPlotter hats!!! - by abarrow - 2017-11-20, 11:08 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2017-11-22, 05:44 PM
RE: Introducing OpenPlotter hats!!! - by PaddyB - 2017-11-21, 11:20 AM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2017-11-22, 05:50 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2017-11-22, 05:48 PM
RE: Introducing OpenPlotter hats!!! - by jim321 - 2017-11-22, 09:48 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2017-11-23, 06:29 PM
RE: Introducing OpenPlotter hats!!! - by Luckbert - 2017-11-22, 10:05 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2017-11-23, 06:33 PM
RE: Introducing OpenPlotter hats!!! - by tocan - 2017-11-23, 02:29 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2017-11-23, 06:36 PM
RE: Introducing OpenPlotter hats!!! - by Didier B - 2017-12-13, 07:53 PM
RE: Introducing OpenPlotter hats!!! - by PaddyB - 2017-11-23, 03:26 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2017-11-23, 06:38 PM
RE: Introducing OpenPlotter hats!!! - by tocan - 2017-12-03, 08:08 PM
RE: Introducing OpenPlotter hats!!! - by PaddyB - 2017-12-04, 12:40 AM
RE: Introducing OpenPlotter hats!!! - by tocan - 2017-12-04, 01:03 AM
RE: Introducing OpenPlotter hats!!! - by tocan - 2017-12-04, 01:13 PM
RE: Introducing OpenPlotter hats!!! - by Havnjero - 2017-12-04, 02:54 PM
RE: Introducing OpenPlotter hats!!! - by Havnjero - 2017-12-13, 07:56 PM
Introducing OpenPlotter hats!!! - by uriguri - 2017-12-13, 09:26 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2017-12-28, 07:55 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2017-12-28, 07:45 PM
RE: Introducing OpenPlotter hats!!! - by tocan - 2017-12-28, 08:52 PM
RE: Introducing OpenPlotter hats!!! - by uriguri - 2017-12-28, 11:22 PM
RE: Introducing OpenPlotter hats!!! - by NahanniV - 2018-01-01, 06:27 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-01-08, 06:12 PM
RE: Introducing OpenPlotter hats!!! - by tocan - 2018-01-06, 07:47 PM
RE: Introducing OpenPlotter hats!!! - by ddelorme - 2018-01-07, 01:34 PM
RE: Introducing OpenPlotter hats!!! - by tocan - 2018-01-10, 10:12 AM
RE: Introducing OpenPlotter hats!!! - by tocan - 2018-01-10, 04:40 PM
RE: Introducing OpenPlotter hats!!! - by Saqqara - 2018-01-08, 10:48 PM
RE: Introducing OpenPlotter hats!!! - by ddelorme - 2018-01-09, 01:12 AM
RE: Introducing OpenPlotter hats!!! - by Saqqara - 2018-01-08, 11:47 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-01-09, 07:29 PM
RE: Introducing OpenPlotter hats!!! - by ddelorme - 2018-01-10, 04:24 PM
RE: Introducing OpenPlotter hats!!! - by ddelorme - 2018-01-10, 07:06 PM
RE: Introducing OpenPlotter hats!!! - by pcmm - 2018-01-11, 04:09 AM
RE: Introducing OpenPlotter hats!!! - by abarrow - 2018-01-11, 02:48 PM
RE: Introducing OpenPlotter hats!!! - by pcmm - 2018-01-12, 04:47 AM
RE: Introducing OpenPlotter hats!!! - by abarrow - 2018-01-12, 05:28 AM
RE: Introducing OpenPlotter hats!!! - by jim321 - 2018-01-12, 08:19 PM
RE: Introducing OpenPlotter hats!!! - by pcmm - 2018-01-13, 08:02 PM
RE: Introducing OpenPlotter hats!!! - by Didier B - 2018-01-16, 08:21 AM
RE: Introducing OpenPlotter hats!!! - by Rooney - 2018-01-19, 03:06 PM
RE: Introducing OpenPlotter hats!!! - by Ze'K - 2018-01-29, 06:07 PM
RE: Introducing OpenPlotter hats!!! - by sapers - 2018-02-08, 11:00 AM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-02-23, 06:31 PM
RE: Introducing OpenPlotter hats!!! - by jim321 - 2018-02-25, 11:24 AM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-02-25, 01:07 PM
RE: Introducing OpenPlotter hats!!! - by Ze'K - 2018-03-01, 04:15 AM
RE: Introducing OpenPlotter hats!!! - by CVL - 2018-03-05, 03:55 PM
RE: Introducing OpenPlotter hats!!! - by Rooney - 2018-03-05, 06:26 PM
RE: Introducing OpenPlotter hats!!! - by CVL - 2018-03-08, 08:21 AM
RE: Introducing OpenPlotter hats!!! - by GSAtlantic - 2018-03-08, 08:49 PM
RE: Introducing OpenPlotter hats!!! - by CVL - 2018-03-10, 03:55 PM
RE: Introducing OpenPlotter hats!!! - by Saqqara - 2018-03-09, 07:06 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-03-16, 12:33 PM
RE: Introducing OpenPlotter hats!!! - by mgrouch - 2018-03-26, 04:17 AM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-03-31, 06:40 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-04-02, 04:21 PM
RE: Introducing OpenPlotter hats!!! - by Didier B - 2018-04-03, 10:13 AM
RE: Introducing OpenPlotter hats!!! - by abarrow - 2018-04-03, 02:26 PM
RE: Introducing OpenPlotter hats!!! - by Ze'K - 2018-04-19, 06:27 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-04-24, 05:53 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-05-04, 11:09 AM
RE: Introducing OpenPlotter hats!!! - by pcmm - 2018-05-08, 09:05 PM
RE: Introducing OpenPlotter hats!!! - by abarrow - 2018-05-08, 09:19 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-05-09, 04:48 PM
RE: Introducing OpenPlotter hats!!! - by pcmm - 2018-05-16, 01:57 PM
RE: Introducing OpenPlotter hats!!! - by Rooney - 2018-05-09, 06:09 PM
RE: Introducing OpenPlotter hats!!! - by Saqqara - 2018-05-16, 05:04 PM
RE: Introducing OpenPlotter hats!!! - by Luckbert - 2018-06-08, 07:07 AM
RE: Introducing OpenPlotter hats!!! - by jim321 - 2018-06-08, 12:05 PM
RE: Introducing OpenPlotter hats!!! - by Luckbert - 2018-06-08, 12:09 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-06-08, 05:57 PM
RE: Introducing OpenPlotter hats!!! - by benjic78 - 2018-06-11, 02:38 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-06-11, 05:30 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-06-14, 10:30 AM
Introducing OpenPlotter hats!!! - by uriguri - 2018-06-14, 11:26 AM
RE: Introducing OpenPlotter hats!!! - by rgleason - 2018-06-14, 11:32 AM
RE: Introducing OpenPlotter hats!!! - by Rooney - 2018-06-17, 02:00 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-06-14, 11:56 AM
RE: Introducing OpenPlotter hats!!! - by rgleason - 2018-06-14, 12:19 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-06-15, 10:03 AM
RE: Introducing OpenPlotter hats!!! - by Luckbert - 2018-06-21, 02:39 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-06-21, 03:39 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-06-21, 04:47 PM
RE: Introducing OpenPlotter hats!!! - by Luckbert - 2018-06-21, 04:53 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-06-21, 05:18 PM
RE: Introducing OpenPlotter hats!!! - by Luckbert - 2018-06-21, 05:25 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-06-21, 05:29 PM
RE: Introducing OpenPlotter hats!!! - by Luckbert - 2018-06-24, 10:23 PM
RE: Introducing OpenPlotter hats!!! - by Smartell - 2018-06-30, 05:34 PM
RE: Introducing OpenPlotter hats!!! - by Smartell - 2018-07-01, 10:37 AM
RE: Introducing OpenPlotter hats!!! - by Rooco - 2018-07-01, 02:54 PM
RE: Introducing OpenPlotter hats!!! - by Smartell - 2018-07-01, 05:07 PM
RE: Introducing OpenPlotter hats!!! - by Rooco - 2018-07-01, 06:37 PM
RE: Introducing OpenPlotter hats!!! - by Smartell - 2018-07-01, 07:06 PM
RE: Introducing OpenPlotter hats!!! - by dlorrain - 2018-07-05, 10:11 PM
RE: Introducing OpenPlotter hats!!! - by Rooco - 2018-07-06, 08:29 AM
RE: Introducing OpenPlotter hats!!! - by dlorrain - 2018-07-08, 09:15 PM
RE: Introducing OpenPlotter hats!!! - by dlorrain - 2018-07-09, 08:45 PM
RE: Introducing OpenPlotter hats!!! - by Rooco - 2018-07-09, 09:17 PM
RE: Introducing OpenPlotter hats!!! - by dlorrain - 2018-07-12, 08:46 PM
RE: Introducing OpenPlotter hats!!! - by Rooco - 2018-07-14, 06:47 AM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-07-06, 05:06 PM
RE: Introducing OpenPlotter hats!!! - by Smartell - 2018-07-09, 10:15 PM
RE: Introducing OpenPlotter hats!!! - by Rooco - 2018-07-09, 10:55 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-07-24, 06:16 PM
RE: Introducing OpenPlotter hats!!! - by Ben S - 2018-09-09, 10:50 AM
RE: Introducing OpenPlotter hats!!! - by Rooco - 2018-09-13, 06:25 AM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2018-11-20, 08:49 PM
Introducing OpenPlotter hats!!! - by festeraeb - 2018-11-30, 06:28 AM
RE: Introducing OpenPlotter hats!!! - by abarrow - 2018-11-30, 03:14 PM
RE: Introducing OpenPlotter hats!!! - by CVL - 2018-11-30, 04:00 PM
RE: Introducing OpenPlotter hats!!! - by zankiki - 2019-08-03, 08:12 AM
RE: Introducing OpenPlotter hats!!! - by BigDee - 2019-08-04, 07:55 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2019-08-05, 11:44 AM
RE: Introducing OpenPlotter hats!!! - by zankiki - 2019-10-01, 10:18 AM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2019-10-01, 03:34 PM
RE: Introducing OpenPlotter hats!!! - by zankiki - 2019-12-27, 10:16 AM
RE: Introducing OpenPlotter hats!!! - by tjmack - 2020-04-24, 12:08 AM
RE: Introducing OpenPlotter hats!!! - by mgrouch - 2020-04-24, 03:44 PM
RE: Introducing OpenPlotter hats!!! - by Sailoog - 2020-04-24, 12:23 PM
RE: Introducing OpenPlotter hats!!! - by tjmack - 2020-04-24, 05:14 PM
RE: Introducing OpenPlotter hats!!! - by Max1947 - 2020-04-25, 01:03 PM

Forum Jump:


Users browsing this thread: 8 Guest(s)