Quick-start guide

OpenDAQ is an USB based multifunction acquisition instrument, with many capabilities that allow connecting your computer to the physical world:

  • Read and display sensors that output voltage or current, like: temperature, pressure, acceleration, humidity, gas concentration, light intensity sensors, and many more.
  • Read and display sensors that output digital signals, like: linear and rotary encoders, proximity, flow, vibration, contact sensors, and many more.
  • Control and interact with devices such as motors, lights, relays or valves.
  • Generate waveforms as excitation signals for testing electronic devices, or even for artistic purposes.

Physical appearance

Having a look from outside, we will see the following different parts in openDAQ:

Different parts of openDAQ

  1. USB connector: it is a mini-B type connection for USB cable. All power and communication of the device are handled by the USB terminal.
  2. Right side screw terminal block: it has connections for 4 analog inputs (A1 to A4), 4 digital input/outputs (D1 to D4), apart from 2 ground connections, analog and digital grounds respectively.
  3. Left side screw terminal block: another 4 analog inputs (A4 to A8), 2 more digital connections (D5 and D6), 2 ground connections, DAC output connection and a +5V output supply connection.
  4. Status LED: on top of the box, there is a two color LED indicator, which will be normally shining green when the device is connected. A red color will indicate some kind of problem (overload/overvoltage). It also will flick in orange (green+red) when collecting data in stream mode.   

Installation on computer

OpenDAQ may be connected to almost any kind of computer with any operating system. It can even be connected with a small SBC (single board computer) like the Raspberry Pi!

The openDAQs use CP2102 USB to UART Bridge to build a Virtual COM Port (VCP) with the computer. This means that it is seen like a regular serial port from the host computer.

Most operating systems would recognize the device directly, and you will only need to wait some seconds while the computer updates the drivers to start using it. In any other case, you will need to manually install the drivers. You will also need to determine which serial port  is being used by openDAQ, in order to configure the software access.

In Windows, you may go to Control Panel->System->Device Manager to check out the new COM port that is generated once you plug openDAQ to the USB port.

In Linux or Mac, you can use the command “dmesg” to check which ttyUSB* port is associated with openDAQ (e.g. /dev/ttyUSB0). To access the port, you will need to have the appropriate permissions. You can use the command "ls -l /dev/ttyUSB0" to check if the port file is writable and readable. Try something like this: "sudo chmod 666 /dev/ttyUSB0" if you need to change the permissions.

Python command line basics

The best way to interact with openDAQ from a computer is to use the Python library (python-opendaq), which can be found in our GitHub repositories. The library includes all the low level functions needed to control everything in the device.

To make use of the library, first you will need to install Python in your computer. Python is a high-level interpreted programming language. It has become very popular during the last few years, especially as a scripting language, although it also can be used to generate standalone executables. 

 http://www.python.org

Connecting with openDAQ and starting to play commands is very easy from here. Make sure that you have installed correctly the opendaq-python module, following the instructions given in the repository. 

The first step must be to import the DAQ module and open the serial port. The package includes a set of demo scripts that show how to execute simple actions with the help of openDAQ.

For example, the following lines will get to change the color of the top LED light of openDAQ:

>>> from opendaq import *    # Import the openDAQ module and all its definitions

>>> daq = DAQ(‘COM2’)    # Open the  port and assign name "daq"

>>> daq.set_led(LedColor.RED)    # E.g. change led color to red

Another example, set a potential output and read it back through analog input A8:

>>> from opendaq import *    

>>> dq = DAQ(‘COM2’)       # Open the port and assign name "dq"

>>> dq.set_analog(0.91)    # Set output voltage 0.91V (DAC terminal)

>>> dq.conf_adc(pinput=8, gain=Gains.M.x1)  # Positive input A8, negative input GND, range +-4V

>>> print dq.read_analog() # Now print read value in volts

0.91000 

 

Operating Modes

OpenDAQ has two modes of operation: 

Command-Response mode: where communication is initiated by a command from the host PC, which is followed by a response from openDAQ. All the features from the hardware can be accessed using the appropriate commands.

Stream mode: Hardware-timed mode, where a list of experiments is executed at a specified scan rate. The scan rate specifies the interval between the beginning of each scan, and it can be defined by an internal hardware timer or by an external trigger connected to one of the digital inputs. Stream mode can refer to three different kinds of experiments, which differ in the maximum scan rate allowed and the source of the timing clock (internal or external):

  • Stream experiments: internal clock timed, minimum period is 1ms. Up to 4 simultaneous channels.
  • External experiments: external digital clock timed experiments.
  • Burst experiments: internal clock timed, high-speed, up to 10kSPS.

Example programs

In our repositories in GitHub there are a couple of example graphical programs intended for testing the two operating modes of openDAQ:

  • DAQcontrol: This demo program has user controls to access via Comand-Response mode to most of the device functions, including: Analog Input (configure one analog input at a time), Analog Output, Digital I/Os, and Timer/Counter functions (PWM, Capture and Counter), and also Encoder readings.
  • EasyDAQ: This second demo program provides an easy way to configure and perform Stream Mode experiments. User can configure analog input, gain and scan rate for up to four simultaneous experiments. Burst experiments are not supported. The software also allows setting up Waveform Generator Experiments, using the device as a signal stream output. Four types of signals are available: sine wave, square wave, sawtooth wave and triangle wave. 

Examples for openDAQ are only compatible with Python 3.6+. You need to have the opendaq-python library installed. If you want to download and work with the source code of these demo applications, it would be also useful to download (we recommend using pip) the following modules:

 

Modifying the firmware of the device

OpenDAQ is an open source device. Thus, the internal firmware of the device is available for anyone to modify it and adapt it to any needs.

The source code is available also at a Git repository. It can be downloaded, compiled and loaded into the device using the Arduino IDE.

In order to get the IDE, just download a version of Arduino and modify it as it is explained in the repository info. 

Just copy the necessary files into the Arduino installation folder. Then, you will just have to select the appropriate board and start programming!