Code Samples and Projects

Quickly integrate and build IoT projects by using open-source code that we've already created. The code contained in the following samples, projects, papers, and even the UPM sensor library are open-source, available on GitHub*, and ready for you to implement.


UPM Sensor Library

UPM offers drivers for a wide range of over 400 supported sensors, actuators, and connectivity while making it easy to find code samples, sensor specifications, datasheets, and more.

Reference Implementations

Discover new technologies and capabilities through projects built with open-source code samples. Leverage what you learn to create your own IoT projects.

Implement a project using facial recognition as the basis of an access control system. The application will detect and register the image of a person’s face and grant or deny access accordingly.

Monitor the inventory, product sales, and maintenance of a vending machine. Use the Microsoft Azure* platform to provide cloud analytics and a communications hub for various parts of the solution.

Track the status of a home’s front door and garage door for increased security. The IBM Bluemix* platform provides a data store, cloud analytics, and a communications hub for parts of the project.

Environmental sensors monitor and track the air quality of a smart building. Sensor data is then transferred to the cloud using Amazon Web Services (AWS)*.

Track the temperature within a truck’s refrigerated cargo area, as well as the open or closed status of the cargo doors.

Code Samples

The following code samples are available in C++, Java*, JavaScript*, and Python*. Most can be used with AWS, Microsoft Azure, IBM Watson IoT* platform, and the Google Cloud Platform* service.

Access Control
Build an alarm system that detects when someone enters a secure area. The system requests an access code from the person via a web browser, and stores the access data on cloud-based storage. If the wrong code is entered, an alarm sounds.

Air Quality Sensor
Create an air quality sensor that continuously monitors the environment for pollutants and issues a warning sound when conditions become unhealthy. Contaminant data is stored on the cloud.

Alarm Clock
Build an alarm clock that can be set remotely via a mobile phone. The alarm clock also displays live weather data and tracks how long the user takes to wake up. Data is saved to the cloud.

Close Call Reporter
Build an app for fleet management that tracks close calls (near accidents) by combining an infrared (IR) distance sensor and GPS. Logs of close calls are kept in the cloud.

Color Match Game
Build a game where players match colors on an LCD screen with colors on the browser of a remote device. Progressive levels add more colors and complexity.

Create a smart doorbell that buzzes and displays a message when the Grove* Touch Sensor is pressed. You can also choose to store data using the example's datastore running in your own Microsoft Azure* account.

Earthquake Detector
Create an device that scans the three-axis digital accelerometer for indications of earthquake movement. Using the United States Geological Survey* API, it attempts to verify that an earthquake actually occurred.

Equipment Activity Monitor
Track equipment usage with a project that monitors sound and vibration sensors. It provides visual notification whenever the equipment is in use and logs data in the cloud.

Fire Alarm
Create a device that measures temperature and then sounds an alarm when the temperature reaches an unsafe level. Additional alerts are sent to the LCD display and optionally via text message. Event data can also be stored in the cloud.

Line-Following Robot
Build a robot that follows a drawn line using sensors and stepper motors. Event logs may be optionally stored in the cloud.

Plant Lighting System
Create a solution that can turn lights off and on using a programmed schedule, as well as keep track of moisture levels. This can be managed remotely via a mobile phone and optional text alerts.

Range Finder Scanner
Build an application that continuously measures distance using an IR distance interrupter. The sensor is mounted on a stepper motor that continuously rotates 360 degrees. Data can be accessed via a web interface.

Robotic Arm
Control a robotic arm using a thumb joystick where each axis of the joystick corresponds to a controllable motor. Additionally, control the motors individually via a web page.

Smart Stove Top
Create a web app to set the temperature and monitor a stove. Get notified when the temperature is reached. Also, store historical temperature data using cloud-based data storage.

Sound Detector
Monitor audio and volume data using a microphone sensor and access the data in the cloud.

Storage Unit Flood Detector
Create an application that uses a moisture sensor to continuously monitor a space and sounds an alarm when water is detected. Moisture events are noted and stored on a cloud-based storage system.

Watering System
This project follows a programmable schedule and uses a pump and flow meters to deliver precise amounts of water. The system can be managed by mobile phone and sends text alerts when it is not operating as expected. Watering data is kept in the cloud.