mikaelnousiainen / RS41ng

Custom firmware for Vaisala RS41 and Graw DFM-17 radiosondes with support for amateur radio use. Ideal for tracking high-altitude balloons. Supported modes include APRS, Horus 4FSK mode, CATS, morse code (CW) and additional digital modes like WSPR and FT8 via Si5351.
GNU General Public License v2.0
109 stars 28 forks source link

Add pulse counter feature to RS41ng #20

Closed ManoDaSilva closed 1 year ago

ManoDaSilva commented 1 year ago

First steps in getting a pulse counter implemented.

Implemented config.h flag, added the pulse management on the telemetry fields and in HorusV2 payloads (last two bytes, see custom payloads here

ManoDaSilva commented 1 year ago

Now working - sorry for the amount of commits! @mikaelnousiainen So far, I don't see any issue with other devices (GPS/Radio), but I'm still going trough everything...

mikaelnousiainen commented 1 year ago

@ManoDaSilva Ok, thanks a lot for your work! I will review it fully tomorrow -- the code will probably need some small reformatting, could you check:

mikaelnousiainen commented 1 year ago

The stm_lib files can be committed as they are -- no need to change them of course :)

ManoDaSilva commented 1 year ago

Okay, I just checked everything, fixed indentation, function names and corrected the grammar error :)

mikaelnousiainen commented 1 year ago

@ManoDaSilva I did some code cleanup and added documentation. Could you please see if the code still works for you? There are new config options for interrupt edge and pull-up/down resistors.

ManoDaSilva commented 1 year ago

I'm out on vacation, I'll test this out ASAP :)

darksidelemm commented 1 year ago

It turns out handling the 'wrapping' of the pulse count in Grafana is a real pain... so if this can be converted to send a counts-per-minute value (i guess some kind of moving average?) that would make life easier :-)

ManoDaSilva commented 1 year ago

@ManoDaSilva I did some code cleanup and added documentation. Could you please see if the code still works for you? There are new config options for interrupt edge and pull-up/down resistors.

Okay, I just gave it a test, no changes, everything seems to be working fine: GPS, batt voltage, counts are increasing and wrapping around at 65535 without issues. Test here: https://tracker.habhub.org/#!mt=roadmap&f=ON4IR

It turns out handling the 'wrapping' of the pulse count in Grafana is a real pain... so if this can be converted to send a counts-per-minute value (i guess some kind of moving average?) that would make life easier :-)

It would require handling timing and indeed, a moving average... Something that we could work on another PR perhaps, while finishing this one?

darksidelemm commented 1 year ago

It might actually be OK now - we've figured out a way to do it. I think getting a full flight of data is the next priority :-)

ManoDaSilva commented 1 year ago

It might actually be OK now - we've figured out a way to do it. I think getting a full flight of data is the next priority :-)

If everything goes well, we should get validated for a test flight on the 25th of September, with a geiger sensor. I hope everything else will hold hardware-wise, next week I'll chuck everything in my freezer (cranked at -30°C) and see if it holds...

mikaelnousiainen commented 1 year ago

Thanks for testing, merging this now -- we can implement rate/average later if needed!

ManoDaSilva commented 1 year ago

It might actually be OK now - we've figured out a way to do it. I think getting a full flight of data is the next priority :-)

We now have a full flight! Everything worked beautifully, and we've got tons of data. Grafana mixed ON4IR and all the "suffix flights" into one continuous up and down flight, but still, it's workable once you select the correct timeframe. https://amateur.sondehub.org/#!mt=Mapnik&mz=12&qm=3d&mc=50.3967,4.4141&f=ON4IR

Thank you @mikaelnousiainen for the amazing firmware and @darksidelemm for the whole horus system! We had 10s of HAMs all around Western Europe help us out for the reception!

darksidelemm commented 1 year ago

Messing around with a grafana dashboard her: https://grafana.v2.sondehub.org/d/X8_22e7Vz/on4ir-radiation-sensor?orgId=1&from=1664105577291&to=1664121181303