We think we have found project that will take over our holiday free time. [Bai Li] just published an excellent article about writing a program that can automatically solve the game of Minesweeper. For those of you who are unfamiliar, Minesweeper gives you a grid in which land mines have been randomly placed. As you click on boxes to reveal what is underneath you are greeted with a number which represents how many mines surround that box. [Bai’s] project examines how the puzzle may be solved programmatically.
He chose to use Java to write the solver. This works well both reading from the screen as well as simulating mouse clicks on the game. The reading portion of the program uses color detection with a screenshot. There were two problems associated with this, the numeral one is almost the same color as an uncovered square, and the numerals seven and three use identical colors. The input portion was much simpler as he’s able to use the existing Robot class.
The logic behind writing an efficient solver is very interesting. One of the most fascinating examples is shown above. What should you do when there is no possible way to ensure a safe move? As with traditional chess games, [Bai] has the solver calculate all possible solutions and choose the move that has the best odds of success.
His source code is available, but won’t this one be fun to hack out from the concepts alone? For some reason this seems more accessible to us than something like the Bejeweled Blitz solver.
Continue reading “How to write your own Minesweeper solver”
This arm cuff is a sensor package which logs data whenever you’re wearing it. It records accelerometer data, skin temperature, and galvanic skin response. That data can then be analyzed to arrive at figures like calories burned. But… The company behind the device seems to have included a way to keep the cash flowing. Once you buy it you can read the data off of the device using a Java program they supply. But you can’t erase the data from the device unless you subscribe to their online service. Once it fills up, it’s useless. [Doug] wasn’t happy with this gotcha, so he reverse engineered the technique used to clear the BodyBugg’s memory.
There had been a few previous attempts at reverse engineering the device but that groundwork didn’t really help [Doug] on his quest. He ended up disassembling the Java classes from the original program. This helped him figure out how to initialize communications. Once there he was happy to find that the device will tell you how to use it. If you issue an invalid command it will respond with a list of all valid commands. Everything you need to get up and running can be found in his github repo.
Check out the LED cube which [Thomas], [Max], and [Felix] put together. But don’t forget to look at that beautiful PCB which drives it… nice! But hardware is only part of what goes into a project like this one. After the soldering iron had cooled they kept going and wrote their own software to generate patterns for the three-dimensional display.
Looking at a clean build like this one doesn’t drive home the amount of connections one has to make to get everything running. To appreciate it you should take a look at this other 512 LED cube which has its wires showing. You can see from the schematic (available in the project repository) that all of these lines are managed by a series of shift registers. The board itself connects to a computer from which it gets the visualization commands. A Java program they call CubeControl can push letters or turn the cube into a VU meter.
The team built at least two of these. This smaller version uses red LEDs, while the larger one shown in the video after the break has blue ones.
Continue reading “8x8x8 LED cube and the board that drives it”
Google TV is a network connected television. It does what you would think: plays television programs, streams media from the internet, and allows you to open URLs on your TV. But one nice feature is that it can also be controlled over the network rather than just via an IR remote. Google publishes apps which make this simple with a smartphone. But the communications protocols are open source, so [Leon Nicholls] wrote a Google TV remote control library in Java.
The video after the break shows him pairing a Raspberry Pi with his television. The image above is the pairing verification code you must enter on the remote hardware before control is authorized. Apparently this is a step that needs to happen every time if using Google’s Anymote library. [Leon] improved that, by saving the pairing data so that the first authorization is all that it takes.
He figures this could be used for home automation. We’re not sure what we’d use it for but we’d love to hear your ideas in the comments.
[Dimitri] sent in a project he’s been working on that implements a Java Virtual Machine purely in C, and is easily portable between microcontrollers such as the AVRs and PICs we normally see, ARM devices, and even the lowly 386.
Before going into the ‘how’, [Dimitri] first covers why he wanted to run Java bytecode on a microcontroller. Basically, he found existing solutions like the Arduino environment too complex for people just wanting to program a chip. Arduino and PICAXE require C-like syntax and pointers; not the easiest thing when everyone and their mother can program in Java.
As for how [Dimitri] managed to pack a JVM into a microcontroller, that’s another story entirely. Everything in the JVM, from double, long, and float data types to exceptions, neat thread-related functions such as ‘synchronize’ and even methods such as String.charAt() and String.length() are completely optional. If your microcontroller is too small, just disable the functions you don’t need.
As for how well – and how fast – μJ is able to run, [Dimitri] threw up a demo of an ATMega644 and PIC24 running his JVM and a small Java app. You can check those videos out after the break, or just download the source for μJ on [Dimitri]’s site.
Continue reading “μJ, a Java virtual machine for microcontrollers”
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.