Blog

How to build a better bed: IoT and AI at the zoo

Share this post:

What do queues, zoos, and machine learning have in common? Watson IoT, of course! Marwell Zoo is building better beds for their animals with IoT and machine learning. Using Watson IoT Platform, the park’s keepers are working in tandem with IBM, designing a better way to reduce energy consumption. All while creating a more comfortable environment for the animals.

Harnessing machine learning to reduce costs and improve living conditions

Can machine learning be used to create better conditions for animals at Marwell Zoo? The question first emerged after Andy Stanford-Clark, CTO for IBM UK & Ireland, presented an introduction to Internet of Things at a UK Chamber of Commerce conference in February 2017.

Marwell Zoo is dedicated to the conservation of wildlife and other natural resources. The zoo aims to conserve species and their habitats, locally and globally, and advocates environmental and social responsibility in support of these goals. For these reasons, the Marwell sustainability team have embarked on a quest to improve the sleeping conditions for the animals. They want to provide the animals with more comfortable housing, while reducing energy consumption and cutting heating costs – without compromising habitat quality.

Marwell Hall and animals, courtesy of Marwell Wildlife.

Marwell Hall and animals, courtesy of Marwell Wildlife. 

Using technology to optimize the park’s heating system

Currently, Marwell Zoo uses infrared heaters installed above the bedding areas of many of their animal houses. On cold nights, the keepers turn the heaters on, leaving them on throughout the night. Typically, these 2 and 3kW heaters cost about £13p (roughly $0.17) per hour to run. When you add that up over the course of the year, the heating load jumps considerably from 100 kilowatts in the summer to over 300 kilowatts in the winter. Recognizing an opportunity to reduce energy consumption and expenses, Marwell staff are looking for an IoT solution using sensors. They want to detect whether an animal is present in the bedding area, then trigger the heating to be turned on or off, accordingly.

Aligning sleeping patterns using sensor data

The first task the team face is identifying the right type of sensor, They need one that collects the most useful data to help adapt a heating system to an individual animal’s sleeping patterns. The sensor needs to be able to detect when an animal is present in a bedding area, and then use that to decide when to turn the heating on. Conversely, when the animal moves away from the bedding area, the heating needs to be switched off after a few minutes. The end goal is to ensure the heating is turned on when the animal is sleeping within its enclosure. Heating an empty bed wastes energy and incurs unnecessary expense.

Previous attempts with infrared sensors unsuccessful

It’s not the first time the zoo attempted to solve this problem using sensors. The team tried using passive infrared sensors. Those are the type used in a burglar alarm system, that sit in the corner of a room, triggering when movement is detected. The problem with using motion detection, however, is not unlike what an office worker might experience when they sit still for too long in one place. The lights will turn off because the sensor stops detecting movement. Flashback to the mad arm-waving from your desk. The same situation occurs when an animal is sleeping in its bedding area. After falling asleep, the animal becomes motionless, the heaters would turn off – and the animal left exposed to the cold while sleeping within its enclosure.

“A-ha, I may well have a solution for you!”

Several weeks prior to the serendipitous meeting between Andy and Duncan East, the Sustainability Manager at Marwell Zoo, Andy installed a system at the Watson IoT headquarters in Munich to monitor congestion at the coffee bar. Using two thermal imaging sensors, each taking temperature readings at eight different spots, the sensor records sixteen temperature points from the area where people queue for drinks. By reflecting the data from the thermal sensors onto an LED display in the offices on the floor above the coffee bar, Andy can display how busy the coffee bar is, based on how many hot spots the sensors detect.

Given the popularity of the coffee bar, it’s not surprising to learn that the Munich office staff find this to be a welcome addition to the many IoT applications in the building. At a glance, any employee can clearly see how many of the LED lights are dancing around – indicating whether the coffee bar is busy. If too busy, staff might forgo their coffee break at that peak time – opting to leave their desk after the crush so they needn’t wait as long.

A lateral move from coffee queues to zoos

It is this recent project in Munich that Andy latched on to when Marwell Zoo contacted him. To make a portable version of the coffee queue monitoring system, Andy installed one of the thermal sensors, connected to an ESP-8266 Arduino-compatible microprocessor, in a small 3D-printed plastic box. This was connected to a Raspberry Pi using a micro-USB cable, and he used the 8×8 grid of LEDs on a SenseHAT add-on board on the Pi as a display. A Node-RED application running on the Raspberry Pi displays the 16 temperatures readings being detected by the thermal sensor as a heat map, updating once a second.

