Fetch: Arduino Data Acquisition/Oscilloscope (Alpha2 Release)

Fetch is an Arduino development tool that makes it easy to view, plot, and change internal Arduino parameters (aka global variables) in real time.

Features
-user-friendly & intuitive general purpose data acquisition (similar to oscilloscope)
-no need to specifically code which parameters to view/edit
-dynamically choose parameters to monitor, graph, and edit values
-high speed data transfer, initially via serial (at least as high speed as serial will allow)

**** New for Alpha2 ****

  • Arduino parameter values can be changed from within Fetch
  • Now supports Arduino Due!
  • automatically save/restore list of parameters
    (Full changelog below)

Installation
Must be logged into forum to see attached file
Download the attached “Fetch Arduino Package” and unzip somewhere such as <C:>, retaining the directory structure. Then follow the instructions in the Getting Started Guide located in the "Fetch Arduino Package" directory.
**Be sure to replace any previous DataLogger library files with the new ones.

Let us know if you any questions/comments/suggestions.

Screenshot:

ChangeLog
Alpha2 (2012-12-11)

  • Arduino parameter values can be changed from within Fetch
  • Now supports Arduino Due!
  • automatically save/restore list of parameters
  • ignore variables that were optimized out by compiler (never assigned to inside a loop)
  • automatically edit the build.path setting in Arduino ERW's preferences file
  • some GUI enhancements

Alpha1 (2012-11-30)

  • initial release

Fetch Arduino Package Alpha2.zip (1.04 MB)

Drl81,

I downloaded the code and used it with Ide 1.01 with success! I discovered a couple things that I think are notable.

1.) to datalog an analog value from an analogpin, you have to define a variable for the analog result before setup. Defining a variable in the loop() does not allow Arduino Fetch to see it???
2.) Your program does not seem to work with Arduino ERW which is a modified version of the Arduino IDE found in the other software section. (I know it is not supported by the Arduino group).
3.) A definition like "int led pin = 7; will show up as a possible choice for datalog even though it would possibly be referring to a digital pin number that is a constant but, just defined as int.

The code below gave me some nice graphs to look at. I hope to try more things when timed allows!

Thank you for sharing your hard work!

#include <DataLogger.h>
DataLogger datalogger;  // instantiate the DataLogger

// some basic test params
signed char sbyte_test = 0;  
float loop_time_ms, loop_period_ms;

int sensorValue;
int otherpin;
// initialization routine
void setup() 
{
  Serial.begin(SERIAL_BAUD); 
}

//background loop (aka "main" loop)
void loop() 
{  
  // timestamping
  static unsigned long loop_timestamp;
  unsigned long now = micros();  
  loop_period_ms = ((float)(now - loop_timestamp)) * 0.001f;
  loop_timestamp = now;  //store off prev val

  sbyte_test+=2;  // test parameter
  
  datalogger.ReceiveDAQParams(); // Receive serial data
  datalogger.SendDAQParams(); // Send data
   sensorValue = analogRead(A0);
   otherpin = analogRead(A1);
  // calculate loop time (not including delay at end)
  loop_time_ms =((float)(micros() - loop_timestamp)) * 0.001f;
  
  // wait some milliseconds to slow the sending of params
  delay(20);  // can be reduced as desired
}

cyclegadget, thanks for the helpful feedback!

1) Yes, that is correct. Fetch only supports global variables. We do not plan to have Fetch support local variables since the compiler does not allocate a fixed memory address for locals. Also, multiple local variables with the same name could exist but in separate functions (not likely for most Arduino users only using the loop() function, but possible).

Supporting "static" local variables would be possible since they do get allocated a fixed memory location. It would be difficult but not impossible to distinguish multiple static local vars with the same name but in different functions.

How important is this functionality, versus declaring any parameter you want to view as global at the top of the file outside of any functions?

2) I looked into Arduino Enhanced Release for Windows. Looks like a nice improvement to the standard editor!

Fetch Alpha1 will work with it, but the preferences for ERW are in a different file (e.g. idesettings_v1.0.2.txt). Those prefs files can be located by going to Arduino File->Preferences window and clicking link at the bottom. You just have to make sure the build.path setting is the same in that ERW file as it is in preferences.txt. Only edit preferences files when Arduino Editor is closed!! Otherwise, when Arduino is closed, it will overwrite any edits you made.

In future releases, Fetch can automatically add build.path setting to ERW prefs and ensure both files have same setting if both preferences files exist.

3) You are right, there is a bug if a global variable is defined and initialized to a value, but never used in the code. Fetch Alpha1 will present it as a valid parameter and show the wrong value for it since it isn't truly a parameter (the compiler recognized it wasn't used and didn't allocate memory for it). It should be able to be fixed so it doesn't show up as a valid selection in future releases. Not sure if I can get it to show up as an option AND report the correct constant value, would that be desirable?

In the meantime, there are some workarounds. If you really want to declare a constant value, you could use either option below, and Fetch will not show it:

#define LEDPIN 12
const int ledpin =12;

