Monday Oct 06, 2008

Linear Actuators

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. ]

Tuesday Sep 23, 2008

Android uses SPOT idea

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! ]

Thursday Sep 18, 2008

GPS SPOT Updated

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. ]

Friday Sep 05, 2008

Sun SPOT Manager v4.0

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. ]

Monday Aug 25, 2008

Temperature/Humidity Sensor Revisited

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.

Tuesday Jul 15, 2008

Personal Goal Achieved

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!! ]

Thursday Jul 03, 2008

Sun SPOTs in EDU

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. ]

Friday Jun 06, 2008

Above Average

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. ]

Thursday Jun 05, 2008

We've passed 1K

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 ]

Monday Jun 02, 2008

Cool Intern Tricks

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 ]

Friday May 30, 2008

Forums almost at a milestone

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. ]

Tuesday May 20, 2008

SPOT Certified

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. ]

Pimping myself


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 ]

SPOTs on Engadget (again)

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 ]

Thursday May 15, 2008

Headers and Sockets


terminal.png

So there have been some questions recently about what part numbers are the socket and header we use for connecting things to Sun SPOTs. So I thought I'd answer as best I can.

The Sun SPOT kits now ship with a socket, though it is not actually attached to the eDemoBoard (it is in a bag inside the box). That socket is a Samtec connector part SDL-110-T-12 and your SPOT kit should have 2 of them in it already. Unless you were an early adopter, in which case, contact us and we'll get you a couple.

That gives you a socket with 0.018" holes to plug stuff in to. But In order to be able to easily attach things like jumper wires, etc. you will probably need the Samtec connector part TD-110-G-A which will give you a 0.025" Male pin to attach stuff to, rather than the tiny 0.018" female you get from the socket.

