EduDAQ is simple data acquisition (DAQ) system for educational purposes that runs on an Arduino UNO. Get started!
Features:
- Sample Arduino analog pins with an accurate sampling period anywhere between 1 ms and 15 minutes.
- Change acquisition parameters via a simple Serial communication protocol (using the Arduino IDE Serial Monitor, or using MATLAB/Python/Excel Data Streamer in automated applications).
- Support for both continous acquisition ("live view") and triggered acquisition (trigger on signal passing a threshold, or on external pull-down).
- Special "graph-mode" to format the output for live preview with Arduino IDE Serial Plotter.
- Circular data buffer of up to 1200 samples to capture (part of) a signal before the trigger (especially useful for fast signals).
- Up to 6 Analog Input pins can be sampled "in parallel" through multiplexing (the Analog pins are sampled in quick succession with 1 ms between samples)
command | parameters | example | description |
---|---|---|---|
? | ? |
Print an overview of the current settings. | |
p | sampPeriod | p 10 |
Set the sampling period in ms (between 1 ms and 900000 ms (15 min)) |
n | nChannels | n 5 |
Set the number of anolog inputs to sample from (see Multiple signals). nSamples xnChannels is limited to 1200. |
r | adcRes | r H |
Select the internal voltage reference for the Analog to Digital Converter (ADC), i.e. the voltage that corresponds to 1024. L = 5V (low resolution), H = 1.1V (high resolution) |
t | [trigChannel] trigMode [trigThresh] [preTrigSamp] [acqDelay] | t / 400 |
Set the trigger mode to trigMode (live = l, external = e, rising edge = /, falling edge = \, crossing = x). For /,\, and x modes, trigThresh sets the raw ADC value at which the signal trigger is fired (upon the signal crossing this value). trigChannel specifies the channel (0-5) used for the signal trigger (default = 0). preTrigSamp specifies how many samples before the trigger should be kept (can be between 0 and nSamples-1 ) and acqDelay specifies an optional acquisition delay (in number of periods) after the trigger (0 - 2000 sampling periods). |
s | nSamples | s 200 |
Set the size of the circular buffer to nSamples |
w | pwmOn [pwmFreq] [pwmDuty] | w Y 0.5 0.25 | Turn on (pwmOn = Y) or off (pwmOn = N) the square wave generator on PIN 9. The frequency and duty cycle of the square wave are controlled through pwmFreq and pwmDuty |
v | valSep | s , |
Set the value separator in the output to valSep (can be any character; t = tab, s = space) |
g | graphMode | g Y |
When graphMode (Y/N) is set to Y(es) the output is formatted for Serial Plotter: timestamps are ommitted and channel labels are added. |
You'll need:
- An Arduino UNO (The code might work on other devices (perhaps with some modifications), but it has been developed and tested on a UNO).
- Arduino IDE to compile and upload sketches and communicate over the Serial port.
- A signal that varies between 0-5V (e.g. from a sensor) connected to Analog Input A0.
As a test, you could simply use a wire from Arduino's GND, 3.3V, or 5V to manually create a "signal" on A0, or you could sample the onboard LED pin (Pin 13) which is toggled after each acquisition. A bit more fancy: connect a potentiometer between 0 and 5V and sample the central (sliding) contact and turn the knob to make arbitrary signals.

After you've compiled and uploaded the EduDAQ.ino sketch to your Arduino, open the Serial Monitor from the Tools menu in Arduino IDE. Select 'Newline' and '115200 baud' and use the input field at the top of the Serial Monitor to send the message 'tl' (short for 'trigger mode live'). If all went well, you should now see a continous stream of raw readings from Analog IN A0 (numbers between 0 and 1023). If you turn the potentiometer knob (or change the signal on A0 in some other way), you should see the number change.

The default sampling period is 10 ms. To change this, use the command p [desired period in ms]
. For example, to set the period to 500 ms (half a second) send the message p 500
. If you are still in live mode, you should see the rate at which samples are printed decrease. The onboard LED will also toggle at a lower rate.
The output of EduDAQ is also compatible with Arduino IDE's Serial Plotter. Give it a try by closing the Serial Monitor and opening Serial Plotter from the Tools menu. The Arduino board will be reset when you do this, so you will have to reconfigure the live mode by sending t l
using the message field at the bottom of the Serial Plotter. Make sure 'Newline' and '115200 baud' are selected as before. If all went well, you should now see a live graph of the signal on A0.



s10 p10 t / 200 5

n500 p1 gY t / 200 100

t e



n2 s500 gY
