Wednesday Nov 27, 2013

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 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 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 app from:

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:

  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:

Here's the code from the 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)

Friday Jan 11, 2013

Tudo de bom with Raspberry Pi, Arduino, Robot Servos, and Java Embedded Suite

Vinicius Senger, Bene, and Yara were here at Oracle Santa Clara to give their demo of a Raspberry Pi and Arduino board connected to a robot, all controlled by Java Embedded Suite.

Here's a video of him with the same demo in Brazil. He's speaking in Portuguese, but you can get the gist of what he's saying. I can understand: "Rahsp-berry Peye". :-)


Sweet! RPi Robot w/Java Embedded Suite

Jump to timestamp 1:45 to see the awesome cool hardware he used with Java Embedded Suite.

Cool stuff, Vinicius, Yara, and Bene! Please come back again to demo more of your future work!

Wednesday Dec 12, 2012

RPi and Java Embedded GPIO: Big Data and Java Technology

Java Embedded and Big Data go hand-in-hand, especially as demonstrated by prototyping on a Raspberry Pi to show how well the Java Embedded platform can perform on a small embedded device which then becomes the proof-of-concept for industrial controllers, medical equipment, networking gear or any type of sensor-connected device generating large amounts of data.

The key is a fast and reliable way to access that data using Java technology. In the previous blog posts you've seen the integration of a static electricity sensor and the Raspberry Pi through the GPIO port, then accessing that data through Java Embedded code. It's important to point out how this works and why it works well with Java code.

First, the version of Linux (Debian Wheezy/Raspian) that is found on the RPi has a very convenient way to access the GPIO ports through the use of Linux OS managed file handles. This is key in avoiding terrible and complex coding using register manipulation in C code, or having to program in a less elegant and clumsy procedural scripting language such as python. Instead, using Java Embedded, allows a fast way to access those GPIO ports through those same Linux file handles.

