Sunday, March 1, 2015

Multichannel Professional Data Logger on Raspberry Pi - Part 1

See the Part 2 for the hardware and Part 3 for the software implementation.

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".

Requirements


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;
Nice-to-haves:
  • 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;
The requirements above would let you have a tool to test or tune your Segway, car or boat electric circuits, chicken incubator, solar battery or greenhouse.

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).

1 comment: