Embedded Java – Raspberry Pi, SunSpots, and Propeller

The Raspberry Pi is definitely shaking things up in the embedded space. In its first year it has sold over 1 million units. It is a powerful computer not much bigger than a credit card capable of running a full linux installation as well as a regular Java SE. It can be powered off USB and comes with IO pins enabling it to connect with external devices. To top it off, it only costs $35 with a case ironically costing $10. Since it runs linux, it is possible to plug in existing peripherals (cameras, flash drives, etc.). This device enables desktop developers to write embedded software without (most of) the pain usually associated with embedded devices. You don’t have to deal with interrupts and languages such as C/C++, Basic, assembly, or other more specialized languages such as Spin. When programming on many embedded devices you lack the rich set of classes provided by the Java runtime as well as the larger Java ecosystem. If you are writing code on a JavaME device you’ll be lacking many of the classes you’ve come to expect in Java and key features such as object serialization. So it is easy to see why Raspberry Pi is so exciting.



Raspberry Pi Picture

To provide some context for the Raspberry Pi I will compare it to other devices –  the SunSpot, and Propeller. There is no one solution. In fact, depending upon what you are doing you may use a combination of these devices.

Before diving, the strength of each device:

  • Raspberry Pi – full operating system capable of running Java SE and connecting to HDMI video and standard input devices. Support for standard USB peripherals.
  • SunSpot – Wireless networking (mesh networking), low battery consumption. Includes built-in sensors (temperature/accelerometer as well as push buttons, and LEDs). Runs Java ME.
  • Propeller – Write native code, 8 cores that you usually dedicate to talking to external devices. Has 32 I/O pins and a large online exchange for code to talk custom protocols to embedded devices – such as sensors.


Each one of these devices is different and no device is the end-all. The Raspberry Pi is very exciting as previously you would have needed a full computer.

Questions to ask about which device you should use for a project:

  • What’s your skill level with embedded device programming?
  • How are you going to power your project?
  • What types of devices are you going to attach?
  • How large is your application?
  • What are the power requirements of the other devices you are going to attach?
  • Do you need to use third party Java libraries?
  • Does your application generate lots of data?
  • Do the devices you will connect to require real-time support?
  • Are you trying to replace a computer with something almost as powerful?

Comparing Devices

To get an idea of how the Raspberry Pi compares to other embedded devices I’ve prepared the table below. I do have an Arduino but haven’t had a change yet to play with it. After I dug into the Propeller and got used to 8 cores I couldn’t go back. Table below gives a rough comparison – this is a rough comparison.


Raspberry Pi



Price $35.00 $200 $8
CPU 700 Mhz ARM11 400 Mhz ARM 80 Mhz
Floating Point Yes Yes None
Memory 512 Mb 1 MB 32 KB Ram32 KB ROM
USB Ports 2 1 1 – optional
Video Output HDMI & Composite None Composite*
Audio Output Stereo 3.5 + HDMI None None*
Storage SD Memory – 128 GB 8 MB flash memory None*
Networking 10/100 Ethernet 2.4 GHz 802.15.4 radio transreceiver None*
Connectivity 8 GPIO, UART, PC, SPI 8 IO ports (4 GPIO and 4 analog) + 3 serial lines 32 IO pins (40 mA per pin)
Power 700 mA – 3.5W 44 mW 300 mA 3.3 V
Battery None 3.7V rechargeable 770 mAh lithium battery None
Operating System Linux Squawk Virtual Machine None
Dimensions 84 x 53 x 25 nm 41 x 23 x 70 mm 12.3 x 51 x 3.41 mm
Java Java SE Java ME None – Spin/C/Assembly
Clock NONE Real-time clock None

Caveat when reading this table: the propeller is a chip. You can purchase just the chip and then add the things you need or purchase a board with a chip etc. The price and features range – some boards come with USB as well as video, a microphone, stereo audio, etc.


When looking at this table the first thing that will jump out at you is the disparity in costs. If you were making a product you wouldn’t be paying retail. Also, the price for the propeller is misleading – this is just a chip and you have to wire additional stuff to it. More discussion individually:

  • Raspberry Pi – arguably has the biggest bang for the buck. However it lacks a couple of key things: battery, wireless support, and a real time clock. It also has a regular operating system giving you the most flexibility in terms of third party packages/libraries/etc.
  • SunSpot – although costly the schematics are available online so you can have it manufactured yourself. This includes everything including the BOM (Bill of Materials). Talking to an electrical engineer he commented that the current custom molded case and low volumes definitely drive-up the price. The SunSpot packs a powerful punch and with its onboard radio and power management as well as battery enables it to be mobile.
  • Propeller – although this is just a chip, it is great for situations where you are talking to sensors and other time critical devices (servos etc.). You can add additional components as you need. Given that is just a chip, you can design the rest of the solution. Parallax provides a wide variety of protoboards for development.


