Looking to create ‘the next big thing’? Look no further than TI's Maker and DIY community! Launch your design with TI's low-cost, community-supported development platforms. Begin rapid prototyping applications in minutes with our microcontroller-based LaunchPad kits, Sitara™-processor-powered BeagleBoards and SimpleLink™ wireless connectivity SensorTags.
I hate to admit it, but one of my biggest weaknesses is my vocabulary. What better way is there to try and improve my vocabulary than with an interactive Internet of Things (IoT) device? This project uses Texas Instruments hardware and services provided by Temboo, Wordnik, and Wolfram Alpha to retrieve and display a random word, then show the definition utilizing the built-in LCD screen on the Educational BoosterPack™ MKII. In this example we will be using two different API calls in the same project to really show the breadth of Temboo. The best part is since this project uses API calls and Wordnik's database, there is no onboard memory dedicated to storing a dictionary, and the list of words that can be retrieved is almost endless!
At this point I have used Temboo for a few projects, and it makes interacting with APIs so seamless and easy. Even when interacting with two APIs in the same program, there were not any unforeseen speed bumps. We will be using the Wordnik RandomWord Choreo in order to retrieve a random word and then pass this word to the Wolfram Alpha GetSearchResult Choreo. Because these are two different services, there is not always a Wolfram Alpha definition for the Wordnik word, but most of the time it returns a definition.
Wordnik is "world's biggest online English dictionary, by number of words" so what better resource is there to use when trying to learn new words? Go ahead and get set up with a Temboo account if you have not done so already. I go into a little more detail around the actual Temboo set up here if you run into any issues.
We will be using the RandomWord Choreo under the Words subsection of the Wordnik Choreos. Running this Choreo will require signing up with Wordnik and getting an API key. Once you get an API key, the Chore set up is very easy. Enter your API key on the Choreo page. For this project I edited the optional settings so that "HasDefinition" is set to "true" and "MinDictionaries" is set to five. This was in an attempt to maximize the number of words for which Wolfram Alpha would have a definition.
Once these settings are entered, the Choreo should be good to run. Test it in the web browser and make sure that you receive a random word back. The code provided through Temboo will now be able to retrieve a random word, but we want to do more with it. Make sure to save your Wordnik profile with Temboo with a memorable name as you will need it later. If you look at the randomWord.ino at the bottom of the page, you can see the process of parsing out the random word and then actually passing it to the Wolfram Alpha Choreo, which we set up in the next step.
We will be using the GetSearchResult Choreo from Wolfram Alpha, which returns the first search result for a query as text. Sign up for a developer account with Wolfram Alpha and and obtain an API key. After getting an API key, enter it into the GetSearchResult Choreo and search "define _____," filling in the blank with the word. Assuming Wolfram Alpha has a definition it should return the result to you in a text format. Again take a look at randomWord.ino and see how we parse out the first definition returned and pass it to the main function.
Setting up the LaunchPad™ development kit:
Now we will be using the LaunchPad kit to put all these Choreos to work. Download the randomWord.ino and open it in Energia. This code will require a few changes, but it is already set up to interact with the Educational BoosterPack MKII and the SimpleLink™ Wi-Fi®CC3100 BoosterPack. Line 153 requires you to enter the profile name under which you saved your Wordnik settings in Temboo. Line 206 requires you to enter your AppID from Wolfram Alpha. Trace through the code and see that when the user presses the S1 pushbutton on the BoosterPack, Temboo is triggered to retrieve both the random word and the definition. When the user then presses S2, the definition replaces the word. There are a few functions in the code as well to help with printing to the LCD such as midPrint which simply prints to the middle of the LCD screen and wordWrap which starts in the top left and prints line by line (it will continue to print off the screen if the definition is too long however).
Make sure you also have your TembooAccount.h in your Energia library folder and set up to match your Temboo and Wi-Fi credentials!
Once you have this project up and running you will be learning new words that you can work in casual conversation and impress everybody in no time!
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.