[ Everyone is a genius. It's just that some people are too stupid to realize it. ]

Monday May 12, 2008

Phidgets and SPOTs

So the Sentilla folks were all over JavaOne this year, of course. We love those guys, and members of the Sun SPOTs Team have beers with some of the Sentilla folks at least once a month. Any rumors you hear to the contrary are false (and if you talked to the one guy in the Sentilla Booth who said Sun SPOTs were "the enemy" don't believe that, either).

That being said, I was intrigued by Sentilla's use of Phidgets. They have a plug right on the Sentilla spot for plugging in Phidgets, which makes it really easy (makes it harder to use anything BUT a phidget, of course, but I digress).

So I went back to my hotel at JavaOne and ordered up some Phidgets to play with when I got home, and lo and behold, there was a box on my doorstep when I arrived home! I ordered the Light Sensor, the Force Sensor, the Magnetic Sensor, the Slider, and the Voltage Divider. Figured that was a decent set to start with.

They come nicely packaged, with nice connector cables. Here's what they look like:


P5120433.JPG

Slider -- not really a sensor, but neat


P5120434.JPG

Voltage divider. Would have been nice for the J1 HOL

P5120435.JPG

Light sensor. We have one built in, but a remote one is intriguing

P5120436.JPG

Force sensor. Interesting possibilities

P5120437.JPG

I see a door-open detector in my future


These are all 5-volt analog sensors, so I figured they should be pretty easy to deal with, and boy was I right! First thing was to hook one up. I started with the Force Sensor. I grabbed some jumper-wires, and plugged them in. Yeah, it would be nice to have a connector I could just plug a Phidget into, but I'd rather have the flexibility of using any sensor, and the lack of a specific plug isn't a hurdle. My SPOT looks like this:


PhidgetSPOT.png

SPOTs and Phidgets

And yeah, that's all it took to hook it up. So Now to write the code. I figured this would be easy, but really ...

I went to NetBeans 6.1, and clicked 'New Project', then selected a New Sun SPOT Application:



Phidget1.png

The new Sun SPOT Application Project type

Named it:



Phidget2.png

I was using the Force Sensor first

And started working on it:



Phidget3.png

Complete project made for me by NetBeans

I had to write 2 lines of code. Yes, 2. NetBeans took care of the import statement for me, as well as the try/catch block. The lines I wrote are highlighted in Red:



Phidget4.png

2 lines of code. Just 2!!

Click the 'Run' button, and start getting data from the Phidget:



Phidget5.png

Output values printed

Force readings from the force sensor show up in the console. It couldn't get any easier.

The entire process took me 2 minutes. 2 minutes!!! From there, I was able to unplug the Force Sensor and plug in the Slider and without changing the code at all get readings from it. I tried all the sensors, and without changing a single line of my code (all 2 lines of it!) I was able to read all the sensors.

I am not sure how it could get any easier. Maybe having the specific plug on the header would have made it easier, but seriously, hooking up 3 jumper wires is not that much harder than just plugging it in, is it?

Now, to find something to do with these Phidgets!

[ "Protozoa are small, and bacteria are small, but viruses are smaller than the both put together." ]


SPOTs at JavaOne

So Arshan got interviewed by Chis Melissinos about Sun SPOTs:

JavaOne was nuts. But at least we got some coverage.

[ Good day for overcoming obstacles. Try a steeplechase. ]

Thursday Apr 24, 2008

This is BIG News ... Sun SPOT Dev builds, and more

So I was going to write a long and involved blog post about the release of the ‘nightly’ builds (which don’t happen every night, so don’t get all excited. We’re going to call them ‘nocturnal builds’ since Eric mostly works at night anyway). But then Ron posted this excellent post in the forums about it all, so I decided to just copy it and post it here. Saves me a ton of work.

A couple of points about this:

  1. It means we are making our untested dev builds available, which means that the code has not necessarily been tested. Which means that there may very well be significant bugs. But there may also not be, and we have usually fixed other bugs, so it’s a trade-off.
  2. It makes the Sun SPOT Manager Tool v3.0 (formerly known as Truth or Consequences) the default Sun SPOT Manager Tool. It also makes that freely available to everyone. No more secret sauce there.
  3. It means that the Software Only SDK (the stable version is v3.0 (Purple)) is now freely available to everyone. No more Beta emails to me. Just go fire up the Sun SPOT Manager Tool (here: spotregular.png ) and away you go. I’ll post more detailed instructions shortly.

So here’s Ron’s excellent post, in case you don’t want to go all the way over there to read it:

As part of our efforts to open source our Sun SPOT work we are delighted to announce that we are making available our nightly builds (which actually happen every 2-3 weeks). These builds are based on the current source code in the java.net SVN archive.

Note that these are pre-alpha releases that have not undergone any testing, so use them at your own risk. However we imagine that some folks will want to try out the latest features and bug fixes. This is the SDK version that members of the Sun SPOT Team use for our daily work, so if it is really broken we will normally fix things and do another build right away.

To install a nightly build, go to http://www.sunspotworld.com/SPOTManager/ and click on SPOTManager, or just start up the SPOTManager application if you have already installed it. In the SPOT Manager open the Preferences tab and select "Dev Preview". Then go to the SDK tab and choose the build you want to install.

When reporting problems or bugs please be sure to specify which version of the SDK you are using.

\*\*\* Major Changes \*\*\*

\* Can now deploy multiple application suites to be loaded & run on a SPOT
\* Several new ant commands
\* Demos are now included as part of the SDK: <sdk>/Demos
\* Two new demos have been added: DatabaseDemo & HTTPDemo
\* The SPOTWorld application is now called Solarium
\* Many SPOT library jar files were renamed or moved
\* Almost 200 bugs fixed


The biggest change from Purple is support for multiple application suites to be loaded & run on a SPOT. One can now deploy several applications to a SPOT without disturbing already running applications. See "ant help" for details.

For the most part the SPOT library APIs have not changed, so most of your SPOT applications should compile without needing any changes. However, a number of library jar files have been renamed or moved. This should not affect anyone who uses the ant scripts to build & deploy SPOT apps, but it may cause people using an IDE like NetBeans or Eclipse to not find various library packages.

For NetBeans users this information is specified for each project in the project.xml file in the nbproject folder. We are now using a much better way to specify the classpath using the same properties that are used when building a project with ant. In your project's project.xml file please change:

old: (located near the top)

Code:
<properties/>


new: (for SPOT apps)

Code:
<properties>
<property-file>${user.home}/.sunspot.properties</property-file>
<property-file>build.properties</property-file>
<property-file>${sunspot.home}/default.properties</property-file>
</properties>


or (for SPOT host apps)

Code:
<properties>
<property-file>${user.home}/.sunspot.properties</property-file>
<property-file>build.properties</property-file>
<property-file>${sunspot.home}/default.properties</property-file>
<property-file>${netbeans.user}/build.properties</property-file>
</properties>


and

old: (located near the bottom - xxx = local pathname)

Code:
<classpath mode="compile">xxx/SunSPOT/sdk/lib/spotlib_device.jar:xxx/SunSPOT/sdk/lib/spotlib_common.jar:xxx/SunSPOT/sdk/lib/multihoplib.jar:xxx/SunSPOT/sdk/lib/transducerlib_rt.jar</classpath>
<classpath mode="boot">xxx/SunSPOT/sdk/lib/squawk_rt.jar</classpath>


new: (for SPOT apps)

Code:
<classpath mode="boot">${sunspot.bootclasspath}</classpath>
<classpath mode="compile">${sunspot.classpath}</classpath>
<built-to>build</built-to>
<source-level>1.4</source-level>


or (for SPOT host apps)

Code:
<classpath mode="compile">${hostagent.compile.classpath}:${libs.absolutelayout.classpath}:${libs.swing-layout.classpath}</classpath>
<built-to>build</built-to>
<source-level>1.5</source-level>


Bugs that have been fixed are listed in the file changehistory.html located in the SDK doc folder. Note that bugs numbered 1231 or higher can be found on java.net at: https://squawk.dev.java.net/issues/query.cgi

[ "One planet is all you get." ]

Tuesday Apr 22, 2008

SPOTs Talk online

So if you missed the Sun Labs Open House, then here's your chance to see the Sun SPOTs 'Lightning Talk' from the Open House:



It's long, but worth it, of course. Especially the last part.
[ I brake for chezlogs! ]

Hands On Lab

So I have been killing myself getting all the finishing touches on the Hands On Lab I'll be teaching at JavaOne in 2 weeks. Talk about a boat-load of work! I gave two 'dry-runs' at the Sun Labs Open House last week, and Tsuyoshi Miyake blogged about it -- and he didn't even get to come to it! You can read about it here (if you read Japanese) or here if you don't.

[ Screw up your courage! You've screwed up everything else. ]

Another Milestone

Our Beta of the Software only SDK (which, if you already have a Sun SPOT SDK, you don't really need, as it's the same thing) has now reached 180 participants!

So let me explain a little more about the "Software-Only SDK Beta" that we are running. It is, in large part, a beta of the new Java Webstart Installer, which is itself an evolution of the Sun SPOT Manager Tool.

We decided that shipping CDs was impractical, and we wanted more folks, those that might not be able to purchase a Sun SPOT Kit for whatever reason, to be able to work with the SDK. As Solarium has matured, and with the inclusion of the Sun SPOT Emulator, it is now possible to completely develop and test many Sun SPOT Applications without Sun SPOT Hardware. I've posted some examples in various previous blog entries.

If you have a Sun SPOT Kit, then you can upgrade your SDK to the v3.0 (Purple) release using Sun SPOT Manager, and have access to the emulator, and Solarium, and everything else, without joining the Beta. If you have a kit, and want to play around with the new version of Sun SPOT Manager, then by all means sign up for the Beta!

[ You can't judge a book by the way it wears its hair. ]

Saturday Apr 12, 2008

NetBeans and Sun SPOTs

So many of you (both of you? :-) ) may have read my previous posts (here and here) on the recently updated NetBeans modules for Sun SPOTs which work with NetBeans 6.0 (and 6.0.1). Now we have confirmation, in the form of a very nice tutorial, that the modules also work with NetBeans 6.1rc1.

Now, if I could only make some headway on the whole NetBeans naming scheme that is driving me to distraction ...

[ She's genuinely bogus. ]

Friday Apr 11, 2008

Our friend EDGAR

I have a long list of topics I have to catch up on, so please bear with me. One of the fun things we do around here is what we used to refer to as our 'Friday Projects.' Somehow they usually manage to get us into some sort of trouble, and often they take longer than a Friday.

EDGAR managed to only do one of those things -- take longer than a Friday. Sadly, given how completely underwater I have been with other mundane and less-interesting tasks, I was not able to participate in most of the preparatory work for EDGAR, but I was able to be there for the launch. It managed, somehow, and even though it has to rank as one of our more danger-laden capers, to not land us in any trouble, either with the powers-that-be at Sun (at least so far :-) ), or with various government agencies -- and it had real potential on that front.

So the back-story ... A few months ago (I may have even posted it here, but since I'm blogging from 33,000 feet, I can't check) we found a website where some guy launched a weather balloon, complete with sensors and camera, to 70,000 feet. The pictures were amazing, and it seemed like a cool thing to try. And EDGAR was born.

As usually happens with our hair-brained schemes, the project quickly ballooned out of control, taking on a life of its own. We recruited internet volunteers, and even got Sun's own Charlie Jackson (our intrepid Web Designer/guru) to pilot a chase-plane (though I suspect he just wanted to go flying and this was his excuse).

The Team (which, I will point out again, did not really include me, except peripherally) designed a payload with a Sun SPOT, and an APRS Radio, for tracking and data gathering. I arrived in time to at least watch the final preparations of the payload. We walked it around MPK Campus to test some things out. It looked a tad fragile outside the payload, but it worked:


EDGAR-Prep1.png

"Go ahead, I dare you to take that into an airport ..."

That's Arshan, and Tennessee walking the beast around the campus to test the radio. Part of the testing also included beer, of course:


EDGAR-Prep2.png

mmmm beer

After all, who knows exactly what we might encounter in the upper atmosphere, right? For all we know (having never been there) there's a kegger going on. Turns out we still don't know, but I'll get to that.

So, all the testing done, we decided to launch from down near Holister, CA (nothing to do with that silly clothing that's all the rage these days). By the calculations that Tennessee did, we expected our balloon to rise at approximately 600 - 700 feet per minute, to a pre-determined altitude of between 70,000 and 80,000 feet before the Sun SPOT triggered the balloon to be cut free, the parachute to deploy, and our payload to come screaming back to earth at roughly 1,000 feet per minute. All the while taking pictures and collecting data. The payload should touch-down over near Visalia in the central valley about an hour and a half after launch.

That was the plan. Amazingly enough, it's pretty much what happened. Most of us gathered in a field outside San Juan Bautista and began preparing for launch while the chase-plane team got in the air and the recovery team high-tailed it for the central valley to meet the payload.


EDGAR-Day1.png

We're out standing in our field


As you can see, we were well within the less than 50% cloud cover required for launch. Of course. Arshan made some final software preparations, in consultation with our resident radio expert Glenn Scott.

EDGAR-Day2.png

"I'm telling you ... "


By the look of it, we don't want to know the exact nature of the consultations.


EDGAR-Day4.png

"No, seriously, that'll never work."


I have to say that I have no pictures of the actual launch, etc. as I was rather busy at the time (in my Playtex Living Gloves) actually inflating the balloon and launching it. However, we had a large collection of 'documentarians' around snapping away furiously. So feel free to visit some of their pictures:


Launching the balloon was a blast. Who knew that just letting a balloon filled with lighter-than-air gas could be such a ... gas! We tracked it as long as we could with the binoculars and the telescope, and then set off on the chase.

After an hour's drive (or so) through the Central Mountains of California, we met up with the recovery team. Amazingly enough, they had parked and waited for the return package, and it landed within about 1 km of them, and their predictions of where it would land. Here is the happy team with the successfully recovered EDGAR payload:

EDGAR-Day5.png

That's George, Lach, Bones, Tennessee and Arshan

We were all smiles an high fives. Then we opened the payload to retrieve the camera and data-collection SPOTs:


EDGAR-Day6.png

It takes many hands to extract the payload


EDGAR-Day7.png

Yep, it's all still there. No one stole it while it was up there.


Everything inside was in fine shape. A little ice here and there, and very cold still, but no damage. By the tracking data we got from the APRS radio, we knew that the balloon had flown much higher than we expected, to almost 90,000 feet. We also knew that the mechanism to cut the balloon free had not functioned properly, since pieces of the tattered, burst balloon were still attached.


We were very disappointed to find that, apparently, we had done something wrong in the packaging of the payload prior to launch, and the Sun SPOT was not powered on. So we got no data, and no pictures. Disappointing as those things were (are), we were still excited by the success of launching and recovering the balloon and its payload. We can fix the rest in software.


So we were all set to begin preparing for a follow-on launch -- EDGAR-2, but it turns out that while we were out doing our launch, our good friends at Warren-Wilson college had, literally, turned green with envy and deployed EDGAR-2. So now we have to go to EDGAR-3.


If you're interested in participating, this is an 'open' project. We are recruiting anyone who's interested. Just join us over at http://groups.google.com/group/spotballoonand let's see if we can't collect data this time. I'm especially interested in capturing pictures, so I'm working on a new payload container with a moveable camera in hopes that we can get lots of pictures this time.


So join us. Let's make EDGAR-3 even more successful than EDGAR-1. Given the competition from EDGAR-2, we have our work cut out for us.


[ "How do I love thee? My accumulator overflows." ]

Radio SPOT


Payload-1.JPG

This is cool. Anyone who reads this blog knows how much we love the folks at Warren Wilson College in Asheville, NC. Not only are they doing really cool stuff, but they are even cooler people who get us. When we did the EDGAR project last week, we immediately got a response from them with their EDGAR-2 project.

Then today I get an email from Chris Fusting with a link to this cool NPR story he got done on himself and Sun SPOTs. Way cool Chris!

[ A real patriot is the fellow who gets a parking ticket and rejoices that the system works. ]

Thursday Apr 10, 2008

Huh? What? Ok, parts.

So, I went from blogging several times a day, and sometimes more, to ... complete radio silence.

Well, that's because of the Sun Labs Open House, which ended today, and my preparations for my JavaOne Hands On Lab are coming to a close. I was so far under water you couldn't even see the bubbles anymore.

But I did have a piece of news for all of you budding hardware developers. Coming in about 2 weeks, you will be able to order the connectors we use on Sun SPOT boards directly from digikey. They aren't listed yet, but the part numbers are:



DF17A(1.0H)-30DP-0.5V(57) 30 pin header RoHS compliant
DF17A(3.0H)-30DS-0.5V(57) 30 pin receptical RoHS compliant


Those are the connectors we use to connect the Sensor Board to the Main board.
[ A nuclear war can ruin your whole day. ]

Monday Mar 31, 2008

CampusCast Props

So I have to say that, while I did do part of presentation at Virginia Tech back in November, I wasn't the only one. Arshan was with me, as was one of his interns, Martin. THough, to listen to this CampusCast webcast, you'd never know it.

I'll take all the props I can get I guess. :-)

[ You have junk mail. ]

Thursday Mar 27, 2008

Beta hits 120

We got our 120th Sun SPOT Software-Only SDK Beta user today!! Why do I like round numbers so much? If you want to join the Beta, and get us to another round-number milestone, please feel free!

[ Death is Nature's way of recycling human beings. ]

Wednesday Mar 26, 2008

How High can a SPOT go?

We intend to find out. And we'd love all the participation we can get. You see, someone else launched a weather ballon with a camera and some sensors, etc. on it. And it looked cool. So we decided to try our hand at it. Our current plan of record is to launch sometime over the weekend of April 5th in California. Current plan also calls for actually recovering the balloon and its payload, but the success of that remains to be seen.

So how can you get involved? Well, join the project on Java.net and get busy! We'll need everything from folks writing code to people just wanting to be spotters and help with the recovery effort. Come one, come all! Let's see if we can get a Sun SPOT to the edge of space! Could this be the rebirth of the Sun Labs Space Program? Come find out!

[ Fertility is hereditary. If your parents didn't have any children, neither will you. ]

Sun SPOT Modules Updated

So the Sun SPOT Modules for NetBeans 6 (specifically for 6.0.1) have been updated and released. If you have read my previous post on the subject, and the comments, you know that the SPOTs Info/Welcome module had mysteriously disappeared from the Update Center. Well, that's been fixed as well.

Ron Goldman has also made some changes to the other modules which should make them better.

So the Sun SPOTs Info/Welcome module is now in the Update Center for Sun SPOTs.

In answer to several questions about having the 'Deploy' and other targets available to you in the Project Menus: We have not added the Deploy, etc. targets to the Menu System in NetBeans. They are available in Sun SPOT Projects by right-clicking on the project node and selecting them. Also note that the 'Run' Target under both the main menu and the Default Run Button in the toolbar will (if your Sun SPOT project is your main project) execute a "deploy run" action first building the application, then deploying it to your Sun SPOT, and finally running the application n your Sun SPOT.targets.png

You can always customize the targets for any of your projects. Just select the Project's Properties, and customize them using any of the ant targets available to the project.


targets2.png

And there you have it.

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

Monday Mar 24, 2008

Don't do that either

So I should be used to posting retractions. :-) But it was pointed out to me over the weekend that my previous post on what not to do (and what to do) was also incorrect.

Specifically, I should no have jumpered the +5v pin to VH, but instead should have powered the H0 high current pin directly off of the external power supply.

So here's an updated schematic of how you should wire up a servo to a Sun SPOT. THe other way will work, but according to one of our hardware gurus, Del Peck, it should be done this way:


servo.png

So there you have it. Another day, another correction. But now you know the right way to wire up a servo to a Sun SPOT.

[ Don't cook tonight -- starve a rat today! ]

About

user9157252

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today