On the SPOT: David G. Simmons

Sun SPOT Media Feed

Friday Oct 24, 2008




2757420833_63b59bdf4a.jpg


[photo courtesy of Pete "The Plumber" St. Pierre]


No, the Sun SPOTs don't feed off of the media (though that's an idea ... ) but we do have a couple of interesting feeds for Sun SPOT related information.



  • Planet Sun SPOT

    This is an aggregator for news and blog posts about Sun SPOTs. If you have a Sun SPOT-related blog that you want listed here, please let us know and we'll add you!
  • Sun SPOT Media Feed

    This is a page where we gather pictures, videos, etc. of Sun SPOT projects. If you want your project, picture, or YouTube video to show up on this page, just make sure that you tag it with 'spaughts' when you post it (or go back and tag it now!) and it will automatically show up here.


So get blogging, photo-ing and video taping! And get them posted!! We want to see it!



[ If you think nobody cares if you're alive, try missing a couple of car payments.



-- Earl Wilson ]


Like this post? del.icio.us | furl | slashdot | technorati | digg

Addition to the blog-o-rama

Thursday Oct 23, 2008

teh_hollywood.jpg


A warm welcome to someone I have never met, except in the Twitterverse, Rick Kenney (aka tehduh) and his new blog. Ok, so I have talked to him on the phone once, but that doesn't count. He's part of the team that does wonderful stuff for us like make blogs.sun.com possible, so be nice.


