Here we'll show you how to use your phone as a remote control for your Samsung ARTIK. The video below shows a similar Arduino Yún sketch in action.
Your ARTIK can use text-to-voice to construct phone menus that can be used by you or anyone else to control your board from afar. With this power, your ARTIK can work as a remote monitor and call you when it wants your input, opening up a wide range of possibilities for applications that react based on remote user input.
This sketch uses a choreo from our Nexmo bundle.
1Make sure you have a Temboo account. If you don't already have one, you can register for free.
2If 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
/etc/ld.so.conf.d. Inside of
temboo.conf, you'll want to copy the line below and paste it into the file:
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 10.11.6.200 netmask 255.255.255.0 broadcast 10.11.6.255
3You'll also need a Nexmo account, which you can create here.
4After you've created your Nexmo account, retrieve your Nexmo API Key and API Secret to use later when you run the Choreo. You can find your Nexmo API Key and Secret in the API Settings menu on the top right of the Nexmo dashboard, as shown in the screenshot below.
The API Settings menu on the Nexmo dashboard
5Go to the Nexmo > Voice > CaptureTextToSpeechPrompt in our Library.
6Select "Samsung" from the drop down menu at the top of the Choreo page.
7Click Generate Code to test out the Choreo from our website. Confirm that your phone gets a call and that when you enter a number of the keypad, that number is returned as part of the Nexmo response in the Output section of the page.
Testing the Nexmo Choreo from our website
8Create a Profile from your Choreo inputs, so that you can refer to this Profile in your code - this will help save memory on your ARTIK board, and also lets you change the behavior of your application by editing the Profile on our website as opposed to editing your code.
9Using the visual pin board, click one of the ARTIK's pins to configure a digital actuator. Next, set an Actuator Trigger Condition for your digital actuator. Indicate that you want to set your actuator's digital pin to high if the user presses 1 on their keypad after receiving the phone call.
10When you've confirmed that the Choreo runs successfully and you've saved a Profile, you can download the auto-generated ARTIK code from the
Code section and move it to your device.
11The auto-generated sketch references the
TembooAccount.h header file, which contains your Temboo account information. You'll find the code for this file beneath the main auto-generated C code. Make sure to keep both files together on your ARTIK.
12Copy the downloaded zip file to your ARTIK board using
scp. From your computer, go to the directory where the zip file is located and type the command below. Make sure you use the IP address for your board you found using
[root@localhost ~]$ scp capturetexttospeechprompt.zip email@example.com:/home
13Now go to the capturetexttospeechprompt directory and compile your code and trigger a phone call from your ARTIK! Run the first command below to compile your code. After compiling has finished and no errors have been reported, run your program using the second command.
[root@localhost ~]$ gcc -L/opt/iothub/artik/temboo/temboo_artik_library/lib -ltemboo -I/opt/iothub/artik/temboo/temboo_artik_library/include capturetexttospeech.c -o capturetexttospeech [root@localhost ~]$ ./capturetexttospeechprompt
Note: If you get an error about cdefs.h not being found, this could mean your ARTIK board was not shipped with glibc-headers. This can be solved by reinstalling glibc-headers using the command below. After reinstalling glibc-headers, run the two commands above to compile and run your code.
[root@localhost ~]$ yum reinstall glibc-headers
When you've got this example working, you're in a position to build any number of applications that involve sensing information on the ARTIK and delegating control to a human when its time to make a choice about what to do next. Your IoT projects just got a whole lot smarter.
For anything to do with Temboo and how it works with your ARTIK, we're always happy to help. Just email us at firstname.lastname@example.org, and we'll answer you as quickly as possible.