Wireless Internet Connectivity of Open-Source Scientific Devices - Part 1

Conan Mercer Site Reliability Engineer

Wireless Internet Connectivity of Open-Source Scientific Devices - Part 1

13 May 2020 - Conan Mercer

This article was originally published in The Journal of Chemical Education - it can be cited from here</b>

Introduction

This post is the first in a series that presents a system for remote monitoring of scientific sensor data. This project uses the specific example of a turbidity sensor that can detect light intensity and temperature using a microcontroller and the Internet of Things. With that said, this project can be used as a base and then adapted into many different uses or outcomes.
The system consists of a light dependent resistor and infrared temperature sensor interfaced with an ESP-12E microcontroller, a programmable data acquisition platform; together these enable remote real-time monitoring of sensor data (in this case turbidity) applicable to many scientific experiments. This system will allow makers, scientists and students to monitor chemical experiments in real-time through a web browser. Changes in turbidity and signal processing associated with a light dependent resistor are stored locally on the microcontroller and transmitted wirelessly via a WiFi-based connection to a cloud-based server. The light intensity signals are displayed on the system through an organic light-emitting diode and subsequently uploaded to a cloud-based server. A web-based signal processing MATLAB program plots the uploaded signals available as real-time streams to authorized subscribers over standard browsers.

Hardware

The components include an ESP-12E for control and WiFi connectivity, and an organic light-emitting diode (OLED) for visualization, Figure 1. The ESP-12E is selected because it has integrated Wi-Fi and a clock speed of 80 MHz and flash memory of 4 MB compared to, for example, the commonly used Arduino Mega which has no integrated Wi-Fi and a clock speed and memory of 16 MHz and 128 kB, respectively. The ESP 12E is also cost-effective, being significantly cheaper than the Arduino.

Figure 1 - Photograph of hardware where: (A), (B), (C), (D) and (E) correspond to LDR, IR thermometer, OLED, ESP-12E and micro USB power cable respectively

Parts List

  1. ESP-12E for Arduino
  2. 0.96 OLED LCD Display
  3. MLX90614ESF Non-Contact Infrared Temperature Sensor
  4. Solderless Breadboards
  5. LDR
  6. A-Male to Micro-B power cable
  7. Resistor Kit Assortment
  8. Breadboard Jumper Wires

The Pinout

The NodeMCU version of the ESP-12E includes the ESP8266 chip, built-in USB port, a hardware reset button, Wi-Fi antenna, LED lights, and standard-sized GPIO (General Purpose Input Output) pins that are breadboard compatible. Figure 2 shows the ESP-12E module (NodeMCU) pin definitions.

Figure 2 - ESP-12E module (NodeMCU) pin definitions

Circuity

The circuit in Figure 3 uses a resistive divider in the case where both impedances, \(R1\) and \(R2\), are purely resistive. The relationship between the input voltage, \(Vin\), and the output voltage, \(Vout\), is: $$\frac{R2}{R1 + R2} . Vin = Vout$$ Any ratio of \(Vout/Vin\) greater than 1 is not possible. This means that it is not possible to either invert the voltage or increase \(Vout\) above \(Vin\) and damage the ADC of the ESP-12E (pin A0).

Figure 3 - Circuit diagram using LDR \(R1\), 10 k\(\Omega\) resistor \(R2\), OLED and MLX90614 IR sensor connected to the ESP-12E microcontroller.

Setup ThingSpeak Channel

Follow the settings below to create a new ThingSpeak channel.

  • Create a MathWorks Account and use it to sign into ThingSpeak
  • Select Channels > MyChannels
  • Select New Channel
  • Check the Fields boxes to the amount required and enter values for Name and Fields
  • Select Save Channel at the bottom of the settings page
Once the ThingSpeak channel is setup users have the ability to execute MATLAB code to perform online analysis and processing of the data in real time.

IoT Platform

ThingSpeak is a free IoT platform that allows data to be sent and received. The Web site interface provides graphical visualization of data posted to it, as well as MATLAB integration for more advanced analysis. ThingSpeak is therefore particularly useful for prototyping and proof of concept IoT systems that require analytics. The ESP-12E sends data to ThingSpeak via a Wi-Fi Internet connection.