Friday, June 9, 2017

Affordable robots in environmental science

            Let me start with some questions. Have you lost all samples in a freezer because of power outrage? Have you made your family unhappy (or happy) because you spend more time with laboratory rats? Have you failed to collect soil samples after a long boat trip because of unpredicted high water levels? Have you found out that super high phytoplankton production was caused by your advisor accidentally turning on a light during dark cycles?

            It is not uncommon to hear these kinds of unfortunate events from fellow scientists. It looks almost inevitable for biologists to avoid them because nature is full of surprises and that’s why we love studying biology! But would it be nice if you had a robot preventing unwanted events from happening? In addition, it would be even better if a robot is easy to program, make, and, most importantly, affordable. We tend to think that a robot is an intelligent object with arms, legs, or at least blinking eyes like a Disney character Wall-E. But the definition of robot on Wikipedia is rather simple: “A robot is a machine… capable of carrying out a complex series of actions automatically.” Thanks to a boom of open-source platforms, we can make a robot under $10.

            You may hear about an open-source which is freely available and sometimes supported by thousands of users who are willing to improve by fixing bugs or adding features. For example, R Studio is an open-source computing software. But we need electrical platforms (i.e., computer) to build a robot. Let me introduce a small, light, affordable, powerful, and, new generation computing platform called Arduino (Fig. 1). 
Fig. 1 Open-source platforms. Left: open-source micro-controllers, Arduino and Raspberry Pi. Right: sensors and displays: Clockwise from top-left: temperature, sound, magnetic, flame, gas, distance sensors, wires, LCD display, motion sensor, camera, and another display. We can use a breadboard (the white board with many holes) for an easy wire connection.    

            Arduino is an open-source micro-computer that can read inputs and send outputs. For examples, a combination of Arduino with a sensor and a communication device can detect a change (input), activate a physical device (output), and report programmed messages on the web, email, your phone, or Twitter (output). If you can make a formula on Excel, you are coding already. To help you understand a function and capability of Arduino, I will share my recent project below (Fig. 2):
  • Project: Chloe’s pulse monitor
  •  Purpose: I want to examine Chloe’s heartbeat in response to the sight of different objects such as a treat or a cat. Her pulse will be continuously collected on the cloud service and analyzed for detecting an unusual pattern of Chloe’s pulses. If her heartbeat is unusually high, I want to be notified remotely.
  • Materials: Dog, cat, treat, Particle Photon (Arduino with Wi-Fi capability) (https://store.particle.io), pulse sensor (https://pulsesensor.com), battery, Thingspeak (open-source cloud service) (https://thingspeak.com), IFTTT (open-source notification service) (https://ifttt.com), cell phone
Fig. 2 Chloe’s pulse monitoring methods and results. Left: Pulse sensor is attached to Chloe’s chest and connected to a Wi-Fi-enabled micro-controller. Right: Screenshot of a code which is uploaded to the micro-controller via Wi-Fi.    


            Chloe’s pulse turns out to be a reliable variable to measure her status/conditions (Fig. 3). When I showed her a chicken treat (the first peak), her pulse went up and dropped rapidly within 40 seconds. When she saw a cat (the second peak), her pulse went up and dropped gradually for more than 2 minutes. Indeed, the sight of a cat infuriated Chloe so much that Chloe spit out the treat and almost ran into the window! If I have more data and can find a correlation between pulse patterns and her behaviors, I would be able to tell more about Chloe’s status/conditions remotely. Can you think of other applications with the same robot? What other sensors would you add to monitor new variables? What other communication methods would be appropriate for different purposes (e.g., radio frequency, Bluetooth, Wi-Fi, Telephone system (SMS), or Internet (TCP/IP))?  
Fig. 3 Chloe’s pulse monitor. Left: Her pulse is collected and reported on Thingspeak cloud service every 20 seconds. Note the differences in the magnitude and duration of high pulses after she saw a treat and a cat. Right: Every time her pulse goes higher than 700 (unitless) for more than 1 minute, IFTTT service sends a notification on my phone.    

            I have used a series of micro-controllers and off-the-shelf electronics (e.g., pumps, valves) to simulate saltwater intrusion in natural wetlands (Fig. 4). A waterproof ultrasonic distance sensor is used to measure water levels in the creek where the main pumps were located. Creek water is delivered into water tanks and premade brine water is delivered into one of tanks to prepare brackish water every high tide. During low tide, the water is gravity-fed through solenoid valves and meters out to each plot. The entire system consists of 5 pumps, 10 solenoid valves, 2 flow meters, 4 sensors, solar panel, 3 large tanks, and Arduinos at a cost of $1800 (Lee et al. 2016. Link: http://link.springer.com/article/10.1007/s13157-016-0801-4). Not bad price, isn’t it? 
Fig. 4. Left: The PVC manifolds and electronics layout inside the weatherproof box. Middle: I was carrying the brain of the system in a waterproof box. Right: Experimental plots laid out in two rows with the platform containing the holding tanks and electronics in the center.    

           
          I like to finish with an inspiring quotation: “Logic will get you from A to B. Imagination will take you everywhere.” If you can build a robot, you will be able to test almost anything you can imagine. Happy making!