Java already has a very easy to program way to access file handles with a high degree of performance that matches direct access of those file handles with the Linux OS. Using the Java API lets us open the same file handles that the Linux OS has for accessing the GPIO ports. Then, by first resetting the ports using the unexport and export file handles, we can initialize them for easy use in a Java app.

            // Open file handles to GPIO port unexport and export controls
            FileWriter unexportFile = 
                    new FileWriter("/sys/class/gpio/unexport");
            FileWriter exportFile = 
                    new FileWriter("/sys/class/gpio/export");
            // Reset the port
            File exportFileCheck = new File("/sys/class/gpio/gpio"+gpioChannel);
            if (exportFileCheck.exists()) {
            // Set the port for use

Then, another set of file handles can be used by the Java app to control the direction of the GPIO port by writing either "in" or "out" to the direction file handle.

                // Open file handle to input/output direction control of port
                FileWriter directionFile =
                    new FileWriter("/sys/class/gpio/gpio" + gpioChannel + 
                // Set port for input
                directionFile.write("in");  // Or, use "out" for output

And, finally, a RandomAccessFile handle can be used with a high degree of performance on par with native C code (only milliseconds to read in data and write out data) with low overhead (unlike python) to manipulate the data going in and out on the GPIO port, while the object-oriented nature of Java programming allows for an easy way to construct complex analytic software around that data access functionality to the external world.

      RandomAccessFile[] raf = new RandomAccessFile[GpioChannels.length];
      // Reset file seek pointer to read latest value of GPIO port
      inLine = new String(inBytes);

It's Big Data from sensors and industrial/medical/networking equipment meeting complex analytical software on a small constrained device (like a Linux/ARM RPi) where Java Embedded allows you to shine as an Embedded Device Software Designer.

Monday Oct 15, 2012

Unboxing Raspbery Pi for Java Embedded Prototyping

My new Raspberry Pi is here! My new Raspberry Pi is here! Finally. Darn, it sure took long enough being out of stock for so long. You can see here (left) some shots of the unboxing of my Raspberry Pi.


Unboxing Raspberry Pi

Next up: load it with Java Embedded...

Friday Oct 12, 2012

Oracle moves to Java technology to embedded middleware

Here's another article pointing out our move to Java Embedded Middleware with our launch of Oracle Java Embedded Suite 7.0


Oracle moves to Java embedded middleware

Here's a quote:

 At the JavaOne Embedded conference, a 
 wafer thin embedded device that was 
 smaller than a Ritz cracker was loaded 
 up with the Java Embedded Suite.
I like that: "a wafer thin embedded device". Just one thin wafer. Reminds me of the scene from Monty Python's, The Meaning of Life. "Better?"

Monday Jun 25, 2012

Today's The 4:30 movie: Java vs. C++

Here's a slide show that's paraphrasing Cameron Purdy's presentation on how Java technology has and hasn't supplanted C++.


Why Java Has/Hasn't Won vs. C++

Here's a quote:

 This eWEEK slide show borrows 
 from Purdy’s arguments and 
 looks at 10 reasons Java was 
 able to supplant C++, as well 
 as five reasons or areas it 
 was not.
It's like Godzilla vs. Mechagodzilla. Can there really be a clear winner? Well, stick around and watch Godzilla vs. Mechagodzilla II on tomorrow's The 4:30 movie as Monster Week continues on WABC, and find out...

Monday Jun 18, 2012

New Java Tutorials Updated

The new Java Tutorials are here! The new Java Tutorials are here! So what? So, you can read them on your iPad thingie--if that's how you roll, that is...


Read New Java Tutorials

Here's a quote:

 What's New

 The Java Tutorials are continuously 
 updated to keep up with changes to the 
 Java Platform and to incorporate 
 feedback from our readers. Recent 
 updates include the following 

    The Generics lesson has been 
    completely reworked...

    The Java Tutorials are now 
    available in two ebook formats:
        mobi ebook files for Kindle.
        ePub ebook files for iPad, 
        Nook, and other eReaders that 
        support the ePub format.
Just kick back, open up your favorite tablet or eReader and learn all about the new things in the Java platform. Nice. All you need now is a cool drink and you're all set!

Thursday Mar 08, 2012

Just like the Energizer Bunny, Java tech keeps going and going...

Is Java technology the next Cobol? Fat chance while former Sun engineers still work and breathe here at Oracle. Here's a Web article at The Register which talks about Java versions 8, 9, and 10 which are in the works.


Next versions of Java: 8, 9, 10

Here's a quote:

 JDK 8 will see the Standard Edition 
 of Java (Java SE), which is built 
 for the desktop, updated to run on 
 the kinds of mobile devices that 
 would currently run Java Mobile 
 Edition (Java ME). Oracle believes 
 multi-core and availability of 
 hundreds of megabytes of memory 
 on chips used in smartphones means 
 Java SE can now run on such phones 
 instead of just the desktop.
Hear that Google? Android customers are going to want Java versions 8, 9, and 10. Break out the checkbook. It's licensing time. :-)

Tuesday Mar 06, 2012

Kill bad-*ss demons with Java tech-enabled RuneScape online game

Did you ever want to test your sword skills against a huge evil-looking red demon with fangs, curled horns, and a scimitar that could cut you in half with one swipe? Yes? Weirdo. Oh, I mean, cool, here's the game for you! RuneScape by Jagex.


Play RuneScape on Java

Here's a quote:

 Join the over 135 million users 
 who have already discovered 
 RuneScape, become an adventurer, 
 explore this spectacular world, 
 face hundreds of enemies, and 
 complete challenging quests – 
 all in amazing high detail 
 graphics. RuneScape + Java: 
 Bringing you an immersive 
 gaming experience...
Test your massive-multiplayer online (MMO) game skills today in RuneScape, and see if you can kick some demon-*ss. It's fun and you're doing a good service for the heavenly world.

Friday Mar 02, 2012

New delicious cookbook to cook yourself some Java 7 features

Here's a new book and e-book that discusses the new features in the Java 7 release.


Java 7 New Features Cookbook

Here's a quote:

 Packt is pleased to announce the 
 publication of Java 7 New Features 
 Cookbook, a new book and eBook 
 aimed at understanding all the new 
 exciting features Java 7 has to 
 offer with a very practical recipe-
 based approach.
Remember to ask Google when they will have all these new juicy Java 7 features on their Android phones. We are waiting here with a license for Larry & Sergey to sign with some very attractive terms... ;-)

Wednesday Oct 26, 2011

Modernizing Java ME technology, with an "s" instead of a "z"

Here's an article from the UK that talks about how Oracle "modernises" (no time to spell it with a "z", so use an "s" instead like they do in Great Britain) the Java ME Platform.


Modernising Java ME

Here's a quote:

 Adam Messinger, Vice President of 
 Development on Oracle Fusion 
 Middleware, said in a statement, 
 "We are very excited about the 
 future of Java ME, which will 
 further extend the world’s 
 leading application platform for 
 mobile and edge devices and offer 
 increased opportunity for both 
 Java developers and mobile 
Well, however you spell "modernises", it's a fact that Java ME technology keeps getting better every year. Tomato, tomahto. Potato, potahto.

Monday Oct 10, 2011

JavaOne 2011: Technical Keynote on Java Mobile & Embedded

I look like I have a toupee on in this video. I don't really. That's my real hair. I might have to reconsider this whole Moe style thing, and go with a Curly style instead in the future...


Java Mobile & Embedded Tech Keynote

Well, at least my demos worked! Thanks to Guru S., Jennifer Y., and Justin H. for all their help!

Wednesday Sep 07, 2011

Java Summer Workshop 2011

On August 10-12, 2011, local high school students and teachers as well as Oracle employee sons and daughters attended an onsite introductory Java programming workshop, where kids learned about Project Greenfoot and Project Alice, two cool ways for children to learn Java programming.


Kids learn Java

Watch the video and see some sharp kids who are enthusiastic about Java technology. That's cool! Where did they get all these clever children from? I expect each one to grow up to be a Mark Zuckerberg or Carol Bartz... er, uh... wait, not Carol Bartz. I mean, um... Marissa Mayer. Yeah, each kid will grow up to be a Mark or Marissa. :-)

Wednesday Aug 24, 2011

Introduction to Java ME technology: Hello

Here are some slides from a developer on the Web that cover an introduction to Java ME technology. Nicely done!

Good stuff, Anoop! This is just one example of many references on the Web to help Java ME developers.

Friday Apr 30, 2010

Growth of Java ME cell phones continues to rise

The growth of the overall cell phone market continues to rise, up 22% this past quarter. That's very nice, since the majority of worldwide cell phone sales (about 70%) is still Java ME tech-enabled. iDrone fanboys would have you believe that iDrones represent the majority of cell phone sales. Don't believe the hype!


Java ME still growing

Here's a quote:

 Research in Motion Ltd., 
 the Canadian maker of the 
 BlackBerry smart phones, 
 broke into the top five 
 of the world's largest 
 phone makers for the 
 first time.

 Manufacturers shipped 295 
 million phones in the 
 quarter, IDC said. The 
 report is based on 
 publicly reported figures 
 from the major phone 
 Nokia Corp. kept its place 
 as the world's largest 
 maker of phones, followed 
 by Samsung Electronics Co. 
 and LG Electronics Inc.
Woo-hoo! There's still life in them bones.


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


« April 2014