[ Grabel's Law: 2 is not equal to 3 -- not even for large values of 2. ]

[1] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg

Maze Game

Thursday Oct 23, 2008


SunSPOTWorld.png

Nice video of one of our users developing a Maze Game using Sun SPOTs











Remember, if you do a video of your Sun SPOT Project, put it on YouTube with the tag 'spaughts' and it will show up in our YouTube Feed for all to see, and possibly get featured on the SunSPOTWorld.com website, or here!


[ Only God can make random selections. ]



Like this post? del.icio.us | furl | slashdot | technorati | digg

OpenOffice Blog Client

Wednesday Oct 22, 2008



So I've just downloaded the latest and greatest OpenOffice.org for Mac – a native version! No more NeoOffice!! No more X11!!! – and installed the blog extension, so I'm making my first blog post from OO.o. We'll see how it goes with this, and whether or not it can convince me to change blog-clients.


[ fortune: cpu time/usefulness ratio too high -- core dumped. ]


[2] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg

Sun SPOT Car (Russian even!)

Wednesday Oct 22, 2008

basic_diagram.jpg


So There's a new blog post from a Sun Campus Ambassador, about a new Sun SPOT Project they did which sounds awesome. Go check it out: here. And tell em I sent ya! <wink>


[ They're only trying to make me LOOK paranoid! ]

[4] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg

Mems Gyro

Tuesday Oct 07, 2008


00698-03-L.jpg


So I'm catching up on some of my "Stupid SPOT Tricks" and figured I should post this one. A long time ago now I got a couple of the IDG300 Dual Axis Mems Gyros from Sparkfun. Awesome little part. As usual, frighteningly easy to work with.


I wired it up to the Sun SPOT as follows:




















Gyro Wiring
Gyro Breakout Board Sun SPOT Pin
3.3V +3
GND GND
Yout A0
Xout A1
Vref None


For those of you that do better visually:


Gyro1.png

The wiring, as you can see, was simple and straightforward. The code, as usual, is as well.

Upon running the code the first time, I noticed that the gyro has a small amount of 'jitter.' The readings vary by a small amount even when the device is perfectly still. So I had to account for the jitter and quiet it somewhat. The basic class is very small:


public class MemsGyro extends MIDlet {
private static final int C_SLEEP = 100;
private static final int READ_SLEEP = 100;
private ITriColorLED [] leds = EDemoBoard.getInstance().getLEDs();
IScalarInput yout = EDemoBoard.getInstance().getScalarInputs()[EDemoBoard.A1];
IScalarInput xout = EDemoBoard.getInstance().getScalarInputs()[EDemoBoard.A2];
private int xDiff, yDiff;


protected void startApp() throws MIDletStateChangeException {
System.out.println("Hello, world");
new BootloaderListener().start(); // monitor the USB (if connected) and recognize commands from host
ISwitch sw1 = EDemoBoard.getInstance().getSwitches()[EDemoBoard.SW1];
calibrateGyro();
int x=0,y=0;
try{
while (sw1.isOpen()) { // done when switch is pressed
leds[0].setOn(!leds[0].isOn()); // Blink LED
int tx = xout.getValue();
if(tx > x+xDiff || tx < x-xDiff){
System.out.println("X Rotation: " + tx);
x = tx;
}
int ty = yout.getValue();
if(ty > y+yDiff || ty < y-yDiff){
System.out.println("Y Rotation: " + ty);
y = ty;
}
Utils.sleep(READ_SLEEP);
}
} catch (IOException ex) {
ex.printStackTrace();
}
notifyDestroyed(); // cause the MIDlet to exit
}

And the method I added to account for the jitter is:


private void calibrateGyro(){
int xMax = 0, yMax = 0;
int xMin = 100000, yMin = 100000;
leds[0].setRGB(100,0,0); // blink red while calibrating
try {
for(int z = 0; z<100;z++){
int y = yout.getValue();
int x = xout.getValue();
if(y > yMax)
yMax = y;
else if(y < yMin)
yMin = y;
if(x > xMax)
xMax = x;
else if(x < xMin)
xMin = x;
leds[0].setOn(!leds[0].isOn()); // Blink LED
Utils.sleep(C_SLEEP);
}
xDiff = xMax - xMin;
yDiff = yMax - yMin;
System.out.println("X Variation: " + xDiff + " Y Variation: " + yDiff);
} catch (IOException ex) {
ex.printStackTrace();
}
leds[0].setRGB(0,100,0); // otherwise blink green
}

And that just samples the Gyro for a few seconds, and determines what the maximum variation is while the Gyro is 'quiet' and then uses that later to tell us if the Gyro is actually on the move.

Now, what you use this for is entirely up to you!


[ Down with categorical imperative! ]

[4] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg

Linear Actuators

Monday Oct 06, 2008

firgelli.png


These little things from Firgelli look cool as all get-out. Too bad they don't give out free engineering samples so I could play with a few of them. $0 budgets make it hard to buy samples.


Of course, if anyone wants to see their name here on my blog, a great way to get there is to send me some of these. :-)


[ I didn't like the play, but I saw it under adverse conditions. The curtain was up. ]

Like this post? del.icio.us | furl | slashdot | technorati | digg

Nigerian Scam?

Tuesday Sep 23, 2008

I put this on my facebook page earlier, but I have now received about 10 copies of it via email and twitter, so I thought I had better post it here as well. These Nigerian or 419 scams are getting worse every day!



Dear American,

I need to ask you to support an urgent secret business relationship with a transfer of funds of great magnitude, caused by unfortunate circumstance of me.

I am Ministry of the Treasury of the Republic of America. You may not know but my country has had crisis that has caused the need for large transfer of funds of 800 billion dollars US. If you will assist me in this transfer, it would be most profitable to you personally.

I am working with Mr. Phil Gram, esteemed lobbyist for UBS, who is guaranteed will be my replacement as Ministry of Treasury in January. As a Senator, you may have heard of him as the well-known leader of American banking unregulation movement in the 1990s. This transactin is 100% safe.

This is a matter of great urgency which is why we contact you direct. We need a blank check. We need the funds as quickly as possible. We cannot directly transfer these funds in the names of our close friends because we are constantly under surveillance. My family lawyer advised me that I should look for a reliable and trustworthy person who will act as a next of kin so the funds can be transferred at once to the rightful owners.

Please reply with all of your bank account, 401k, IRA and college fund account numbers and those of your children and grandchildren to wallstreetbailout-AT-treasury-DOT-gov so that we may transfer you your commission in this for guaranteed transaction. After I receive that information, I will respond with detailed information about safeguards that will be used to protect the funds and your earned commission of this perfectly safe transaction.

Yours Faithfully Minister of Treasury Paulson



It's really time to do something about this scam ...


[ Job Placement, n.: Telling your boss what he can do with your job. ]

Like this post? del.icio.us | furl | slashdot | technorati | digg

Android uses SPOT idea

Tuesday Sep 23, 2008

So this is pretty funny ...



"Brin said he has already been playing around with the device and described an application he developed that allows him to throw up his phone and calculate the amount of time it takes before it hits the ground."

Which is, oddly enough, the very same application we (the Sun SPOTs Team) demonstrated for Google and a bunch of other folks a few weeks ago.


Imitation is, indeed, the sincerest form of flattery.


Ok, I have one question though: What does it say about the user experience of this thing that the very first application Brin writes is one to determine how far he threw the thing? I mean, if it was a WinCE device, sure, but this is supposed to be an improvement in the User Experience, right?


[ Oh, wow! Look at the moon! ]

Like this post? del.icio.us | furl | slashdot | technorati | digg

GPS SPOT Updated

Thursday Sep 18, 2008

So it's been a while since I've posted anything of value. And even longer since I posted of the GPS SPOT. But given that we have just released yesterday the latest v4.0 (Blue) SDK, and I released v4.0 of the Sun SPOT Manager Tool, as well as a new set of Getting Started Docs, I figure it#8217s time to post something else here.


So we#8217ve been working on a project with some folks at Vodafone with Sun SPOTs, and they have been hard at work hooking up the Precon Temperature and Humidity Sensor as outlined in my previous blog post. But it#8217s also been almost 2 years since I first blogged about the GPS SPOT, and so much has changed since then. So, here goes #8230


To start with, I have completely reworked the NMEA Message Parser to be a bit better. This is a small utility class that parses an NMEA Message and puts it in a Hashtable which can be easily dereferenced later for the individual elements that are of interest.



package org.sunspotworld;
import java.util.Hashtable;
/**
*
* @author davidgs
*/

public class parser {
private String[] Fields;
public parser(String[] fields){
Fields = fields;


}




public Hashtable parseMessage(String m){
Hashtable thisHash = new Hashtable();
String msg = m;
int nToke =0;
int del = m.indexOf(',');
msg = msg.substring(del+1); // scrub the header
del = msg.indexOf(',');
for(int x = 0; x< Fields.length;x++){
String val = msg.substring(0,del);
thisHash.put(Fields[x], val);
if(del+1 <= msg.length())
msg = msg.substring(del+1);
del = msg.indexOf(',');
if(del < 0){
if(msg.indexOf('*')>0){
del = msg.indexOf('*');
}else {
del = msg.length();
}
}
}
return thisHash;
}
}



So I will use that parser class in each of the NMEA Message classes. I made a separate class for each type of message I#8217m interested in, but the only really important bits in any of them are the fields, defined as an array of Strings.

package org.sunspotworld;
import java.util.Hashtable;
public class GPRMCMessage {

static final String[] GPRMCfields = {"UTCTime","Status","Latitude","North-South","Longitude","East-West","Speed","Course","Date","MagneticVariation","Checksum"};
private parser parse = new parser(GPRMCfields);
private Hashtable parsedMessage = new Hashtable();
public GPRMCMessage(String message){
parsedMessage = parse.parseMessage(message);
}
public String getUTCTime() {
return getValue("UTCTime");
}
public String getLatitude() {
return getValue("Latitude");
}
public String getLongitude() {
return getValue("Longitude");
}
public String getSpeed() {
return getValue("Speed");
}
public String getCourse() {
return getValue("Course");
}
public String getDate() {
return getValue("Date");
}
public String getMagneticVariation() {
return getValue("MagneticVariation");
}
public String getChecksum() {
return getValue("Checksum");
}
public String getValue(String key){
return (String) parsedMessage.get(key);
}
}


I defined some convenience methods to return fields I know I#8217m going to want, but there is also a general getValue(String) method so that I can get access to any field in the message. So a typical GPGGA might contain: $GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47 And I can then create a new GPGGAMessage Object with that String:

package org.sunspotworld;
import java.util.Hashtable;

public class GPGGAMessage {

static final String[] GPGGAfields = {"UTCTime","Latitude","North-South","Longitude","East-West","Position-Fix","Satellites-Used","HDOP","Altitude","Alt-Units","GEOID","GEOID-Units",
"Age-of-Diff","Diff-Station-ID","Checksum"};
private Hashtable parsedMessage;
private parser parse = new parser(GPGGAfields);

public GPGGAMessage(String message){
parsedMessage = parse.parseMessage(message);
}



public String getUTCTime() {
return getValue("UTCTime");
}
public String getLatitude() {
return getValue("Latitude");
}
public String getLongitude() {
return getValue("Longitude");
}
public String getSatellitesUsed() {
return getValue("Satellites-Used");
}
public String getHDOP() {
return getValue("HDOP");
}
public String getAltitude() {
return getValue("Altitude");
}
public String getGeoid() {
return getValue("GEOID");
}
public String getChecksum() {
return getValue("Checksum");
}
public String getValue(String key){
return (String) parsedMessage.get(key);
}
}

And now I can reference fields in that message quickly and easily. But how do you get those messages? Well, that#8217s actually the easy part. So let#8217s look at that part.


First, you need a GPS Unit. I used the San Jose Technology, Inc. FV-M8 GPS Unit, since that#8217s what I had. And here#8217s the wiring diagram for it:





wiring.png




So pin 1 went to the 5v pin on the Sun SPOT header, pin 2 went to ground, pin 3 to D0, and pin 4 to D1 (Tx and Rx, respectively). That was all it took. And then the following code to read the values:





/*
* StartApplication.java
*
* Created on May 2, 2008 1:35:38 AM;
*/

package org.sunspotworld;
import com.sun.spot.peripheral.Spot;
import com.sun.spot.sensorboard.EDemoBoard;
import com.sun.spot.sensorboard.peripheral.ISwitch;
import com.sun.spot.sensorboard.peripheral.ITriColorLED;
import com.sun.spot.peripheral.radio.IRadioPolicyManager;
import com.sun.spot.io.j2me.radiostream.*;
import com.sun.spot.io.j2me.radiogram.*;
import com.sun.spot.util.*;
import com.sun.squawk.Isolate;
import java.io.*;
import javax.microedition.io.*;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
/**
* The startApp method of this class is called by the VM to start the
* application.
*
* The manifest specifies this class as MIDlet-1, which means it will
* be selected for execution.
*/

public class StartApplication extends MIDlet {

private ITriColorLED [] leds = EDemoBoard.getInstance().getLEDs();

protected void startApp() throws MIDletStateChangeException {
System.out.println("Hello, world");
new BootloaderListener().start(); // monitor the USB (if connected) and recognize commands from host

long ourAddr = Spot.getInstance().getRadioPolicyManager().getIEEEAddress();
System.out.println("Our radio address = " + IEEEAddress.toDottedHex(ourAddr));
enableGPS();
}

protected void pauseApp() {
// This is not currently called by the Squawk VM
}

/**
* Called if the MIDlet is terminated by the system.
* I.e. if startApp throws any exception other than MIDletStateChangeException,
* if the isolate running the MIDlet is killed with Isolate.exit(), or
* if VM.stopVM() is called.
*
* It is not called if MIDlet.notifyDestroyed() was called.
*
* @param unconditional If true when this method is called, the MIDlet must
* cleanup and release all resources. If false the MIDlet may throw
* MIDletStateChangeException to indicate it does not want to be destroyed
* at this time.
*/

protected void destroyApp(boolean unconditional) throws MIDletStateChangeException {
for (int i = 0; i < 8; i++) {
leds[i].setOff();
}
}
GPS telitGSM;
/**
* calling this method will break the USB serial i/o ( System.out and System.err )
*/

public void enableGPS() {
System.out.println("getting edemoserial");
// setup the GPS on arm9 serial port
try {
StreamConnection strm = (StreamConnection) Connector.open("edemoserial://usart?baudrate=38400");
// full options string : serial://usart?baudrate=9600&databits=8&stopbits=1&parity=none
telitGSM = new GPS(strm);
} catch (Exception e) {
// unable to initialize the telit ... we need an error logging system
e.printStackTrace();
}

}
}


So that opens the serial connection to the GPS Unit, and then:




/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package org.sunspotworld;
import com.sun.spot.util.Queue;
import com.sun.spot.util.Utils;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.microedition.io.StreamConnection;
/**
*/

public class GPS {

public StreamConnection serialStream = null;
public OutputStream serialOutput = null;
public InputStreamer monitor = null;
/**
* this is to sync writing and reading
*/

private Queue input;
private Position position;
private Position temp;
private boolean isValid = false;
private NMEA nmea;

public GPS(StreamConnection serial) {
serialStream = serial;
nmea = new NMEA();
init();
}

protected void init() {

try {
serialOutput = serialStream.openOutputStream();
monitor = new InputStreamer(serialStream.openInputStream());
new Thread(monitor).start();
} catch (Exception e) {
}
}

public void setIsValid(boolean isValid) {
this.isValid = isValid;
}

public class InputStreamer implements Runnable {

InputStream stream;

public InputStreamer(InputStream strm) {
stream = strm;
}

/*
* reads input builds a sentance then tries to parse it
*
*/

public void run() {

System.out.println("GPS: running........");
char val;
String sentence = "";

while (true) {
try {
val = (char) stream.read();
if (val == '\n') {
if (sentence.charAt(0) == '$') {
if (sentence.startsWith("$GPGGA")) {
//System.out.println("GPGGA NEMA Message: " + message);
GPGGAMessage gpgga = new GPGGAMessage(sentence);
System.out.println("Latitude: " + gpgga.getLatitude());
System.out.println("Longitude: " + gpgga.getLongitude());
} else if (sentence.startsWith("$GPGSA")) {
GPGSAMessage gpgsa = new GPGSAMessage(sentence);
// do what you want here
} else if (sentence.startsWith("$GPRMC")) {
GPRMCMessage gprmc = new GPRMCMessage(sentence);
// do what you want here
} else {
System.out.println("Other NEMA Message: " + sentence);
// or create new Message classes to handle them
}
sentence = "";
} else {
sentence = "";
}
} else {
// recover from bad read .. reset
if (val == '$') {
sentence = "";
}
sentence += (char) val;
}
// Utils.sleep(10000);
} catch (IOException ex) {
Utils.sleep(100);
} catch (Exception e) {
}
}
}
}
}



And there you have it. Simple. Easy. And you get GPS from a Sun SPOT.


[ A bird in the hand makes it awfully hard to blow your nose. ]

[1] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg

Sun SPOT Manager v4.0

Friday Sep 05, 2008

It's a big day here ...


We have released the latest updates to a couple of the NetBeans Sun SPOT Modules which include a few minute Manifest File bug fixes, and the latest Beta (which is likely to be the final release) of the Blue (v4.0) Sun SPOT SDK.


But for me, the biggest deal is that I was just cleared to release the v4.0 version of the Sun SPOT Manager Tool. Tere are some significant additions to this version, especially for first-time SDK users. The biggest news is that there is no more (and I mean NO MORE!) configuration to go through. Just run the Sun SPOT Manager tool. If you're missing anything, like the Sun JDK, or Ant, or NetBeans, the Sun SPOT Manager will install it for you! And even better, it will configure it for you!


What's that mean? Well, for those of you on Windows, there is no more editing the Registry to get your JAVA_HOME and ANT_HOME and PATH variables set up correctly. I do that for you. There is no more hunting around for the NetBeans Sun SPOT Modules. I install those for you. For an easy install, just "follow along" and accept all the defaults, and all the suggestions. In about 20 minutes, and after one reboot, your Windows XP box will be up and running the Sun SPOT SDK.


For you Vista users, there's only ONE additional step: Start the Sun SPOT Manager Tool, but as soon as it starts, and creates a desktop shortcut for you, quit it. Right click on the desktop icon of the Sun SPOT Manager Tool, and select "Properties." Go to the 'Compatibility' Tab, and click 'Run As Administrator.' Then restart it by double clicking on it. Just follow along, and in about 20 minutes, and one reboot, you'll be up and running.


Linux user? Same thing. Just run the Sun SPOT Manager tool, follow along, and when prompted to do so, log out, then login again.


Done!


I'll provide more details soon, but I wanted to get this posted before the Tropical Storms and Hurricanes arrive.


[ It wasn't that she had a rose in her teeth, exactly. It was more like the rose and the teeth were in the same glass. ]

[5] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg

Temperature/Humidity Sensor Revisited

Monday Aug 25, 2008

So I’ve blogged about using the Precon Temperature/Humidity sensor before, but it is time, apparently,to re-visit the topic. We’re working on a project with Vodafone, and I needed to write a brief “How To” for them, so I thought I’d just make it here so everyone (both of you) could benefit.


First, this sensor is possibly the easiest to hook up and interact with of any I have worked with. It has a simple analog temperature sensor and an analog humidity sensor that are just read as a percentage of the reference voltage supplied to the unit. So if the voltage supplied is 3.3v, and the humidity value read is 3.3, then you’re at 100% humidity. And it’s a simple linear scale, so there is no complex conversion, etc. The same is true of the temperature value, though the scale is -30° C to +100° C, so you have to do a little bit of adjusting of the raw value.


The wiring is extremely simple:



Precon1.png


That’s Pin 1 — Temperature — of the Precon to Pin A1 on the Sun SPOT for Temperature readings. Pin 2 of the Precon to +3v on the Sun SPOT — to power the sensor. Pin 3 — Relative Humidity — of the Precon to pin A2 of the Sun SPOT for RH readings. And Pin 4 — Ground — of the Precon to Ground on the Sun SPOT. The only other connection you need is +3.3v on the Sun SPOT to Pin A0 on the Sun SPOT for reference Voltage (vref). Since the sensor readings are a percentage of supplied voltage, you have to keep track of the supplied voltage, and this is how.


That’s it for wiring. Really.


Now, the code is just as simple. Once gain, really.


I used NetBeans, of course, to create the project using the Sun SPOT Application Template Module (for information of installing these templates, see here). Here’s the code for the main class:



/*
* RHGPS.java
*
* Created on Aug 21, 2008 4:54:22 PM;
*/

package org.sunspotworld;

import com.sun.spot.peripheral.Spot;
import com.sun.spot.sensorboard.EDemoBoard;
import com.sun.spot.sensorboard.peripheral.ISwitch;
import com.sun.spot.sensorboard.peripheral.ITriColorLED;
import com.sun.spot.sensorboard.io.IScalarInput;
import com.sun.spot.util.*;
import java.io.*;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

/**
* The startApp method of this class is called by the VM to start the
* application.
*
* The manifest specifies this class as MIDlet-1, which means it will
* be selected for execution.
*/

public class RHGPS extends MIDlet {

private ITriColorLED flash = EDemoBoard.getInstance().getLEDs()[0];
private static int SLEEP_INT = 250;

protected void startApp() throws MIDletStateChangeException {
System.out.println("Hello, world");
new BootloaderListener().start(); // monitor the USB (if connected) and recognize commands from host
IScalarInput vref = EDemoBoard.getInstance().getScalarInputs()[EDemoBoard.A0];
RHSensor rh = new RHSensor(EDemoBoard.A1, vref);
TempSensor ts = new TempSensor(EDemoBoard.A2, vref);
long ourAddr = Spot.getInstance().getRadioPolicyManager().getIEEEAddress();
System.out.println("Our radio address = " + IEEEAddress.toDottedHex(ourAddr));

ISwitch sw1 = EDemoBoard.getInstance().getSwitches()[EDemoBoard.SW1];
flash.setRGB(100,0,0); // set color to moderate red
while (sw1.isOpen()) { // done when switch is pressed
try {
// done when switch is pressed
flash.setOn(!flash.isOn());// Blink LED
System.out.println("Temp: " + ts.getTemp() + " Degrees C.");
System.out.println("Humidity: " + rh.getRH() + "%");
Utils.sleep(SLEEP_INT); // wait 1 second
} catch (IOException ex) {
ex.printStackTrace();
}
}
notifyDestroyed(); // cause the MIDlet to exit
}

protected void pauseApp() {
// This is not currently called by the Squawk VM
}

/**
* Called if the MIDlet is terminated by the system.
* I.e. if startApp throws any exception other than MIDletStateChangeException,
* if the isolate running the MIDlet is killed with Isolate.exit(), or
* if VM.stopVM() is called.
*
* It is not called if MIDlet.notifyDestroyed() was called.
*
* @param unconditional If true when this method is called, the MIDlet must
* cleanup and release all resources. If false the MIDlet may throw
* MIDletStateChangeException to indicate it does not want to be destroyed
* at this time.
*/

protected void destroyApp(boolean unconditional) throws MIDletStateChangeException {
for (int i = 0; i < 8; i++) {
flash.setOff();
}
}
}


So that's the Main portion. You will notice that there is reference to 2 other classes, RHSensor and TempSensor. Those are amazingly simple classes, listed here:



/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package org.sunspotworld;

import com.sun.spot.sensorboard.EDemoBoard;
import com.sun.spot.sensorboard.io.IScalarInput;
import java.io.IOException;

/**
*
* @author davidgs
*/

public class TempSensor {

private IScalarInput temp;
private IScalarInput vref;

/**
*
* @param pin Pin number for analog reading of Temperature
* @param vref IScalarInput pin for voltage reference
*/

public TempSensor(int pin, IScalarInput vref) {
this.temp = EDemoBoard.getInstance().getScalarInputs()[pin];
this.vref = vref;
}

/**
*
* @return Double value of degrees C
* @throws java.io.IOException
*/

public double getTemp() throws IOException {
return (((double) temp.getValue() - 115) / (double) vref.getValue()) * 100;

}
}




/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package org.sunspotworld;

import com.sun.spot.sensorboard.EDemoBoard;
import com.sun.spot.sensorboard.io.IScalarInput;
import java.io.IOException;

/**
*
* @author davidgs
*/

public class RHSensor {

private IScalarInput rh;
private IScalarInput vref;

/**
*
* @param pin pin number for the relative Humidity sensor
* @param vref IScalarInput pin for voltage reference
*/

public RHSensor(int pin, IScalarInput vref){
this.rh = EDemoBoard.getInstance().getScalarInputs()[pin];
this.vref = vref;
}

/**
*
* @return double-precision relative humidity as calculated by:
* rh pin value / vref pin value * 100
* @throws java.io.IOException
*/

public double getRH() throws IOException{
return ((double)this.rh.getValue() / (double)vref.getValue()) *100;
}

}

And that's all there is to it. A simple ant deploy run will put the application in your Sun SPOT, and start it spitting out Humidity and temperature readings every 1/4 second.

Like this post? del.icio.us | furl | slashdot | technorati | digg

Tap, Tap, Tap ... Is this thing on?

Monday Aug 25, 2008

I hate to use public humiliation as a means to get action, but sometimes, it's the only way. I've been trying for a week to get some response -- any response -- out of Facebook support. I know, you may think that is an oxymoron right there, and given my current experience, I'm inclined to agree with you.


How hard is it for a support organization to actually respond to issues submitted in a finite amount of time? How hard can it really be? Seriously.


Here's the issue. I own a group on Facebook for the Wake County Special Education PTA (Wake SEPTA). I'm their de facto webmaster. So I decided to promote them on Facebook. Why not, right? Well, I managed to somehow click the wrong button and change my location. Duh. Silly mistake. But it, apparently has dire consequences. I lost Administrative rights to my Raleigh/Durham based group, WakeSEPTA. This wouldn't be a problem if there were other Admins that could re-authorize me. But there aren't, so the group is 'orphaned' such that no one can join, and I can't get back in to administer it.


So last week I began asking Facebook Support for help. So far, nothing. Not a peep. Not a response. No help. Nothing. Is the help alias hooked straight to /dev/null? Sure seems like it.


One would think that Facebook would be interested in actually supporting users. But apparently once you're hooked, they don't much care. I'd love to get this issue resolved. I would have loved to have gotten this issue resolved a week ago. Seems like an easy thing to fix. But it does take some response from Support before it can get fixed.


[ Wethern's Law:


Assumption is the mother of all screw-ups. ]

Like this post? del.icio.us | furl | slashdot | technorati | digg

Personal Goal Achieved

Wednesday Jul 16, 2008

So back in 1998, while I was the Technology Manager for Sun Ray, I set a goal for myself of winning the Chairman's Award (as it was called at the time). This is a very prestigious award at Sun, and is remarkably hard to win. I worked myself near to death for years trying to win this award, to no avail.


3 years ago I left the Honeycomb Team in the Labs a few months before they won the award (now called the Sun Innovation Award). Once again, close, but no cigar.


So I'm very happy, and feel honored, that the Sun SPOTs Team has won an Innovation Award for FY08. This is a very high honor indeed, and I am pleased to be a part of such a fantastic team that has produced an innovation worthy of such high honor. This was certainly a Team effort, and everyone associated with the project deserves the recognition. So, my hat is off to my team members for getting me somewhere I have aspired to for many years.


Team Members:



Again, this was a Team effort of enormous proportions. The Hardware folks delivered unmatched quality with a stunningly low level of returns and errors. The Software team (Squawk and the Sun SPOT Team) delivered some remarkably stable software, and we have seen the adoption of Sun SPOTs increase through both sales and our Sun SPOT Open Grant Program.


But without our users, customers, champions and supporters, we'd be toiling in obscurity, so it is really thanks to all who use Sun SPOTs, are enthusiastic about Sun SPOT, and the entire community. Thank you.


[ I'm rated PG-34!! ]

[2] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg

It's a sad day

Tuesday Jul 15, 2008

As of 2 minutes ago, the search for Nancy Cooper, our neighbor, is officially over. Her body was found last night. I don't even know what to say. I am at a loss for words, and am deeply saddened. The neighborhood of Lochmere is an open, friendly, and close-knit community and this hits hard.

[2] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg

Nancy Cooper Search Site

Monday Jul 14, 2008

There's now a site dedicated to the search for Nancy Cooper. If you can volunteer, please do so! http://nancycooper.blogspot.com/

Like this post? del.icio.us | furl | slashdot | technorati | digg

Search for Nancy Cooper

Monday Jul 14, 2008

Family and friends of Nancy Cooper thank all of those who helped on Sunday with the search for Nancy. They had 150+ people looking on trails and covering the city with close to 2000 fliers. Truly the fliers are everywhere, which is a good thing.


The plan for today (Monday) is to go out and search more. There will be headquarters at both Lifetime Fitness and Java Jive starting at 9 am. From there people will be sent to a designated area to search in larger groups focusing on the area 20 feet to the sides of the trails and also out-lying neighborhoods. Volunteers are needed throughout the day.


Needless to say, we'll be out searching today. Hope you can join in.

[1] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg

Help find Nancy Cooper

Sunday Jul 13, 2008

Copied verbatim from Rich Sharple's blog, but this is big ... and scary for us.


One of our neighbors - Nancy Cooper has been missing since the morning of Saturday, July 12. She went for a run around 7am on Saturday morning in theLochmere / Regency Lake area of Cary, NC and never returned. Nancy is white, has shoulder length brown hair and hazel eyes, she’s 5 feet 9 inches tall and weighs about 120 pounds. She was last seen wearing a T-shirt, running shorts and light blue running shoes.



There’s more information and photos on WRAL.com and the News & Observer. If you’re a local blogger - please help spread the word and If you have any information contact Cary Police at 919-469-4016 / 4012.

[18] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg

Sun SPOTs in EDU

Thursday Jul 03, 2008

As some (many? both?) of you know, we have been running a special program for Education with Sun SPOTs. We have been accepting proposals, and granting Sun SPOT kits, for course development in Wireless Sensor Networks, Robotics, and a wide range of other topics. The courses developed through this program are required to be open source, and we're starting to get results!


RTI has submitted an interesting website with some of their course development activities and results. Check it out!


I'll post more as they roll in. If you're working on one of these projects, and you want to see your project listed here, just send me the link (again, if you already did and I ignored it) and I'll get it posted here!


[ The Kennedy Constant:


Don't get mad -- get even. ]

Like this post? del.icio.us | furl | slashdot | technorati | digg

Open Communications

Wednesday Jul 02, 2008

I think we (Sun) 'get it' and get it right, most of the time. Not on everything, for certain, but when it comes to communication, openness and transparency, we have that down. As a counter example ...


I use a nifty piece of software from BareBones Software called Yojimbo (I know, the name sort of blows, but it's a great 'digital junk drawer' for my Mac and helps me save, organize and keep track of lots of stuff in one place. But I digress). Don't get me wrong here, I love the product, and use it almost every day. But their communication strategy seems to be modeled on Apple's. Tight-lipped and reticent. The users on the Yjimbo users' alias are clamoring for answers, for insight into what may, or may not, be going to happen with the product, and where things are headed. the response from BareBones?


Yep, pretty much. Well, other than to point to their FAQ, which says:



We'd like to offer an iPhone version of Yojimbo, but can't currently say if/when this may happen nor what its feature set might be. As soon as we're able to provide more info about our plans, we will do so.



The equivalent of "we can neither confirm nor deny ..." and a non-answer. Don't get me wrong, I understand that at times it can be advantageous to carefully control the release of information so as to not over-promise, under-deliver, or to make a big splash with your announcements. But there is a lot to be said for involving your users, for making them feel involved, a part of the process, and invested in your products. A user that has a mere affinity for a product is not nearly as good as a user that has an investment in, and a commitment to, a product or company. Involving your users gives them the investment and commitment to make them useful assets, not just the other end of the payment stream.


And what has all this to do with Sun? Well, I really think that this little experiment we call blogs.sun.com is a shining example of what can come of a company that values open communication with its customers -- and potential customers. Very few of our customers, I would venture, are unclear about what we are working on, where we are investing, and what they can expect from us. Yes, we all want to see more from the stock price, etc. but it's pretty clear that we have a real commitment to open communication with our customers.


I wish more companies would show the same.


[ "Now is the time for all good men to come to."


-- Walt Kelly ]

Like this post? del.icio.us | furl | slashdot | technorati | digg

The Hair Project

Monday Jun 16, 2008

Two years of hair comes almost full circle. When I moved to North Carolina in 2006, I did this:


DSCN0340.png


Yep, cue-balled it. It was easier than having to wash it.


But as soon as I moved here, my then-9 year-old son began a project to grow his hair and donate it to Locks of Love. It was his own idea, and something I'm proud of him for coming up with. And he asked me to do it with him, so I did. Well, last week was cutting time, and I went from this:





IMG_0049.png


to this:





IMG_0053.png


in 10 minutes.


I feel much better now.


[ The only thing to do with good advice is pass it on. It is never any use to oneself.


-- Oscar Wilde ]

[1] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg

Above Average

Friday Jun 06, 2008

So the ratings for the JavaOne Hands On Labs came out, and we (Sun SPOTs) did pretty well. Above average, to be exact.



The following scores are generated using the Overall Quality values.

Overall Conference Average (all sessions) 4.12

BOF Average 4.01

Panel Average 3.92

Hands-On Lab Average 4.30

Technical Session Average 4.13


The Sun SPOT Hands On Lab rated a 4.57, the Birds of a Feather (BOF) rated a 4.2, and the Technical Session rated 4.38. All respectable, and well above average.


Thanks to all of you that attended, and gave us such nice feedback!!


[ Mother told me to be good, but she's been wrong before. ]

Like this post? del.icio.us | furl | slashdot | technorati | digg

Random thought on Energy

Thursday Jun 05, 2008

So this has nothing to do with Sun SPOTs (that I know of anyway), and probably isn't at all revolutionary, but still, it troubles me.


We're spending lots of time and energy on alternatives to fossil fuels for automobiles and power generation, since we (rightly) believe that there is a limited, and ever dwindling, supply of such fuels. I think this is great, and hope we get somewhere fast with this technology or technologies. It will help us with the radical climate change we have caused -- and don't argue with me about that one, I'm not interested in hearing the "I don't believe in climate change" stuff. It's real. Deal with it.


But one thing I have never heard discussed is ... what are we going to use to power jets for air travel? The idea of an electric jet, or a solar-powered jet, just doesn't seem like it's feasible. Is anyone thinking about such a thing? Or are we going to re-expand the world and go back to electric trains and steam ships for long-distance travel?


Just my random thought.


[ If God is perfect, why did He create discontinuous functions? ]

[6] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg

We've passed 1K

Thursday Jun 05, 2008

The Sun SPOT Forums have now passed 1k registered users! Might not seem like a big deal to you, but we think it's pretty cool how our little community of Sun SPOT users has grown over the past year. This time last year we had a little over 400 registered users, so this is indeed some pretty strong community growth! And the Sun SPOTs are a community project, so community growth, health and vitality is a great thing!


Speaking of community growth, we'd love to see some more (lots more!) YouTube videos of stuff you're doing with Sun SPOTs. Just remember to tag them with the keyword 'spaughts' so they show up in our You Tube Feed.


[ You don't sew with a fork, so I see no reason to eat with knitting needles.


-- Miss Piggy, on eating Chinese Food ]

Like this post? del.icio.us | furl | slashdot | technorati | digg

Cool Intern Tricks

Monday Jun 02, 2008

So one of Arshan's latest interns, Lachlan, is taking his internship seriously and doing cool stuff, and blogging about it. Check it out and give him some blog-love!


[ If you think the United States has stood still, who built the largest shopping center in the world?


-- Richard M. Nixon ]

Like this post? del.icio.us | furl | slashdot | technorati | digg

Forums almost at a milestone

Friday May 30, 2008

So it was pointed out to me today that our forums are teetering on the edge of 1k users. That would be a major milestone for us, as it is, for our little project, a lot of interested users. Of course, I'm still the most prolific poster there, but then again, it's my job, so if I weren't, I'd be in big trouble!


Wonder how long those last few users to get us over the top will take?


[ If you can't be good, be careful. If you can't be careful, give me a call. ]

Like this post? del.icio.us | furl | slashdot | technorati | digg

Off the mark

Friday May 30, 2008

Ok, so I've been lagging in my blogging a lot recently. Too much else to do. You know, work and stuff. I've fallen off the main page, and my popularity has suffered. Guess I have to get back to regular updates, huh? I got distracted by twitter. But as the reliability and performance of twitter rapidly decrease, maybe I"ll get back to actually blogging.


[ You can't hold a man down without staying down with him.


-- Booker T. Washington ]

Like this post? del.icio.us | furl | slashdot | technorati | digg

SPOT Certified

Tuesday May 20, 2008

SunUniversityCertificate.png

I got Sun SPOT Certified, now you can too! Just take the Sun SPOTs Course, and pass all the tests. Ok, so you're not 'certified' but you get a certificate (suitable for framing, I hear).

Its a great course, with lots of very good information, well presented, interactive, and informative. And I'm not just saying that. check it out.

[ Every four seconds a woman has a baby. Our problem is to find this woman and stop her. ]

[1] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg

Pimping myself

Tuesday May 20, 2008


J1HeaderImage.jpg

So it's official. I'm now pimping myself out to teach a version of the Hands On Lab I taught at JavaOne this year. Yep, that's right. I'm changing the content somewhat, but the basic premise is the same: Hardware development for Software developers. I'll lead you through the entire process of developing a small wireless sensor application that wireless communicates sensor data (bend sensor) to a remote actuator (servo).

I come complete with the Sun SPOT kits and all the hardware. All you have to do it pay my travel expenses. Unless you're in the Raleigh, NC area. In which case we'll have to come up with some other incentive.

Exotic locations preferred.

[ When more and more people are thrown out of work, unemployment results.

-- Calvin Coolidge ]

[1] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg

SPOTs on Engadget (again)

Tuesday May 20, 2008

So I just get back from 4 days of blissful ignorance (as opposed to my usual miserable ignorance) to see that Sun SPOTs have made engadget (again). This time for Mike's Flying Bike. If you're too lazy to click any of the links, you can watch the video here:



He was actually supposed to come to the Sun SPOTs BOF at JavaOne, but I think he fell off his bike trying to land at Heathrow or something and got injured.

[ There is no distinctly native American criminal class except Congress.

-- Mark Twain ]

[1] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg