Ever been in a situation where you are working in the garden and someone rings the bell at your door, but you couldn't hear it? If yes, then this experiment is definitely for you.
This experiment will trigger the text-to-speech asset on your Android when someone presses the push button.
It demonstrates how you can connect hardware, configure a condition based rule (when-that-then-this) and how to integrate an Android device as an IoT device with the SmartLiving platform.
The Building Plan
All Ingredients you need for this project can be found in the SmartLiving IoT starter kit for Arduino.
- Attach Grove shield on the Arduino Ethernet board
- Connect the Grove push button sensor to the D8 Grove connector on the shield
- Connect the ethernet cable to your Arduino
- Connect the power supply to the mains and your Arduino board
- Connect the Arduino to your computer using the USB2Serial adapter and USB cable
Create Your Device
Next, we create a device in the SmartLiving cloud which represent the Arduino.
SmartLiving provides you a freemium account for your hobby projects. You can sign up your account on http://beta.smartliving.io. After you have create your account :
- Log in in the SmartLiving Web App
- Click on the Devices icon in the Left menu
- Click on the “+” sign on the right side of the window to create a new device
- Enter a valid Device name. The device is now created
When you click on your device, on the right side of the screen, you will see your Device Id, Client Id and Client Key which you will need to enter these in your Arduino sketch.
Upload the Arduino sketch
Download the Doorbell_notifier sketch in the experiments folder in the arduino-client on Github.
Download it here (https://github.com/allthingstalk/arduino-client).
- Replace the text between Quotes with your Device Id, ClientId and ClientKey
Test your Arduino setup
It’s time to test the first part of the experiment. Head over to the web app:
Click on the push button asset in the web app
- You should see a widget representing a toggle button. When you change the position of the toggle button,the vibration motor should turn ON and OFF
Download & Configure the Android Makers App
The SmartLiving makers App turns your SmartPhone into an IoT device. The App includes a service which sends and receives data from assets on your Android device towards the SmartLiving Cloud, as with the Arduino.
The App allows you to configure assets which are physically present on your smartphone, as well as virtual assets which are software based. For this experiment we will just use the Talker asset.
More information about the Makers Mobile App and how to install it can be found in the getting started guide.
Once you've downloaded the app you can log in and configure the assets we need.
- Log into the Makers Mobile App on the Android device using your SmartLiving Account.
- On the My Devices screen, select your Android Device (you should recognize it by it’s name/model of your device), you should then be presented with the local assets screen:
-
Click on the add icon(+) displayed on the screen, you're now presented with a list of assets which are available on your device
- Select the Talker asset
- Click return to exit the setup dialog, your Talker asset is now enrolled
- Select your Android device or refresh the page if you're already on it
- Verify that the Talker asset has been added under your the list of assets
Configure a rule between the Arduino and Android
The last part of this experiment we will create an automation rule which will send a command to the talker when the push button is pressed.
For this we will use the rule wizard in the SmartLiving Web App. The rule wizard allows us to configure condition based triggers between assets and services.
Test the experiment
It’s time to test the experiment. Push the button on the Arduino. Your android device should pronounce the text string that you have entered in the rule.
Did it work? Yes? Great! You just your own IoT project!
Comments