Both the Raspberry Pi and SunSpots use an ARM processor. The Raspberry Pi can be over clocked and needs the extra power in order to run a full operating system. It is up to Linux on the Raspberry Pi to do power management – obviously this is going to make power management much tougher if you are trying to wring out battery performance. The SunSpot on the other hand is slower but is only running Java – Java on bare metal. The propeller is much slower but has no overhead – it has 8 cores which you usually dedicate each to one task only.

Floating Point

The Raspberry Pi and SunSpots both support floating point – since it is Java the behavior is predictable. The Propeller does have additional libraries that support floating point but the trade-off is in terms of performance. There are multiple ways to solve this problem.


The Raspberry Pi has the most memory of the three but remember that it is running a full OS. The memory in the Raspberry Pi cannot be upgraded. The SunSpot has less memory but needs less. If you are doing something which requires gigabytes of memory you will either need to add additional storage (wire something in) or switch to another device.


The Raspberry Pi, with its ability to run JavaFX, arguably is the choice for a solution requiring media. If you are using video, you probably have a power outlet and a power hungry display. The SunSpot really isn’t meant for situations like this where you need to drive a display. The Propeller can drive displays and Parallax has a Hydra kit for developing a game console.


With the Raspberry Pi you run the OS off a flash card – so you have a flash hard drive and all the normal file operations at your disposal. It also has more RAM. Out of the box neither the SunSpot nor the Propeller have much space. You can of course wire in additional memory but the more you add the more power you will consume.

Power and Battery

Power and battery support are where the SunSpot and Propeller really shine. The SunSpot has built-in power management support. This means that when it isn’t doing anything, power consumption falls off a cliff. With the Propeller, you have complete control over power consumption and can slow down the clock and practically consume nothing. With the SunSpot, it can potentially run for months without being recharged. On the Propeller you would have to design a battery solution to power it and also supply circuits and code to monitor the battery – ditto on the Raspberry Pi although that might be harder than the Propeller depending on your skills (just a guess). The SunSpots have code/APIs to monitoring the battery.


The Propeller by far has the most support for IO ports. Remember, wiring in an external device is going to require multiple IO pins. It you are trying to build a robot, the more IO pins the better as you will need to power multiple servos. Also, the amount of power an IO pin can sink is also important. You won’t be able to run 8 servos off of a Raspberry Pi directly. With the Propeller, writing code that runs on metal and having a dedicated core for IO pins makes dealing with external devices much easier – no scheduler to get in the way of precise timing.


Although the Raspberry Pi comes with 10/100 Ethernet support and can be added to a standard home wireless network, the SunSpots really shine when it comes to networking. SunSpots support mesh networking – which means you can have a mesh for delivery messages. You can access signal strength and do some pretty wild things. With mesh networking you can broadcast a message to a spot that is out of range of the sender and have other spots relay the message by jumping from spot to spot. You can also deploy programs wirelessly (securely as well) and have program failover with spots (when a battery runs outs).

The Propeller doesn’t have any networking features out of the box, however there are modules for ethernet as well as ZigBee. There are many different ways to add networking with code available.


Both the Raspberry Pi and SunSpot can run Java. With the Raspberry Pi you have a full Java SE implementation at your disposal. On the SunSpots, you are much more limited and are dealing with a Java ME implementation. Since Java ME has a subset of the Java class library many third party libraries won’t run on the SunSpot. However, you do have APIs for dealing with hardware and can easily access stuff on the demo board (temperature, LEDs, buttons, accelerometers, etc.) without have to write native code or dive into the nuts and bolts of talking to a serial device.

Comparison Summary

As I mentioned at the start, none of these devices is the solution to all problems. Using these three devices together you can do many exciting things. The Propeller chip can be used with both the Raspberry Pi as well as the SunSpot to offload low level device work. First, it is much cheaper to replace a Propeller when you wire something wrong (Propeller is also more forgiving of errors with current). That’s what I did with my home security system (demoed in JavaOne 2011 presentation).



1 thought on “Embedded Java – Raspberry Pi, SunSpots, and Propeller”

  1. David G. Simmons

    Wow, nice to see someone still writing about Sun SPOTs! Oral has discontinued the project, and has even taken down the old server at sunspot world.com, sadly. They are no longer selling Sun SPOTs. The server has been mirrored to sunspotdev.org however, and there are still a couple of kits available for sale over there too.

Comments are closed.

%d bloggers like this: