top of page



IoT with MuleSoft: Implementing a Temperature Sensor using LED lights, Twilio, and a Raspberry PI

Hey Muleys,

In this post, I will explain how to implement IoT with a MuleSoft use case. I would like you to try out some new use cases and publish them. I hope this article helps you to implement them!

First of all, why should you use MuleSoft to implement IoT? Why not use other integration platforms? Quick answer: Ease of Integration and Speed of Delivery.

Let's dive in.

Make sure to watch the videos posted at the end of the article! You will get a full idea on how easy it is to implement IoT with MuleSoft.

What is IoT?

The Internet of Things (IoT) is the inter-network of physical devices, vehicles, buildings, and other items embedded with electronics, software, sensors, actuators, and network connectivity that enable these objects to collect and exchange data.

Simplified: IoT is about connecting software with hardware!

MuleSoft + IoT:

  • The Mule engine can be embedded directly into IoT devices, which enables data exchange for the devices by connecting to IoT cloud services and backend apps in the cloud.

  • The Mule Runtime engine can be used to expose APIs on any IoT device. Mule APIs can be deployed on IoT devices and turn them on and off.

  • In this article we will discuss about IoT and how it can be used with MuleSoft, and how Mule APIs can be deployed on IoT devices.

Use Case

When a user passes a receiver’s number in the URL, the receiver should read the current local temperature details to his mobile and on successful receiving of details on his mobile, a green LED light should be blinked. In case of any issue in receiving the details, the red LED light should be blinked instead.

How does it work internally?

When you hit this endpoint:

  1. The request is sent to the Mule application.

  2. The receiver’s number is stored in a variable.

  3. The Mule application connects to Raspberry PI (IoT device) and senses the temperature using a temperature sensor.

  4. The temperature is stored in a variable.

  5. The Mule application sends the details to the receiver’s mobile number using the Twilio Connector.

  6. If the data is received as expected, a green LED light is blinked, otherwise it will be a red LED light.

Let's cook the recipe

Required Software:

Required Hardware:

  • Raspberry Pi 3

  • Micro SD Card of 16GB

  • Ethernet Cable or HDMI cable (in this use case we are using ethernet cable)

  • Adapter Charger for Raspberry Pi 3: Available in electronic stores or any e-commerce websites as a combo.

I was able to find everything here.


  • 4k7 ohms (4.7k) - 1 (used for temp sensor)

  • 22k ohms: 2 in total (used for RED and GREEN LED lights)

  • Jumper wires: Male – Female (10 for safe side)

  • 1 Bread Board

  • Temperature Sensor: DS18B20 model

  • 1 red LED light

  • 1 green LED light