• 2

Question:How similar is the code for the KnowFlow and the RIFFLE data loggers?

gretchengehrke asked on November 13, 2017 17:24
108 | 3 answers | shortlink

I'm curious if the KnowFlow data logger (see #knowflow and #data-logging) and the Riffle (see #riffle) are similar enough to operate using the same code. I know they are both Arduino based, but don't know how much of their respective code could be used on either device. Would the commands be the same, would they be easily adapted for the other device, or are they significantly different? Thanks!

riffle data-logging knowflow

question:riffle question:data-logging question:knowflow


warren 9 days ago

A good question for @rockets and @shanlter too!

Log in to comment

3 Answers

I'm not familiar with the KnowFlow, but I would not expect there to be much overlap in the sketches which are typically used to run the two devices.

The Riffle is designed as a standalone datalogger which operates unattended for days or months. I think the KnowFlow is intended to be used manually to make individual measurements. So the entire structure of the code running the two devices would be quite different.

Each environmental sensor generally requires a specific library of functions, so unless each device had the same sensors attached the code to collect data from sensors would be substantially different.


warren 9 days ago

I'd guess that there could be a lot of commonality in cases where you want to set up the same sensor on either device (or any Arduino). It could be really helpful for each team to clearly mark the sensor-specific code so that it can easily be re-used across!

cfastie 9 days ago

Teams? There are going to be teams? Will they have T-shirts?

I'm still not sure overlapping code is relevant. If you have a working sketch for a KnowFlow and you want to start programming a Riffle, you don't start with the KnowFlow sketch. You find your friend's sketch for the Riffle and change what needs to be changed (hardware libraries, hardware initiations, hardware reads, sampling interval, variable names, pin assignments) depending on how your friend's hardware and goals differ from yours. If your Riffle uses the same sensor or RTC as your KnowFlow, you might be able to borrow a few lines of code.

warren 2 days ago

Hey Chris - yep, the different groups developing these projects; i'd love to design t-shirts!

Modularizing and annotating code can go a very long way to ensuring reusability across platforms. If each team keeps their sensor-specific code clearly separated from the data-logging code, reusability should be possible.

I'm happy to help with this -- some approaches are:

  • use comment lines to mark sensor-specific sections of code: // -------- start conductivity probe code ---------- //
  • group code by purpose, and maintain a consistent API (say, wrap code in a function with named parameters) so that copying it into another file is easier, and you don't have to disentangle board-specific bits, so instead of a series of interleaved statements, you can use a standard function like getConductivityData()
  • you can separate code out into different files, which adds a little complexity in one sense, but helps maintain modularity and makes copying much easier

If we can list the different code examples we're working with here, i'm happy to suggest (and contribute pull requests for!) ways of modularizing!

Log in to comment

I’m still waiting on my Riffle and I’m a rank beginner so this response needs to be accepted with a grain of salt. I believe that what Chris said is right on the point. I have coded both the KnowFlow and the mini-pearl. Beyond the obvious differences for discrete vs streaming sampling and given the same environmental sensor, there is considerable overlap in the code. That’s a fair number of caveats, but coding with one goes a long way toward coding the other. David

cfastie 10 days ago

Cool. We'll have to get a third answer or Gretchen won't know what to think.

Log in to comment

Hi all, third answer here. Thanks for asking the question Gretchen, I actually have the same question. So this is not exact answer, I am hoping someone could correct me on this. The drawing is my understanding of the difference between products(brands). I don't think KnowFlow is a datalogger. I hope to change the arduino uno part of knowflow to Riffle, since it's cheaper, smaller, easier to put into bottles, etc.
concerning the code side, majority of KnowFlow's code is about control the sensors, I think can be used for other board as well.

@rockets, what's your opinion?



shanlter 2 days ago

OMG, the image layout is horrible from my laptop, help needed @warren

warren 2 days ago

:-) sorry, i'll push a new change which will fix this in a bit!

warren 2 days ago

Fixed! Thanks for finding this issue!

shanlter 1 day ago


Log in to comment

Sign up or Login to post an answer to this question.