Hinkmond Wong's Weblog

Internet of Things (IoT) Thanksgiving Special: Turkey Tweeter (Part 5)

Guest Author

It's time to pull this all together and wrap it up. Now, that you have your Twitter developer app ready from Part 4, you just need to make your Twitter app "Read and Write" enabled and then copy over the secret app information to the TurkeyTwitter.java source code (fill in variables near the top of the file) which I included a pointer to the entire compilable source file. See: file

To make your Twitter app "Read and Write enabled:

 1. Go to your Twitter app account by signing
in with our Twitter login info:
2. Select your account icon -> My Applications
3. Click on your Twitter Turkey Tweeter app
from Part 4.
4. Click on the Settings tab
5. In the section "Application Type Access:",
select "Read and Write"
6. Check the box for "Allow this application
to be used to Sign in with Twitter"
7. Click "Update this Twitter's app settings"
8. Click on the Details tab
9. Refresh your Web browser
10. Make sure the Access level says:
"Read and write"
11. Copy the Twitter app information from this
page into the TurkeyTweeter.java app (Java
variables near the top of the file):
OAuth setting: Consumer Key
OAuth setting: Consumer Secret
Access token: Access token
Access token: Access token secret

Download the TurkeyTweeter.java app from: https://java.net/projects/orbit/downloads/download/TurkeyTweeter.java

After you entered your Twitter app secret information, adjust the source code timePeriod for how often you want your TurkeyTweeter to send update message (default is every 120 seconds), then compile the Java source file with javac and test this way:

  javac TurkeyTweeter.java
java -cp . TurkeyTweeter test

You should see a test "Hello World!" tweet get posted to your Turkey Tweeter account from Part 4. Here is my Turkey Tweeter account that I'll be using which you can follow along as my turkey tweets: https://twitter.com/iottweet

Here's the code from the TurkeyTweeter.java app that sends the Tweet:

// Check if mod every period to send tweet of current temp
if ((loopIndex % timePeriod) == 0) {
String tweetMessage = null;
// Check if done, then send special Tweet
if (f > maxTemp) {

tweetMessage = "TurkeyTweeter "+timedateString+

": Time to eat! Turkey is done: "+

f+" degrees";

System.out.println("Tweeting message: "+


} else {

// Else, send regular temp update Tweet

tweetMessage = "TurkeyTweeter "+timedateString+

": Turkey is not done yet: "+

f+" degrees";

System.out.println("Tweeting message: "+




Using your heat reflective tape from Part 1, make sure to tape all sides of the black plastic handle of the Vernier Go!Temp temperature probe and keep wrapping up the length of the black USB cable. Make sure none of black plastic or black cable is exposed especially on the handle. The only part that will be in the oven will be the Go!Temp probe itself in the turkey and part of its USB cable that runs out the oven door, so make sure all the black plastic and black cable is properly taped up with heat reflective tape to ensure it will not melt or catch on fire. The metal probe tip should remain exposed and will be mostly inserted into the turkey.

IMPORTANT: The Raspberry Pi must remain outside the oven on a cool counter top or table nearby your oven door. The Go!Temp probe metal portion of the probe must be inserted into the meatiest part of the turkey thigh without hitting any bone. Use a sharp knife to start a pilot hole for the Go!Temp probe if needed. Make sure the Go!Temp metal probe is securely in place in the thigh meat (not touching bone), then run the taped up USB cable that has been wrapped with heat reflective tape out the oven door to the outside counter top or table where the RPi is plugged into a power outlet and is properly networked to the Internet.

You are now ready to start your app.

Start the app with the following command:

  java -cp . TurkeyTweeter

You should see it report to the RPi shell terminal the current temperature every second and also it should tweet to the Twitter account every timePeriod (default 120 seconds).

That's it! You are now using the TurkeyTweeter to tweet your delicious Thanksgiving turkey as it roasts.

Hope you had fun ready this IoT Thanksgiving Special as much as I had fun blogging about it! And, Happy Thanksgiving!

See the full series on the steps to this cool demo:

Internet of Things (IoT) Thanksgiving Special: Turkey Tweeter (Part 1)

Internet of Things (IoT) Thanksgiving Special: Turkey Tweeter (Part 2)

Internet of Things (IoT) Thanksgiving Special: Turkey Tweeter (Part 3)

Internet of Things (IoT) Thanksgiving Special: Turkey Tweeter (Part 4)

Internet of Things (IoT) Thanksgiving Special: Turkey Tweeter (Part 5)

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.