C is a beautiful language perfectly suited for development on low-power devices such as the 8-bit microcontrollers. With newer, more powerful ARM microcontrollers making their way onto the market and workbenches around the world, it was only fitting that Oracle got in on the action. They released a version of Java targeted at these newer, more powerful microcontrollers called Java ME embedded.
The new embedded version of Java has everything you would expect from a microcontroller development platform – access to GPIO pins, including SD cards and I2C devices. The new Java machine is designed for full headless operation and is capable of running on devices with as little as 130 kB of RAM and 350 kB of ROM.
As for the utility of programming a microcontroller in Java, it’s still the second most popular language, after spending the better part of a decade as the number one language programmers choose to use. The requirements of the new embedded version of Java are far too large to fit onto even the best 8-bit microcontrollers, but with a new crop of more powerful ARM devices, we’ll expect to see more and more ARM/Java projects making their way into the Hackaday tip line in the coming months.
Tip ‘o the hat to [roger] for sending this one in.
[Scott] wrote in to share a project he is currently working on, a home automation system that relies on Power over Ethernet. While he’s not completely finished, he’s made some great progress, and the work he has done so far definitely piqued our interest.
Part of [Scott’s] design relies on some reverse engineered Blackberry screens we showed you a while back. He has constructed a small control panel for his apartment, which incorporates one of the aforementioned Blackberry screens, along with 10 tactile switches and a PIR sensor. The panel is built to be mounted in a wall or as a standalone unit, allowing him to control various lights and appliances throughout his home.
[Scott] spent a lot of time working on the communications protocol and UI for his control panel. As it sits now, the panel takes advantage of a VNC-like protocol he designed, which allows him to interact with a Java application residing on his desktop computer.
Things are looking awesome so far, and [Scott] already has a handful of improvements planned for the near future. We can’t wait to check it out when it’s finished.
A commercial potentiostat can cost several thousand dollars, but the CheapStat is an open source project that makes it possible to build your own at a tiny fraction of that cost. It is possible to build one for less than $80, breaking down the cost barrier faced by many labs that would like to have this test hardware.
A potentiostat is used to measure electrochemical properties. To give you a few examples of what it can do, the hardware can measure arsenic levels in water, Vitamin C concentration in orange juice, Acetaminophen concentrations in over-the-counter medications, and a bunch of other less easily explained tests having to do with chemical compounds and DNA.
The device makes use of an Atmel XMEGA microcontroller and connects to a computer via USB. A Java program grabs that data from the hardware displaying test results on your choice of computer platforms. If you’re looking for all the gory details you won’t be disappointed by their journal paper.
[Paul] wrote in to tell us about some interesting Arduino latency issues he helped nail down and fix on the Arduino.
It seems that [Michu] was having some problems with controlling his Rainbowduino project we featured earlier this year, and he couldn’t quite figure out why he was experiencing such huge delays when sending and receiving data.
Searching online for answers turned up very little, and since [Michu] was using Processing, the pair designed a set of tests to see what kind of latency was being introduced by Java. Pitting an Arduino Uno and an Arduino from 2009 against a Teensy 2.0, the tests gauged the latency of native data transfers versus transfers facilitated by Java via the rxtx library it uses for serial communications.
The results were pretty stunning. While both of the Arduinos lagged behind the Teensy by a long shot, their latency values under Java were always 20ms at a minimum – something didn’t add up. [Michu] poked around in the rxtx code and found a mystery 20ms delay programmed into the serial library. It made no sense to him, so he changed the delay to 2ms and saw a drastic increase in performance when transferring less than 128 bytes of data.
The pair’s fix doesn’t seem to affect latency when larger amounts of data (>1kB) are being transferred, but it makes a world of difference when manipulating smaller chunks of data.
For the sake of disclosure, it should be noted that [Paul’s] company produces the Teensy mcu.
[Simon] improved upon an existing hack by making this Arduino ambient lighting system that has four different color regions. He was inspired by [Roy’s] processing-based setup which we saw a few weeks ago. That system used processing to determine the average color of the currently displayed image, then it displayed the color on a single RGB LED strip. [Simon] was thinking a little bit bigger.
He purchased a lighting strip that could be cut into different sections and then set out to develop his own software for multiple color regions. He had little or no experience with Processing so he went one abstraction layer lower and used Java to code his interface. It’s got a lot of nice settings where you can tweak how, when, and why colors are displayed. In the end he has four independently addressable color strip on the left, right, top-left, and top-right of the screen. The best part is that the Java suite he developed can be used on different platforms, having been already tested on Windows and Linux.
Interfacing your own hardware with a Java app couldn’t be easier than this example. [Pn] created this proof-of-concept using an Arduino, an analog joystick from a gaming controller, and a few lines of Java code. The Arduino reads an ADC value from the joystick’s x-axis and transmits it over the serial connection ten times a second. The Java program triggers on every serial event, parsing the data based on the @ symbol that the Arduino sends as a start and end condition.
We like this kind of example because there’s nothing extra involved. It lets you take the concept and run with it in any project imaginable. Be it a more complicated Joystick, or simple sensors that you’d like to interface with.
[Rafael] built a system that uses radio frequency for communications. The code he was using with the inexpensive receiver/transmitter pairs already had some error correction but from time to time an entire message would be missed by the receiver. He set out to make these RF communications more robust.
A little more than a year ago we looked at using these same transmitters with an Arduino. [Rafael] has a similar setup but since they are unidirectional he chose to use two pairs for bidirectional communication (each operating at a different frequency to avoid interference). On one end, a computer transmits data to the Arduino which is in a remote location. His confirmation protocol relies on a randomly generated message identifier. The computer will continually transmit the same message. The Arduino continually receives these messages, comparing them with the last successfully received message. If they match, it is considered a successful data transfer and the Arduino transmits a confirmation back to the computer which then starts transmitting the next message.
This isn’t an application-specific protocol. For demonstration purposes [Rafael] built a quick home automation setup that uses it to operate a house lamp.