Prototype construction (ingredients):

  • Raspberry Pi
  • SenseHAT
  • 3D printed box
  • Omron D6T thermal sensor
  • Wemos ESP-8266
  • USB battery pack

Using the same principles from the Munich coffee bar, Andy points his portable prototype at an animal from outside the enclosure. Some of the LEDs on the Raspberry Pi display go from blue to red when an animal’s thermal footprint is detected. This indicates the sensor has registered that the temperature of the animal is hotter than the background.

Spurred on by the success of the modified coffee-bar prototype, the team brainstorms on how they can adapt this concept to suit the environment at the zoo. They agree that the thermal sensor should be mounted above the animals’ bedding, pointing downwards to get a 4×4 grid view. Essentially, it’s a square shape looking down on the animals’ sleeping quarters.

Practical considerations and design constraints

The thermal sensor has an effective range of two to three meters.The team estimates the height of a convenient wooden cross-beam to be about three meters. That’s high enough to avoid any disturbances from the animals, space to house the essential components, and easy access to essential services: power and WiFi. Other practical considerations include how to make the system sufficiently water-resistant. Whether it’s animals, or keepers cleaning out enclosures, splash proofing the electronics is important.

Setting up a trial period to gather data

Once the team accounts for these design-constraints, they turn their attention to connecting the system to a heater. Understandably, the team at Marwell Zoo doesn’t want to override the heating system until the innovative approach is proven effective. They suggest a trial period to gather data.

To test the system initially, Andy uses an infra-red camera, which is available for the Raspberry Pi, and a ring of infra-red LEDs to illuminate the scene with light that is not visible to humans (or nyalas). Using IBM Watson IoT Platform, Andy sends the 16 temperature readings from the sensor, over WiFi, up to the Watson IoT Platform once a second. The sensor data is then analyzed using a Node-RED application in the IBM Cloud. The first version of the analysis application uses a simple statistical method to see if there are hot-spots relative to the average background temperature.

Images from the Marwell Zoo IoT sensor test shows nyalas enjoying the evening.

Images from the nyala bedding trial phase, courtesy of Andy Stanford-Clark @andysc

How to train a neural net

The team is planning to train a neural net classifier based on the data that is being gathered to improve the animal recognition. Essentially, it’s a model that can decide whether the animal is there or not, based on the temperature readings. If the animal is just wandering past and not actually sitting down, then the heater should not be turned on. The algorithm uses a 30-second time-window and a range of likely percentages. For instance, anything higher than 75 percent of the readings would have to detect the animal’s presence before the heater is triggered to be turned on. When the system is confident an animal is present, it sends a control message to Watson IoT Platform saying, “Turn the heater on.” When it decides there are no longer any animals in the bedding area, it sends another message to turn it off.

For the trial period, instead of turning the actual heater on, the Raspberry Pi with its infra-red camera, takes photos to compile a repository of images which fall into three categories – On, Off, and Control. Every photo taken is sent over MQTT to the IBM Cloud, and placed into one of three folders in a file system:

  • On – a folder that contains images taken when the system would have turned the heater on. Photos in this folder should all show animals;
  • Off – a folder that includes photos taken when we would turn the heater off. None of the photos in this folder should have animals in them;
  • Control – a folder that contains photos taken at 30-minute intervals 24 hours a day to provide context and background knowledge of what’s occurring all the time.

From neural nets to Nyalas

Once the system is installed, it immediately starts taking photos in the nyala house. Nyalas are little deer-like creatures. Sometimes there is one animal in an image, and sometimes, six to ten. Despite the size of the animals and the low resolution of the thermal sensor, with some minor tweaks to the algorithm to make allowances for the number of “bright spots” in the sensor data, the team’s concept and prototype design appears to be working correctly. The photos being taken are getting routed to the right directories – ON, OFF and CONTROL.

To ensure the design concept is working, Andy monitors the system in real-time. He reviews the photos, watching what the Raspberry Pi is displaying based on what the sensors are detecting, reviewing how the algorithm is performing against the images. This is to ensure that the decisions the team’s algorithm is making – to turn the heater on or off at the right time – are correct based on the “ground truth” data. In this case, it’s the photos. This is where the control photos come in handy. They help the team to refine and tweak the algorithm.

Poppet, one of the nyalas at the Marwell Zoo, will sleep more comfortably and sustainably, thanks to Watson IoT

