Cost-Effective Wireless Microcontroller for Internet ... - ACS Publications

May 7, 2018 - monitoring of turbidity data applicable to chemical education. This system will allow ... for cost-effective open-source systems to conn...
1 downloads 0 Views 6MB Size
Technology Report Cite This: J. Chem. Educ. XXXX, XXX, XXX−XXX

pubs.acs.org/jchemeduc

Cost-Effective Wireless Microcontroller for Internet Connectivity of Open-Source Chemical Devices Conan Mercer* and Dónal Leech School of Chemistry and Ryan Institute, National University of Ireland Galway, University Road, Galway, Ireland S Supporting Information *

ABSTRACT: This paper presents a system for remote monitoring of turbidity data that can detect light intensity and temperature using a microcontroller and the Internet of Things. The system comprises 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 turbidity data applicable to chemical education. This system will allow educators 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. KEYWORDS: Computer-Based Learning, Laboratory Equipment/Apparatus, Laboratory Computing/Interfacing, Interdisciplinary/Multidisciplinary, Internet/Web-Based Learning, Student-Centered Learning, Instrumental Methods, Graduate Education/Research, First-Year Undergraduate/General, Upper-Division Undergraduate



INTRODUCTION Chemical education in laboratories is usually carried out with commercial instrumentation. However, scientific instruments can be expensive relative to open-source custom built hardware,1 and associated software packages are usually licensed and therefore not customizable.2 The recent availability of common microelectronics for capture of data,3,4 such as Arduino microcontrollers,5−7 provides an opportunity for cost-effective open-source systems to connect laboratory hardware to the Internet of Things. The benefit of microcontrollers to students of chemistry has been reported before,4,8−13 along with a study that suggests technical instrument learning combined with guided inquiry increases student problem solving skills.14 This technology is also of interest to other disciplines in the physical sciences such as environmental chemistry,15,16 field work,17 and astronomy.18 Students typically interact with instruments in the laboratory, and although commercial instrumentation can be operated remotely,19 microcontrollers used in chemistry do not usually include wireless technology.20 An interesting example of wired Ethernet technology is an automatic titrator connected to the Internet. However, this method required an additional auxiliary web server to overcome microcontroller performance limitations.21 The first reference to a wireless device for chemical data communications was published in 1988 and used a radio transmitter to transfer data obtained from an iodine clock reaction.22 The Internet of Things (IoT) is a group of physical devices with electronics, sensors, actuators, programs, and network connectivity that connect and exchange data.23−26 By including wireless technology with open-source hardware for capture and © XXXX American Chemical Society and Division of Chemical Education, Inc.

upload of measurements of chemical reaction data, students and educators have greater access to data for analysis. This report demonstrates the remarkably cost-effective ESP12E CP2102 microcontroller (ESP-12E) for wireless transfer of turbidity data for IoT applications. The hardware uses a light dependent resistor (LDR) to sense the turbidity change of a model reaction: the precipitation of sulfur using sodium thiosulfate and hydrochloric acid.27 Wireless data transfer, programmable hardware controlled measurement, storage, and acquisition are the key advantages of this microcontroller.



HARDWARE The components selected 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 MB28 compared to, for example, the commonly used Arduino Mega4,21,29−31 which has no integrated Wi-Fi and a clock speed and memory of 16 MHz and 128 kB, respectively.32 The ESP 12E is also cost-effective, with price comparisons of five wireless microcontrollers available in section 1.2 of the Supporting Information. For acquisition of turbidity data, an infrared (IR) thermometer and a cadmium-sulfide LDR are connected to the ESP-12E. Pin definitions and circuitry are provided as Supporting Information section 1. During use, the ESP-12E is powered via a micro-USB cable connected to an ac adapter. All Received: March 16, 2018 Revised: May 7, 2018

A

DOI: 10.1021/acs.jchemed.8b00200 J. Chem. Educ. XXXX, XXX, XXX−XXX

