In this series of articles I'll explain how to build a multichannel Data Logger, capable of collecting voltage, current and temperature measurements over the specified intervals of time.
Our alternate goal is to proof that Raspberry Pi is not just a nice tool to promote teaching of basic computer skills in school, but a serious instrument capable of handling professional tasks.
A "data logger" definition from Wikipedia: "A data logger is an electronic device that records data over time, or in relation to location either with a built in instrument or sensor or via external instruments and sensors".
Let's first clarify our requirements. As a field / service engineer, I want to have:
- 8 input ports which can measure temperature in ranges between 0 and 260 C (about 32...500 F);
- 8 input ports to measure either voltage (30mV ... 30V, +/- 2mV) or current (10mA ... 500A);
- time measurement interval (1 ... 60 sec);
- a simple way to configure data logger and store configuration parameters between restarts;
- an intuitive way to retrieve collected data or represent it in graph format;
- lightweight and portable solution: logger should run on batteries;
- easy to handle and operate in both field or in lab conditions;
- Desktop or laptop computer is not needed to operate and collect data;
Architecture and Design
The Raspberry Pi itself is a single-board computer, we will run a Raspbian Linux distribution on it.We need to build an additional custom board, which will have an Analog-to-digit converter (ADC), connectors for shunts and sensing resistors, temperature sensors, power stabilizer and power outage notifier (we are running on accumulators when we are in the fields).
From the connectivity standpoint - our Data Logger will be accessible over WiFi. We will put a WiFi dongle in one of the Raspberry Pi USB ports. The WiFi will be configured in HOST mode, so basically in field conditions you can see the Data Logger on your phone or tablet as a "Wireless Network". You can connect to it and access the Data Logger by IP. In case if you work with Data Logger in lab, you can plug your Ethernet cable into the Raspberry Pi and the Data Logger can serve as a free wireless router or WiFi extender.
See hardware and network diagram below.
Software will be based on assumption that we build a network-connected Data Logger. We will have a web user interface, so all logging configuration can be made from your favorite web browser. The collected data will output on screen in real time and represented as a set of graphs. Alternatively user will have ability to download a whole collected set of data as CSV file and analyze it (for example in MS Excel).
Above is a software design diagram. The ADC connected to Raspberry Pi GPIO ports, we need a way to program ADC and read its values. Also we need a service which will retrieve the ADC data from specified ports over a specified time periods, store and retrieve the configuration settings. We will use REST service to provide a user an easy access to the data and configuration. The Web User Interface consists from two screens: Configuration (so set interval, select ports, trigger conditions) and Status (display retrieved data and draw graphs, export data).