Poppet, one of the adorable nyalas at the Marwell Zoo.

Taking advantage of the Cloud

By using relatively inexpensive off-the-shelf components, and the flexibility and convenience of Watson IoT Platform and IBM Cloud, it was easy to build the prototype system. This enabled the team to test their concept.

A deliberate decision was made to keep the application logic very simple on the devices installed at the zoo: the thermal sensor and the Raspberry Pi camera. All the analytics were implemented in the Cloud. This gave the team the ability to tinker with the parameters for thresholds of whether the animals are present or not, try out new algorithms, and train and test the neural net model – all within the IBM Cloud. This avoids having to return to the zoo, schedule time with the keepers, to update the software on the devices in the enclosures.

Using the Cloud enables the team to make updates on the fly. In this case, it makes sense to keep the edge technology very simple. The clever and complicated stuff – the models, the algorithms, the logic, the image repository – might not work first-time. Keeping it all in the Cloud offers the flexibility to tweak things at any time.

Progressing to the next stage

So far, the Marwell Zoo team is extremely happy with the initial results of the project. They have access to the photos so they, too, can monitor the decisions being made based on the visual data in the photos. When the Marwell Zoo is confident the system is making the right decisions, they will proceed to the next stage. They will add a controller, another device connected to the Watson IoT Platform, to control a mains relay that will turn the heater on and off.

In the winter months, the team plans to incorporate data from an on-site weather station in the park. They will look at the ambient temperature at the zoo to decide if it’s cold enough to turn the heaters on during the day– based on the local weather conditions. Just because there are animals present, doesn’t necessarily mean the heaters needs to be on. On warmer, sunnier days, there might be no need to activate the heaters.

A scalable, sharable, and portable prototype

If the initial trial in the nyala enclosure works successfully, the Marwell Zoo team is hoping to roll the solution out to include many more of the animal houses at the zoo – possibly up to 40 enclosures. Marwell Zoo has been trail-blazing this novel solution. And if it is successful, there are other zoos interested in the outcome of the trial.

The long tail

Thinking through the long tail of the solution, there are other possible uses where these relatively inexpensive thermal sensors could be used. They could not only improve the habitats of the animals but also improve the experience for zoo visitors. For example, what if there was a way when animals were detected in their enclosure, to convey that information to visitors? Not only would the customer experience be better, the animals’ living conditions would be more natural. They could be viewed in a way that was not disruptive to their natural cycles of sleeping and waking.

Moving away from animals, what about other environments where thermal sensors could be used to detect a physical presence?Remote bus stops or train platforms could become more welcoming. Lighting and heating could be triggered if a thermal mass was evident. There are many other applications where detecting the presence or absence of people (and whether there are “a few” or “lots” of them) could trigger an action. Blackgang Chine theme park on the Isle of Wight is actively looking at their use for controlling interactive exhibits in innovative ways.

Learn more

In many ways, and for many types of creatures, the Internet of Things opens up new avenues for comfort, caring and cost savings. To learn more about Watson IoT, please visit: ibm.com/IoT

 

 

 

Add Comment
No Comments

Leave a Reply

Your email address will not be published.Required fields are marked *

More Blog Stories
By Luc Hatlestad on December 10, 2017

How AT&T migrated 40,000 users to IBM’s IoT solutions

Any telecom provider must always try to avoid network downtime. But to stay competitive these companies also must constantly upgrade their software and systems. So when AT&T decided to migrate more than 40,000 users to comprehensive IBM IoT solutions—to support internal software development and replace its existing disparate solutions—the company knew it was facing a […]

Continue reading

By Jen Clark on December 8, 2017

IoT weekly round-up: Thursday 7th December 2017

It’s been a little turbulent for all things internet and IoT-related this week. Fake feedback comments may delay the net neutrality vote, Volocopter aims to launch its flying taxis by 2020 and there’s a new service to help predict an impending Bitcoin crash. Read on for the latest from the connected world. Bitcoin Bubble Burst […]

Continue reading

By Wired Brand Lab on December 4, 2017

Product lifecycle re-imagined with IoT

Product life cycles used to be straightforward—manufacturers designed, built, and serviced. Now, with the IoT and software-enabled devices, the cycles have accelerated and even reversed themselves. The stakes are high, and it can be hard to know where to start. Almost every high-performing piece of equipment—from dishwashers to factory robots—has baked-in intelligence. Sensor-packed devices constantly relaying […]

Continue reading