Journal of Chemical Education

Technology Report

Figure 1. Photograph of hardware where A−E correspond to LDR, IR thermometer, OLED, ESP-12E, and micro-USB power cable, respectively.

formation section 2). This reaction has previously been used for experimentation and discussion related to chemical research33,34 and chemical education.35,36 It is useful for an introduction to students of basic collision theory and, on successful completion, provides students with a data set accessible on the Internet. Light intensity is measured using the LDR, and the measured light intensity changes when sodium thiosulfate produces colloidal sulfur according to the reaction36

the hardware used in construction of this system is relatively inexpensive (20.36 USD) and is available in section 1.3 of the Supporting Information. IoT Platform

ThingSpeak (Mathworks) 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. The ESP-12E is programmed with C/C++ language within the Arduino integrated development environment (IDE). The code used to program the ESP-12E is explained in detail in section 3 of the Supporting Information along with an example of MATLAB integration. Briefly, data from the LDR and IR constitutes the sensor input on the ESP-12E and is continuously stored in memory for periodic upload in bulk to a ThingSpeak channel via the Internet. Details of how to set up a ThingSpeak channel are provided in section 3.3 of the Supporting Information. ThingSpeak is limited to an upload every 15 s. Because data acquisition more often than once every 15 s is desired, the bulk upload approach overcomes this limitation.

Na 2S2 O3(aq) + 2HCl(aq) → 2NaCl(aq) + S(s) + SO2 (g) + H 2O(aq)

Commercial colorimeters or calibrated light sensors display increased sensitivity and accuracy compared to LDRs,37,38 but at a higher cost. Nevertheless, for qualitative measurement the LDR can adequately detect variations in light intensity37 without amplification of the signal necessary. The LDR is connected in series with a 10 kΩ resistor and the output voltage across the LDR is determined according to the resistive divider rule between two resistors (Supporting Information section 1.4). As a result, the output voltage varies in the range 0−3.3 V. The output of the circuit is connected to the analog-to-digital converter (ADC) of the ESP-12E (pin A0) and is used to measure the output voltage of the LDR sensor. It is assumed that any change in light intensity is proportional to this output voltage.39,40 The ESP-12E has a 10-bit ADC: therefore, 210 = 1024 quantization levels result in a sensitivity of 3.3 V/1024 = 0.0032 V in the sensor voltage output.

Application of ESP-12E to Chemical Experiment

