Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Using Mule Runtime to Light an LED Bulb [Video]

DZone's Guide to

Using Mule Runtime to Light an LED Bulb [Video]

This quick and easy video tutorial will show you how Mule Runtime can expose microservices and APIs on IoT devices.

· IoT Zone
Free Resource

Discover why Bluetooth mesh is the next evolution of IoT solutions. Download the mesh overview.

MuleSoft’s lightweight Runtime Engine can be used to expose microservices and APIs on any IoT device. In this post, I will demonstrate how users can use MuleSoft and a Python script to create a simple API that lights up an LED bulb 10 times in a loop. To get started, please refer to the requirements, video tutorial, and steps below.

Requirements

Raspberry Pi 3, LED Bulbs, resistors, jumper wires, Mule server, and a breadboard.

Git Repository

Mule IoT LED Project

Video Tutorial


Project Steps

1. Build the LED blink project:

  • Set up your Raspberry Pi and make sure it is running and that you can SSH into it using an IP (preferably a static IP).
  • Ensure the Raspberry Pi is connected to the Wi-Fi router (Wireless or LAN cable)

 2. Install Mule on Raspberry Pi:

  • Install the Mule server in Raspberry Pi. It should be up as an instance, or as a service.

3. Create a Python script with GPIO commands:

  • Write a Python script that can control GPIO commands to blink the LED bulb, which should be connected with the proper resistor and jumper wire to Raspberry Pi.

4. Create a Mule app and call the Python script in localhost (Raspberry Pi):

  • Deploy the Mule app in your Raspberry Pi. Make sure it is able to call the Python script to blink the LED bulb.

5. Create a proxy app on a client machine, and call the Mule Raspberry Pi app using the Raspberry Pi IP address through the RAML Console:

  • Call the Mule app running on Raspberry Pi from another client machine through a REST RAML-based API on the static IP (Raspberry Pi IP address).

6. Expose REST API endpoints by making the Raspberry IP address public:

  • Finally, configure the Raspberry IP address as public, enabling you to access it from any location and at any time.

As this demo has demonstrated, MuleSoft’s Runtime Engine can be used in a way to connect various devices, data, and applications and, in the process, expose IoT services to the outside world.

Take a deep dive into Bluetooth mesh. Read the tech overview and discover new IoT innovations.

Topics:
iot ,raspberry pi ,mule runtime ,led ,tutorial

Published at DZone with permission of Anshu Mishra, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}