Wednesday Nov 27, 2013

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

So, that's a wrap everyone. Hope you enjoyed the Internet of Things (IoT) Thanksgiving Special: Turkey Tweeter!

Leave me feedback on this project in the blog comments (open for 1 week), if you used it for your holiday bird, or if you just followed along and had fun reading. It's good to hear if you ran into any problems or have any questions about using Java SE Embedded for your own Internet of Things project. (Tech support [me] will be open for a few hours tomorrow if you have issues, but response time will vary according to which football game is on) :-)

So remember: Java technology is a great way to rapidly develop your own IoT applications.

Also, send links to your Twitter accounts if you get them working from your Raspberry Pi. I'll be sure to follow your Twitter feed of your own Java SE Embedded IoT device, and be sure to follow mine at: https://twitter.com/iottweet

A very Happy Thanksgiving (and Happy Hanukkah) to all!

Here are the full steps to this project:
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)

Happy Turkey Tweeting!

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

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:
    https://dev.twitter.com/
 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: "+
			   tweetMessage);
	tweetStatus(tweetMessage);
    } else {               
	// Else, send regular temp update Tweet
	tweetMessage = "TurkeyTweeter "+timedateString+
	    ": Turkey is not done yet: "+
	    f+" degrees";
	System.out.println("Tweeting message: "+
			   tweetMessage);
	tweetStatus(tweetMessage);
    }
                
}

*** IMPORTANT ***

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)

About

Hinkmond Wong's blog on making Machine to Machine (M2M) and the Incredible Internet of Things (IoT) smarter with Java Embedded Technologies

Search

Archives
« November 2013 »
SunMonTueWedThuFriSat
     
1
2
3
4
5
7
8
9
10
11
12
13
14
15
16
17
19
20
22
23
24
26
28
29
30
       
Today