Data acquisition and upload to the IoT platform using the ESP12E is performed in a simple experiment to qualitatively investigate the effect of temperature on reaction rate between sodium thiosulfate and hydrochloric acid (Supporting InB

DOI: 10.1021/acs.jchemed.8b00200 J. Chem. Educ. XXXX, XXX, XXX−XXX

Journal of Chemical Education

Technology Report

Figure 2. Setup used for study of the effect of temperature on reaction rate between sodium thiosulfate and hydrochloric acid by simultaneously monitoring light and temperature: (A) sodium thiosulfate and dilute hydrochloric acid, (B) infrared thermometer, (C) light dependent resistor, (D) ESP-12E microcontroller, and (E) visual display.

Figure 3. LDR data where (A) HCl is added and (B) turbidity maximum first occurs.

C

DOI: 10.1021/acs.jchemed.8b00200 J. Chem. Educ. XXXX, XXX, XXX−XXX

Journal of Chemical Education

Technology Report

Figure 4. Effect of temperature on molecular kinetic energy is plotted as temperature against rate of sulfur formation. Standard deviation corresponds to repeat experiments (n = 3). Exponential curve fit where 0.0025 exp(−0.0758x) + 0.0035R2 = 0.9999.

OLED display, an IR temperature sensor, and an LDR. Collectively, this hardware handles data logging of temperature and light measurements, displaying in real-time, and uploading to the Internet. This approach can be implemented and adapted into modern microcontrolled experiments where data needs to be transmitted wirelessly in a simple, powerful, and affordable manner.

The IR thermometer is used to record temperature. Both light and temperature data is sampled at an interval of 500 ms, with filtering applied to the LDR data (Supporting Information section 3.7), and both temperature and light data is periodically uploaded to the ThingSpeak channel. Both the LDR and temperature sensors are clamped against the reaction vessel filled with the reactants, Figure 2. The time taken to reach the turbidity maximum is indicated as an example in Figure 3. When the pipet is moved over the reaction vessel a shadow is cast upon the LDR indicating the pipetting of HCl into the reaction vessel. This is clearly indicated as a drop in voltage. The time difference between A and B is used to plot the graph. The plotted graph, Figure 4, shows 1/Time, s−1, against temperature, °C. This plot yields more qualitative information than a human eye color change approach. The rate of change can be measured from the graph slope or the time taken for a change to occur.27 The result provides useful information for increasing students’ conceptual understanding of reaction rates.



ASSOCIATED CONTENT

S Supporting Information *

The Supporting Information is available on the ACS Publications website at DOI: 10.1021/acs.jchemed.8b00200. Schematic of ESP-12E pin out, schematic of breadboard to ESP-12E wiring, figure of interpreting turbidity data, and C program code listings (PDF)





CONCLUSION The simple methodology laid out in this technology report provides wireless Internet connectivity to open-source laboratory hardware. This affords new opportunities to exploit combinatorial strategies in a wide variety of systems for both teaching and research laboratories. A classic chemical experiment is demonstrated involving the measurement of temperature and light data using a microcontroller. Turbidity data is sent over a wireless network to a cloud-based server that is then used to plot turbidity data. This new method of wireless data acquisition is cost-effective and does not require commercial software licenses. Because all data is sent to the ThingSpeak server, it is not necessary to have desktop computers in the laboratory. Details of how to program the microcontroller are provided along with the actual code used in this report. The hardware is composed of few parts, a microcontroller, an

AUTHOR INFORMATION

Corresponding Author

*E-mail: [email protected]. ORCID

Conan Mercer: 0000-0003-3508-696X Notes

The authors declare no competing financial interest.



ACKNOWLEDGMENTS

This work was supported financially by Science Foundation Ireland under the US/Ireland programme (Grant Number 13/ US/B2546). D

DOI: 10.1021/acs.jchemed.8b00200 J. Chem. Educ. XXXX, XXX, XXX−XXX

Journal of Chemical Education



Technology Report

(22) Hin-Fat, L.; Lee, H.-C.; Au-Yeung, K.-C.; Chan, H.-T. A simple electronic interface for wireless chemical data communications. J. Chem. Educ. 1988, 65, 344. (23) Yang, T.; Xie, D.; Li, Z.; Zhu, H. Recent advances in wearable tactile sensors: Materials, sensing mechanisms, and device performance. Mater. Sci. Eng., R 2017, 115, 1−37. (24) Fisher, R.; Ledwaba, L.; Hancke, G.; Kruger, C. Open Hardware: A Role to Play in Wireless Sensor Networks? Sensors 2015, 15, 6818−6844. (25) Stankovic, J. A. Research Directions for the Internet of Things. IEEE Internet Things J. 2014, 1, 3−9. (26) Gubbi, J.; Buyya, R.; Marusic, S.; Palaniswami, M. Internet of Things (IoT): A vision, architectural elements, and future directions. Futur. Gener. Comput. Syst. 2013, 29, 1645−1660. (27) Hutchings, K. Classic Chemistry Experiments, 1st ed.; Royal Society of Chemistry: London, 2001. (28) Espressif. ESP8266EX Datasheet; 2017. https://www.espressif. com/sites/default/files/documentation/0a-esp8266ex_datasheet_en. pdf (accessed May 2018). (29) See, H. H.; Hauser, P. C. Automated Electric-Field-Driven Membrane Extraction System Coupled to Liquid ChromatographyMass Spectrometry. Anal. Chem. 2014, 86, 8665−8670. (30) Urban, P. L. Universal electronics for miniature and automated chemical assays. Analyst 2015, 140, 963−975. (31) Walzik, M. P.; Vollmar, V.; Lachnit, T.; Dietz, H.; Haug, S.; Bachmann, H.; Fath, M.; Aschenbrenner, D.; Abolpour Mofrad, S.; Friedrich, O.; Gilbert, D. F. A portable low-cost long-term live-cell imaging platform for biomedical research and education. Biosens. Bioelectron. 2015, 64, 639−649. (32) Microchip Technology Inc. Atmel ATmega640/V-1280/V-1281/ V-2560/V-2561/V; 2014. http://www.atmel.com/Images/Atmel2549-8-bit-AVR-Microcontroller-ATmega640-1280-1281-2560-2561_ datasheet.pdf (accessed May 2018). (33) Davis, R. E. Displacement Reactions at the Sulfur Atom. I. An Interpretation of the Decomposition of Acidified Thiosulfate. J. Am. Chem. Soc. 1958, 80, 3565−3569. (34) Urakaev, F.; Bazarov, L.; Meshcheryakov, I.; Feklistov, V.; Drebushchak, T.; Savintsev, Y.; Gordeeva, V.; Shevchenko, V. Kinetics of homogeneous nucleation of monodisperse spherical sulphur and anatase particles in water-acid systems. J. Cryst. Growth 1999, 205, 223−232. (35) Ahn, H.; Whitten, J. E. Monitoring Particle Growth: Light Scattering Using Red and Violet Diode Lasers. J. Chem. Educ. 2005, 82, 909. (36) Das, I.; Das, S. S.; Pushkarna, A. A low-cost laboratory experiment using a nephelo-turbidity meter. J. Chem. Educ. 1987, 64, 729. (37) Maranhão, G.; Brito, A.; Leal, A.; Fonseca, J.; Macêdo, W. Using LDR as Sensing Element for an External Fuzzy Controller Applied in Photovoltaic Pumping Systems with Variable-Speed Drives. Sensors 2015, 15, 24445−24457. (38) Peiris, M. G. C.; Perera, I. K. A simple inexpensive photometer using light-dependent resistors. Am. J. Phys. 1987, 55, 1147−1147. (39) Abayaratne, C. P.; Bandara, V. A low-cost polarimeter for an undergraduate laboratory to study the polarization pattern of skylight. Am. J. Phys. 2017, 85, 232−238. (40) Wang, J.-M.; Lu, C.-L. Design and Implementation of a Sun Tracker with a Dual-Axis Single Motor for an Optical Sensor-Based Photovoltaic System. Sensors 2013, 13, 3157−3168.

REFERENCES

(1) Pearce, J. M. Building Research Equipment with Free, OpenSource Hardware. Science (Washington, DC, U. S.) 2012, 337, 1303− 1304. (2) Grinias, J. P.; Whitfield, J. T.; Guetschow, E. D.; Kennedy, R. T. An Inexpensive, Open-Source USB Arduino Data Acquisition Device for Chemical Instrumentation. J. Chem. Educ. 2016, 93, 1316−1319. (3) Pearce, J. M. Return on investment for open source scientific hardware development. Sci. Public Policy 2016, 43, 192−195. (4) Urban, P. L. Open-Source Electronics As a Technological Aid in Chemical Education. J. Chem. Educ. 2014, 91, 751−752. (5) Kubínová, Š.; Šlégr, J. ChemDuino: Adapting Arduino for LowCost Chemical Measurements in Lecture and Laboratory. J. Chem. Educ. 2015, 92, 1751−1753. (6) Siano, G. G.; Montemurro, M.; Alcaráz, M. R.; Goicoechea, H. C. Open-Source Assisted Laboratory Automation through Graphical User Interfaces and 3D Printers: Application to Equipment Hyphenation for Higher-Order Data Generation. Anal. Chem. 2017, 89, 10667− 10672. (7) Mabbott, G. A. Teaching Electronics and Laboratory Automation Using Microcontroller Boards. J. Chem. Educ. 2014, 91, 1458−1463. (8) Mercer, C.; Leech, D. Inexpensive Miniature Programmable Magnetic Stirrer from Reconfigured Computer Parts. J. Chem. Educ. 2017, 94, 816−818. (9) Jin, H.; Qin, Y.; Pan, S.; Alam, A. U.; Dong, S.; Ghosh, R.; Deen, M. J. Open-Source Low-Cost Wireless Potentiometric Instrument for pH Determination Experiments. J. Chem. Educ. 2018, 95, 326−330. (10) Papadopoulos, N. J.; Jannakoudakis, A. A Chemical Instrumentation Course on Microcontrollers and Op Amps. Construction of a pH Meter. J. Chem. Educ. 2016, 93, 1323−1325. (11) Meloni, G. N. Building a Microcontroller Based Potentiostat: A Inexpensive and Versatile Platform for Teaching Electrochemistry and Instrumentation. J. Chem. Educ. 2016, 93, 1320−1322. (12) Dryden, M. D. M.; Fobel, R.; Fobel, C.; Wheeler, A. R. Upon the Shoulders of Giants: Open-Source Hardware and Software in Analytical Chemistry. Anal. Chem. 2017, 89, 4330−4338. (13) Arrizabalaga, J. H.; Simmons, A. D.; Nollert, M. U. Fabrication of an Economical Arduino-Based Uniaxial Tensile Tester. J. Chem. Educ. 2017, 94, 530−533. (14) Warner, D. L.; Brown, E. C.; Shadle, S. E. Laboratory Instrumentation: An Exploration of the Impact of Instrumentation on Student Learning. J. Chem. Educ. 2016, 93, 1223−1231. (15) Li, Q.; Wang, F.; Wang, Z. A.; Yuan, D.; Dai, M.; Chen, J.; Dai, J.; Hoering, K. A. Automated Spectrophotometric Analyzer for Rapid Single-Point Titration of Seawater Total Alkalinity. Environ. Sci. Technol. 2013, 47, 11139−11146. (16) Thouron, D.; Vuillemin, R.; Philippon, X.; Lourenço, A.; Provost, C.; Cruzado, A.; Garçon, V. An autonomous nutrient analyzer for oceanic long-term in situ biogeochemical monitoring. Anal. Chem. 2003, 75, 2601−2609. (17) Forzani, E. S.; Lu, D.; Leright, M. J.; Aguilar, A. D.; Tsow, F.; Iglesias, R. a.; Zhang, Q.; Lu, J.; Li, J.; Tao, N. A Hybrid Electrochemical-Colorimetric Sensing Platform for Detection of Explosives. J. Am. Chem. Soc. 2009, 131, 1390−1391. (18) Mousazadeh, H.; Keyhani, A.; Javadi, A.; Mobli, H.; Abrinia, K.; Sharifi, A. A review of principle and sun-tracking methods for maximizing solar systems output. Renewable Sustainable Energy Rev. 2009, 13, 1800−1818. (19) Kennepohl, D.; Baran, J.; Currie, R. Remote Instrumentation for the Teaching Laboratory. J. Chem. Educ. 2004, 81, 1814. (20) Steinberg, M. D.; Kassal, P.; Kereković, I.; Steinberg, I. M. A wireless potentiostat for mobile chemical sensing and biosensing. Talanta 2015, 143, 178−183. (21) Famularo, N.; Kholod, Y.; Kosenkov, D. Integrating Chemistry Laboratory Instrumentation into the Industrial Internet: Building, Programming, and Experimenting with an Automatic Titrator. J. Chem. Educ. 2016, 93, 175−181. E

DOI: 10.1021/acs.jchemed.8b00200 J. Chem. Educ. XXXX, XXX, XXX−XXX