Arduino - a low cost Data Aquisition and Automation alternative for researchers


Arduino Data Acquisition

Without computer we can not imagine of doing research in any branch of science now a days. Theoretical researchers use various software to assist them in their complex calculations, modeling and fitting data to a theory. Scientific data that are being generated by an experimental scientist or researcher inevitably require hardware support of a Data Acquisition System (DAQ or DAS). A DAQ connects a computer and the instrument by which some parameter or something else is being observed and recorded. There are a diverse category of professional DAQ available in the market subjected to the specific need of the study. Generally prices of the data acquisition systems are pretty high (starts from about 100$ to 1000$) and those researchers who are not supported by any funding agency can not afford. In the absence of a DAQ the research and its quality both are affected and sometimes it stops. A solution to this problem could be if someone builds his own DAQ by using a microcontroller and writes the corresponding software by himself. This reduces the price considerably and makes the research inexpensive. But those who do not have adequate knowledge of electronics and microcontroller programming this is not an easy solution to opt for. Apart from this, to program a microcontroller an external device called programmer is needed which may increase the cost of the project in unwanted manner. Those non-geeks who are familiar with programming languages such as C,C++, FORTRAN or JAVA etc. and little knowledge of electronics, Arduino can be a good choice.  Arduino is an AVR microcontroller board pre-loaded with all the necessary electronic components required by a microcontroller for analog and digital conversion/communication. There is an onboard programmer in the circuit and therefore no external device is required to program the microcontroller and it is already loaded with a bootloader and driver software to communicate with the computer through USB. An IDE software called Arduino Software (to be installed in the computer) enables the user to program the microcontroller through  the USB port of the computer. It uses a programming language called Arduino Language which is very similar to C programming language and anybody having little knowledge of computer programming can use it to program an Arduino device for a specific task very easily. A set of analog and digital I/O pins make this possible to operate switches or collect/transmit analog or digital data between external devices and with the computer. Based on AVR microcontrollers and with a clock rate of 16 MHz, most of the Arduino boards are capable of A/D (Analog to Digital) conversion with a resolution of 10 bit (e.g. Uno, Nano etc.), however some variant such as Due and Zero can give a 12 bit resolution.
Arduino Nano and Uno

It is true that Arduino alone can not handle complex data capturing and processing tasks and it has memory constraints too (e.g. Arduino-Uno and Nano has flash memory of only 32KB and SRAM of 2KB ), but there is a diverse collection external shields (circuits) available in the market to be used with Arduino to perform tasks by using a stepper motor, an LCD, a VGA camera, a Bluetooth or Wi-Fi device, an external memory device (such as SD card) and many other devices used in robotics and Automation. Starting from automation to remote controlling and data acquisition, in many cases Arduino is quite sufficient. For most of the purposes, 10 bit resolution (i.e. values between 0 and 1023) is pretty accurate to measure a parameter at a pulse rate of 1 milliseconds (it is quite fast but Arduino can produce lesser pulses too) and you can always make an efficient DAQ with this. Maximum input voltage that can be applied to its analog pins is 5V. An input voltage of 5V to Arduino's analog pin will be converted to 10 bit digital value by the A/D converter in Arduino and can be read by the computer as value 1023 through USB port. Similarly a voltage 2.5V will be displayed as 1023/2=511 (integral part) and so on. You can use the serial monitor of the Arduino Software to retrieve the digitally converted analog data both numerically and graphically and record them for further calculations. Also you can communicate or send a command to the microcontroller through the serial monitor to control an external device. You can also write a Visual Studio program yourself for your specific data acquisition or automation need and avoid the use of Arduino Software after once the Arduino device has been programmed through it. You might be thinking that programming Arduino will be quite difficult and vast knowledge of computer programming is required. But NO. It is dam easy! Actually Arduino IDE comes with a lot of examples pre-loaded in the software and most of the tasks can be done by making little modifications to these examples. Further, Arduino's support forum is quite active and you will find most of the answers you are searching for.
Arduino IDE Software

Arduino project is under GNU General Public License (GPL) and therefore free to manufacture by anyone. Therefore there are many clone versions of original Arduino devices playing in the market which differ a little bit in circuit design with the original one but are more cheaper. You will get a clone UNO with only $5-6 and clone NANO with $3-4 whereas their official versions costs about $22 or higher. Arduino clones are sufficient in most of the common tasks we want to do with a microcontroller, but quality and accuracy may be compromised.

An example of a basic Arduino DAQ

Here I shall describe an example of a simple basic DAQ using Arduino. First of all you require a sensor which will produce an analog voltage against the parameter you want to record (such as Temperature, Pressure, Intensity of light, Angle or something else) with time. The output from that sensor must be a DC voltage. If the output is AC, you must use an add-on circuit to convert it into a variable DC in order to use it with Arduino. Now, take a potentiometer (variable resistance) of 1KOhm and connect the two extreme ends to the Signal and Ground ends of the sensor circuit. Same Ground must go to the Ground connection of the Arduino which is marked GND in the board (see the figure below - there are three GND connector in the board which are actually internally connected to each other).

Simple Data Acquisition System DAQ example  using Arduino
Now do not readily connect the central leg of the potentiometer (brown wire) to the Arduino, instead connect a multimeter across this middle leg and the ground to check DC voltage. Keep your sensor in its maximum signal mode (suppose if you are measuring the light intensity of a source, then light up the sensor with a very bright light so that sensor reaches its saturation value and gives maximum reading) and then adjust the potentiometer so that voltage across the central leg and ground is 5V. More than 5V may damage your board, so, be sure to perform this operation before connecting to Arduino device. Now connect the brown wire to any of the analog connectors of Arduino marked A0, A1, A2...etc. If you have already connected the Arduino to your laptop by using appropriate USB cable, you can open the Arduino IDE software. Go to the Tools menu and then under the Board sub menu choose the type of Arduino board you are using.

Arduino AnalogReadSerial example explanation

Next, under Tools scroll down to Port and choose the appropriate port where your Arduino is connected. If you are not sure about the port, you may disconnect the Arduino from USB and then check which port has disappeared from the list. Again connect the device and see if it reappears - that's your port. Under File menu choose Examples>Basics>AnalogReadSerial. This will open a code for you written in Arduino language. You will see here two functions - void setup() and void loop(). First function runs only once and is used to define various settings and initial definitions. After the execution of void setup(), void loop() function runs again and again for indefinite time and it is here where the actual functioning of the microcontroller depends. In setup() function the command Serial.begin(9600) actually sets the baud rate for the serial communication to be 9600 bits per second which you need not change. Those who are familiar with computer programming can easily understand the working of loop() part. Here analogRead() function is reading the digitally converted analog signal at an analog pin labelled A0 on the board and then storing it into an integer sensorValue. You may change the pin number to A1 or any other value where you have given the connection of central leg of the potentiometer in the Arduino. Next function - Serial.println() prints the value stored in the integer sensorValue on the serial monitor line by line and the last function delay(1) pauses the program for 1 millisecond. Inside the parenthesis of delay function you may insert the number of millisecond (instead of 1) you would like to have interval between two readings. You are almost ready to go! Only last step. At the top left just below Edit menu there is a right arrow button which is called Upload button - click on it. This will first check the correctness of your code - if it is Ok then it will be uploaded to the Arduino board. You should get a confirmation message for the successful upload at the dark log pane at the bottom. Now open the Serial Monitor or Serial Plotter from the Tools menu and you should be able to see the values coming into the computer.   

Also see....



Comments