iotapp-water-management [] [] {"id":"water-management","title":"Water Management: Build an IoT application for water management","metaDesc":"Build a connected water management system that sends alerts when water levels are low and lets you refill water tanks remotely from a mobile device.","tweet":"I'm building an #IoT water management system with @temboo, and you should too!","device_count":"single","devices":{"arduinoyun":"Arduino Y\u00fan","samsung_artik_ten":"Samsung ARTIK 10","samsung_artik_five":"Samsung ARTIK 5"},"description":"Water resource management is becoming increasingly important. We've built a system that senses the water levels in a tank, calls you when water levels are too low and allows you to remotely refill from a reserve.","categories":["farming","water-management"],"choreos":{"CaptureTextToSpeechPrompt":{"uri":"Library\/Nexmo\/Voice\/CaptureTextToSpeechPrompt","templateName":"Nexmo","credentialDescription":"Nexmo allows your apps to directly connect to mobile carriers in over 200 countries. Integrate SMS and Text-to-Speech.","description":"Sends a Text-to-Speech message to the specified Number and captures keypad entries from the receiver.","credentialInputs":[{"name":"APIKey","type":"string","description":"Your API Key provided to you by Nexmo.","placeholder":"myNexmoAPIKey","callout":"Now you can add those credentials here to use with any of Temboo's Nexmo Voice Choreos."},{"name":"APISecret","type":"string","description":"Your API Secret provided to you by Nexmo.","placeholder":"myNexmoAPISecret"}],"inputs":[[{"name":"To","type":"string","description":"Phone number in international format and one recipient per request.","placeholder":"The phone number of the phone that should receive an alert."},{"name":"Text","type":"string","description":"Body of the text message.","text":"Hi there, the water tank is low. Press one to fill the tank.","callout":"You can edit this message in your code to say anything you like."},{"name":"MaxDigits","type":"integer","description":"Number of digits entered by the end user. Valid values are 1-9. Defaults to 1.","placeholder":"1"},{"name":"ByeText","type":"string","description":"Body of the text message played after digits are entered. (with a maximum length of 500 characters).","placeholder":"Ok. Filling the water tank now."}]]},"GetWeatherByAddress":{"uri":"Library\/Yahoo\/Weather\/GetWeatherByAddress","templateName":"Yahoo","description":"Retrieves the Yahoo Weather RSS Feed for any specified location by address.","inputs":[[{"name":"Address","type":"string","description":"The address to be searched.","placeholder":"New York, NY"}]]}}}

Water resource management is becoming increasingly important. We've built a system that senses the water levels in a tank, calls you when water levels are too low, and allows you to remotely refill from a reserve.

We'll show you how to build it.

Liquid Level Sensor
We're using 12" eTape
Water Pump
TIP120 Transistor
Water Storage
Like this large tank
Water Reserve
Like this drum


  • 560 Ohm resistor
  • 12v battery pack
  • 8 AA batteries

First, you'll need to create a Nexmo account.

Sign up for your free account before continuing.

Next, find your API Key and Secret.

They're in the API settings menu in your Nexmo Dashboard.

Connect the 3.3v power and ground of your board to your breadboard.

When water level falls below a specified threshold, the Nexmo phone-call alert will be triggered.

We'll add some smoothing to our data in the final code by looking at the average of the last 10 readings.

Connect the second pin of your liquid level sensor to
through a 560 Ohm resistor.

Connect the third pin of your liquid level sensor to ground.

When "1" is pressed on the phone touch-pad, the pump will turn on until the water is refilled.

We'll add a condition in our code that turns the pump off when the water tank is full.

Connect the ground of the water pump to the Collector pin of the TIP120 Transistor.

Connect the Base pin of the TIP120 Transistor to

Connect the Emitter pin of the TIP120 Transistor to ground.

IMPORTANT! Never connect the positive side of the 12v power source to your board. If connected improperly, your board will have a new career as a door stop.

Connect the ground of the 12v power supply to the same ground as your board.

Connect the positive end of the 12v power supply to the rail with the power end of the pump.

Need help running the code?

Install for Samsung ARTIK

If this is the first time using Temboo, you'll need to set up your ARTIK board to find the Temboo libraries. To do so, you'll need to create the file temboo.conf in /etc/ Inside of temboo.conf, you'll want to copy the line below and paste it into the file:


After saving temboo.conf, run ldconfig from the command line to add the Temboo library directory to the system library search path.

You’ll also need to get the IP address of your ARTIK board using ifconfig. The example below shows the results when the ARTIK board is connected to the internet through an ethernet cable. The IP address you'll want to use is listed next to inet.

[root@localhost ~]$ ifconfig
eth0: flags=4163  mtu 1500
inet  netmask  broadcast

Run the code

Download and unzip the IoT Application file. In your IoT Application folder, you'll find a Samsung folder containing the WaterManagement folder with code for the Artik. Copy the Samsung folder to your ARTIK board using scp. From your computer, go to the directory where the Samsung folder is located and type the command below. Make sure you use the IP address for your board you found using ifconfig.

[root@localhost ~]$ scp -r WaterManagement

Now cd into the directory on your Artik where you placed the folder and and compile and run your code using the command below.


Need help?

We're always happy to help. Just email us at, and we'll answer your questions.

Install for TI LaunchPad

Open the .ino file with Energia. While the sketch is running, open the Serial Monitor and you should see your app running.

Congratulations! Now that you know how to make your LaunchPad run any Choreo, you're just a few steps away from making something extraordinary.

You can find more examples of how to use Temboo with your LaunchPad here.

Need help?

We're always happy to help. Just email us at, and we'll answer your questions.

Run the Sketch and rejoice

Save and upload your sketch to the Arduino Yún, and open the serial monitor.

Congratulations! You've just run an IoT Application. With Temboo handling all the small stuff, you're free to think big.

You can find lots of examples of how to use Temboo with your Yún here.

Need help?

We're always happy to help. Just email us at, and we'll answer your questions.

Running the iOS Application

Make sure you have the latest Xcode, which can be downloaded here.

Download the Code

Download the code at the link above.

Unzip the files where you can find them. You should see one folder containing the iOS code, and another containing the hardware device code.

Open the Xcode Project

Locate the .xcodeproj file in the iOS code. Open the file with Xcode and you should see all of the accompanying files in the Project navigator.

If the file titles in your Project navigator are red, you'll need to relink them by clicking control and selecting "Add Files to ", then select and add all of the files from the iot application folder contained in the iOS folder you downloaded. Control click and delete any of the unlinked files that appear in the Project navigator.

Download the iOS SDK

The latest Temboo iOS SDK can be downloaded here. Save and unzip it to a folder where you can find it.

Once again, you'll need to control-click on the top-level folder in your Xcode Project navigator. Select "Add Files to " and browse to where you saved the Temboo SDK, locate and click on the "core" folder inside the SDK "src" folder. Make sure that "copy items if needed" is unchecked and "Create groups" is selected, then and select "Add".

Repeat the above steps to add the appropriate files located in the SDk's src/library folder.

Run the App

Make sure you have a device selected in the simulator, and click the run button.

Congratulations! You should see the app displayed in the simulator window. Go ahead and try it out, and you should see the Choreo results printed to the console.

Need help?

We're always happy to help. Just email us at, and we'll answer your questions.