Building a DAQ with an Arduino

A quick Google search of Arduino+DAQ will return a ton of results but none of them seemed to do quite what I was looking for. There are lots of websites explaining how you can use an Arduino to build a very inexpensive DAQ (Data Acquisition) instead of using a commercial product which would be expensive. This is a great idea and the Arduino is more than capable of logging data for practical purposes and there are a lot of great existing projects out there. However in my opinion they were all too “Arduino-ie” (logging to sd cards, or printing directly to a serial lcd screen etc.) and kind of fail to hit the right market. That is why this project was born!

In truth this isn’t really much of an Arduino project it’s more of a python project - I set out to create a proper gui interface for using the Arduino as a DAQ. The Arduino program itself is very simple, it reads each analog pin and sends the data over serial. The real magic is what happens on the other end - a python program receives the data and plots each analog channel in real-time, sort of what you’d expect using a tool like Labview. There is also a text field where a file name can be entered and a button to begin saving the data to your computers hard drive in csv format. The program looks like this:

gui

I rigged up a little test bed for my Arduino DAQ using my new Arduino and a potentiometer. Here is a photo of my setup:

setup

The full source code for both the python program and the Arduino program are on my GitHub account:   

github.com/kevinhughes27/arduinoDAQ 

please use, improve and give me some feedback!

Augmented World Expo (AWE) '13

I recently got the opportunity to attend AWE ‘13 to demonstrate ARPool and give a talk. The conference was very cool, it was awesome to interact with people working on similar ideas and get inspired by their successes. I even got to try out Google Glass!

I am particularly excited about the “How To” applications of Augmented Reality, like one of the keynotes said we’re not quite at the matrix learn to fly this helicopter level but we are moving towards that direction.

ARPool was really popular and I had a great time sharing it with everyone, we also got a lot of nice press coverage - hopefully this helps us find a commercial partner!

ABC News: http://abclocal.go.com/kgo/video?id=9127769&pid=null

AWE.tv Demonstration http://youtu.be/iLCVVVAA1vw

AWE.tv Interview http://youtu.be/BaA3Wr4yxIc

AWE Talk http://youtu.be/Nf3cQfhUx-A

USA Today http://www.usatoday.com/story/tech/personal/2013/06/05/augmented-reality-expo-google-glass/2392769/

PCWorld http://www.pcworld.com/article/2040801/google-glass-competitors-vie-for-attention-as-industry-grows.html

PC Advisor http://www.pcadvisor.co.uk/news/mobile-phone/3452063/yes-theres-a-trade-show-for-augmented-reality-and-its-demos-are-enchanting/

ARPool::getInstance() Refactor

Finally got a chance to blog about the most recent architectural improvements to ARPool - Singletons! Singletons make so much sense for ARPool it’s insane, I can’t believe we didn’t have it like this before.

Backing up for those who aren’t familiar with what I’m talking about, a singleton is an object for which we enforce the constraint that there will only ever be a single instance of that object. How do we do this? easy make the constructor private, err okay but then how do we instantiate the singleton in the first place? This one isn’t hard but I wouldn’t say easy, we make a public method called getInstance which returns a pointer to the single instance of the class if it has already been initialized or creates it if it has not. The class also has 2 static variables to hold the single instance and a flag indicating whether it has been instantiated yet. The code looks like this:

// header
class Singleton

  private:
  static bool instanceFlag;
  static Singleton* single;

  public:
  Singleton* getInstance();

  // the rest of the methods...

};

// cpp file
bool Singleton::instanceFlag = false;
Singleton* Singleton::single = NULL;

Singleton* Singleton::getInstance()
{
  if(!instanceFlag)
  {
    single = new Singleton();
    instanceFlag = true;
    return single;
  }
  else
  {
    return single;
  }
}

So why would we want to do this? when is this useful? The best example is whenever you are dealing with hardware or an actual physical element. For example in ARPool there is only one camera so it makes sense to make the camera class a singleton.

The major advantage of using singletons is that you can include the class where ever you like and simply ask for the instance - this can greatly simplify your code because you no longer have to pass all of these objects to each other to access them. A really basic way to think about Singletons is to treat them as safe global objects.

and thats really all there is to it! I’m just going to sit here and smile thinking about how much cleaner ARPool’s code is now mmmmmmmmmmmmm!