Practical Arduino Data Loggers

by The Curious Questioner in Circuits > Arduino

272 Views, 4 Favorites, 0 Comments

Practical Arduino Data Loggers

Arduino-Datalogger-lcd-cover.jpg

Scope

In this paper, I describe how I came up with an Arduino UNO data loggers that are practical, low cost, easy to make and usable in a variety of applications. I’m not a pro nor a full-time programmer – just someone with an interest in the field and happy to share my work with other interested parties. I will attempt to describe my work in a simple form assuming the reader has a basic understanding of Arduino and programming.

 

My code doesn’t process real time data: all the data is recorded first, then saved on a micro flash card and then visualized (and processed) after the recording is complete.


I’m extremely grateful to all the authors of videos and forum explanations that I list in the “References” section at the end of the paper including the various participants of the Arduino.cc Forum community. A special thanks goes to Bill Greiman for sharing his awesome analog bin code that I used for one of the data logger projects. Although I never chatted with or met with any of these wonderful people, I learn everything I know from them.

  

How to Read this Instructables

All the details of the project with all the links and schematics are in the pdf attached at the end of this step.

I tried to make this paper as simple as possible and divided it into sections so that you can jump to the topics of interest via the tables of contents.

If you are new to Arduino programming and need to familiarize yourself with Arduino or with electronics, I’m sharing the sources I found online that helped me to master each topic. These sources were of great help to me and hope they will be for you as well.

In the following I provide excerpts from the pdf file sharing the code and schematics.

Supplies

Supplies are listed in the file attached to the previous step.

Data Logger Connected Via USB to the Computer

2- Basic_UNO DATALOGGER.png

This is the basic data logger and to make it work you need to connect the Arduino UNO to the computer via USB cable.

 

I used this version to develop data logger hardware and the Arduino UNO code. It allows you to monitor what is going on via the serial monitor and serial plotter and to verify quickly that each shield is working properly by running the example codes.

 

I prefer this version if I’m working with my laptop, and on a new project. It’s easy to connect everything together and to check that each component is working properly. Also, I can turn data logging on and off from the computer.

 

The data logger is assembled with the following components sown in the Figure attached to this step:

  1. Arduino UNO
  2. Analog Pin input isolation board
  3. Mini data logger shield with SD Card Reader and RTC
  4. Input power board
  5. Power distribution board
  6. Vref-external power source (power + filter)
  7. Amplifier power supply
  8. Voltage Bias power supply
  9. Amplifier input boards

 

The code for this board is available on GitHub. 

Data Logger With Modified Analog Bin Code (Connected Via USB to the Computer)

3- UNO DATALOGGER+Analog Bin.png
4- Analog Bin Control Board board.png

This data logger uses similar components to the data logger shown in Figure 2 except with the additional control & status board. This additional board allows you to start & stop the recording and to monitor the status and overruns with the LEDs.

 

I use this type of data logger only with the Analog Bin Code and connect the Arduino UNO to the computer via USB. The code is written to output status messages on the serial printer.

 

The modified Analog Bin code is available on GitHub. The original Bill Greiman’s code is at this link.

With this code, the data is logged in a  “.bin” file so in order to use it, it’s necessary to convert it to .csv with the Python code available on GitHub.


 

The circuit is made with the following components (the figures attached show the entire data logger arrangement and the control board schematic):

  1. Arduino UNO
  2. Analog Pin input isolation board
  3. Mini data logger shield with SD Card Reader and RTC
  4. Input power board
  5. Power distribution board
  6. Vref-external power source (power + filter)
  7. Amplifier power supply
  8. Voltage Bias power supply
  9. Amplifier input boards
  10. Control board with start & stop buttons and LEDs.

Data Logger With LCD Display and Power Supply

5- UNO DATALOGGER+LCD+PWR.png

This is the data logger that I use when I need to log data remotely without using a computer. This comes in handy for outdoor projects and for logging data for a long time (such as 24hr or more). 

 

This version of the logger doesn’t use the Analog Bin code and doesn't require me to be physically on site and allows me to deploy the device practically anywhere. I will use it on my future drone project to monitor its flying performance and record other sensor data while in flight. 

 

This version has its own power supply and an LCD diagnostic display that will show you if the data logger is functioning properly or if there is a problem.

 

The complete data logger is shown in the Figure attached to this step and is composed of:

  1. Arduino UNO
  2. Analog Pin input isolation board
  3. Mini data logger shield with SD Card Reader and RTC
  4. Input power board
  5. Power distribution board
  6. Vref-external power source (power + filter)
  7. Amplifier power supply
  8. Voltage Bias power supply
  9. Amplifier input boards
  10. LCD Display. 


The code is available on GitHub. 


Sampling Capabilities of the Data Logger

Figure_6_new.png
Figure_7 - AnalogBinrecording with Graph.png

When I was looking for the code on how to record the signals from the analog pins, I didn’t find a good resource that would clearly state the actual Arduino UNO sampling rate. I only found sources that would state the maximum (theoretical) sampling rate of the Arduino UNO board or of the other input voltage and current boards compatible with Arduino UNO. When I started running the code, I noticed that the actual sampling rate was much lower than the theoretical one. This prompted me to test each code’s actual sampling capabilities.

 

I also discovered that to achieve a high theoretical sampling rate you need to program the registers: something that honestly, I can’t do. So, although I didn’t develop the code to program registers, I share my resources in the References section at the end of the paper.

 

I used the Arduino UNO timing commands (“millis”) to measure the time required by each part of the code (see commented lines in the code). That gave the value of the sampling time, the time it took to write to the SD card and the time it took to get the real time from the RTC. However, this method can’t measure the total time to run the entire void loop. For this reason, I decided to just record the data, visualize it, and then count the actual sample points on the graph.

 

For the data logger code, I made different type of recordings: on a single channel, on two channels, and on all four channels. I recorded the data of four different waves (simultaneously for 4 channel recordings): sine wave, ramp, square and positive ladder. I recorded these waves at different frequencies to find the highest frequency that could be recorded (I’m sharing the data recorded). The graph attached (discussed in the paper) shows the results.

 

For the Analog Bin code, I made recordings using only sine waves at different frequencies to check which was the highest frequency to be recorded at a decent sampling rate. I need this code to record AC currents at 60Hz and its harmonics, so I didn’t explore other wave shapes. The graph attached (discussed in the paper) shows the results.

 

Details are in the pdf file attached in the Introduction.

Conclusions and What’s Next?

Overall, I am happy with the sampling rate and precision of the Arduino UNO, but in the future, I plan to look into other methods that may offer a better ADC resolution. 

 

In presenting the overall Arduino UNO data logger project, I did not go over the details on how to connect the SD card shield, the RTC shield and the other components. However, I’m sharing all my sources of information, pictures, schematics and diagrams. 

 

I know that there are other topics to cover, but I just couldn’t do it all in one paper.

In fact, I need to investigate the overall precision of the measurements that include the extra electronic boards that I’ve discussed in the pdf attached. I plan to discuss this in a future paper.

 

Additionally, I was presented with a new challenge of how to visualize the data upon completion of the data logger. The sources I found online didn’t provide the code that would fit my needs, so I created my own scripts on Python (I found all the information on StackOverflow). I ran the Python on Jupiter Notebook (running on Anaconda). I plan to discuss this work and results in a separate paper.

 

One last thing: don’t forget to look at my Reference section to find more interesting videos, projects and information.