we'll be working on some more tweaks and releasing again soon. let us know any other feedback!

Supporting "static" local variables would be possible since they do get allocated a fixed memory location. It would be difficult but not impossible to distinguish multiple static local vars with the same name but in different functions.

How important is this functionality, versus declaring any parameter you want to view as global at the top of the file outside of any functions?

Thanks for the reply!

I am a bit of a novice and not a professional coder but, I think that I can adjust most of my sketches with a little programming strategy for using Fetch by using global variables.

I will try some of your tips and see what other results I can produce. I will also test some functions and see if I can produce desirable results with those also.

thanks, cyclegadget, and anyone who has had a chance to try out fetch. let us know how it's going and whether you have any suggestions or feature requests.

I don't understand. Can you explain this tool to someone who has never heard of it before? I tried Googling.
Please start at the beginning...

sbright33:
I don't understand. Can you explain this tool to someone who has never heard of it before? I tried Googling.
Please start at the beginning...

sbright, i will certainly try. Fetch is a software for Windows OS intended to help with any Arduino based project. It was released for the first time recently in this forum thread, so there will not be much on Google about it.

Sometimes during development of an Arduino project it would be nice to be able to easily visualize what is going on inside the Arduino. Fetch provides a easy to use PC interface to plot any Arduino global variable in real time. In many cases this may be a sensor input reading, or a calculated output value.

For example, let's say you wanted to make the Arduino do something like sound an alarm in response to motion detected nearby. A motion detection sensor would be connected to an Arduino analog input pin, and the Arduino would periodically read the sensor value, store it to a global variable, and respond in various ways depending on that value. In order to more easily calibrate how the Arduino responds to any nearby motion, the Fetch software would allow you to quickly see a real time plot of the sensor reading value for different types of motion detected by the Arduino. This applies to any type of sensor such as temperature, acceleration, light level, sound, voltage, current etc. Fetch helps to tune and calibrate a response to something about the physical environment.

There is more detail about how to install and use Fetch in the "Getting Started Guide" included in the zip file attached to the first post. Maybe it would help to go through that guide and try the included example sketch.

Hopefully this helps, don't hesitate to ask if you have more questions.

Wow sounds very useful! I assume there is a tutorial, demo, or example code in the zip to try first?

My code that I posted reads two analog pins on my Uno, that I left unconnected. I just touched the pins to see the output change. It worked very nicely, and I have some ideas that I want to try when I get time.

sbright33, yes, there is a basic example included in the zip download. You could also try the modification of that example that cyclegadget posted.

Hello,

Today I tried my code that I posted above on the Due. The code compiled and loaded into the Due with no problem. However, the Fetch logger does not seem to get updated information.

It seems that it either the Due data stream is not the same as the Uno or the data types are being mismatched.

On the Uno my analog read-out was 0 - 1023. On the Due it is only showing something like "4.09 E9" similar to a calculation with powers of 10 in the answer. The analog read-out does not work on the Due, as if it is frozen or not transmitting.

cyclegadget,
i do not have a Due so i cannot test it. If you would like to help me debug, please try:

  1. modify the example's setup() function as in code sample below.
  2. compile/upload to the Uno.
  3. open Arduino serial monitor (make sure baud is 115200)
  4. there should be a number printed in at the top of the serial monitor (for me it is '417')
  • if no number appears, try pressing reset button on Arduino board
  1. repeat for Due
  2. tell me the numbers you got for each
void setup() 
{
  Serial.begin(SERIAL_BAUD); 
  Serial.println((long)&sbyte_test);  // new line to help debug
}
 Uno with 3 resets
407
407
407
Due with 3 resets
537330012
537330012
537330012
537330012

thanks, cyclegadget, that is what i was expecting. i'll look into a clean way to handle both the Uno and Due.

Looking forward to using this software with my Due. Good work Drl81!

Fetch Alpha2 released in first post. Let me know if Due works.

drl81:
Fetch Alpha2 released in first post. Let me know if Due works.

The frame rate seems to be working as it changes when variables are added or removed from the list. However, I get no data change "it shows 0" and it also does not graph or change data with Uno using 1.0.2 IDE

It is definitely finding the sketch I uploaded and the variables but data is not the changing.

cyclegadget:
The frame rate seems to be working as it changes when variables are added or removed from the list. However, I get no data change "it shows 0" and it also does not graph or change data with Uno using 1.0.2 IDE

cyclegadget, you may have to copy the new Alpha2 DataLogger library files into the arduino libraries folder, replacing the files from Alpha1.

Update! Problem solved! Fetch Alpha2 Release works with both Due and Uno!

I must of had some old files from Fetch Alpha1. I removed all Fetch files from my Arduino IDE to make a clean start and replaced them with the new Alpha2 files.

I tested Fetch with both the Uno and Due back to back and it works great!

Job well done drl81!

cyclegadget, thanks for the confirmation. i can't take all the credit, i've been working on it with a friend who has helped a ton and may show up on this forum at some point to help answer questions, etc.

anyone who is giving Fetch a try, let us know if there are any specific features or fixes to prioritize for next release.