Friday May 08, 2009

Amusing Ourselves with Sensors in the Field

My son's math/science club had an opportunity to see a real rocket launch at Vandenberg Air Force Base this week. Unfortunately, the weather was bad enough that our NASA hosts decided not to attend the launch which took away our inside track to the day's activities. We were already half way to Vandenberg (approximately 250miles away) when we found this out. Faced with the prospect of a long trip with the chance of seeing nothing through the fog we decided to change our plans, so we vectored off to Santa Cruz and its famous beach boardwalk for a little Sun SPOT-based physics fun.

You see, Santa Cruz boardwalk includes a bunch of amusement park rides. Our crack team of researchers (the 4th & 5th grade math/science club) decided to use the Sun SPOTs to measure the G forces experienced in some of these amusement park rides. Fortunately, the standard Sun SPOT Telemetry Demo is just perfect for this application. It displays, in real time, the output of all three axes of the accelerometer and a total G force reading. By simply putting a Sun SPOT in someone's pocket while they ride the ride, we can see what G forces their body is being exposed to. We measured 5 different rides:

  • Starfish - a spinning ride
  • SeaSwing - a large rotating swing ride
  • Bumper Cars
  • Hurricane - a roller coaster
  • Drop Zone - a vertical drop ride

Lets take a look at the project in a little more detail and see what we can learn.

Accelerometer Background

We used the eSPOT 3-axis accelerometer to monitor the motion. The Telemetry Demo application consists of two parts, one that runs on the eSPOT device and one that runs on the host computer. The application that runs in the eSPOT device takes accelerometer readings of all three dimensions and sends them over the base station to the where the data is received and plotted live on a laptop computer and saved for later analysis. (Yes, as you may have guessed, this implies that I was carrying a laptop computer around an amusement park - I wear my geek badge proudly) Accelorometer.png

The accelerometer on the eDemoBoard is actually 3 separate accelerometers, one for each dimension. The accelerometers are very tiny Micro Electro-Mechanical Systems (MEMS) devices hidden in a computer chip package. You can imagine that an accelerometer is made of two main parts suspended between two mounts. One of the parts connects to both mounts; we'll call it a bridge. The other only connects to one of the mounts, we'll call it the diving board. There is a mass on the end of the diving board so that it will wiggle around with respect to the bridge when the accelerometer is moved.

accel.jpg

If you were to grab this device by the two mounts and wiggle it up and down you can imagine that the diving board would bend slightly. When a charge is applied to the bridge and diving board, it creates a sort of capacitor. As that diving board bends ever so slightly, it changes the capacitance between those parts and this can be measured. This allows the accelerometer to report a signal that corresponds to the movement of the device in one dimension. Also, note that the diving board can only bend in on dimension (up and down in the diagram), not side to side. If you imagine three of these packed very tightly together, each oriented 90 degrees from the other, that is a useful model for what goes on inside the accelerometer.

You can also imagine that when a eSPOT device is lying on its back, just sitting stationary, the the Z axis diving board will be bent down slightly by gravity. In fact, it will have 1G (or 9.8 m/sec^2) of bend to it. Now if you turned it over so that it was lying on it's sun roof, that same Z-axis accelerometer would have its diving board board bending the other direction. Therefore, it would measure -1G (or -9.8 m/sec^2). Meanwhile, in both of these orientations, the X and Y axis accelerometers would have no gravity working on them so they would have a zero reading.

In fact, it is interesting to note that when the Sun SPOT device is not accelerating (or decelerating), the accelerometers an tell you how the device is tilted. In other words, it can tell you which way is down. That is because the square root of the sum the squares of all the values will add to 1G in a downward direction no matter what way you tilt it. If the X axis accelerometer is measuring a non-zero value and the Y axis accelerometer is measuring a non-zero value, but the Z axis accelerometer measures 0G then Z axis must be parallel to the horizon.

The Telemetry-onSpot samples the three accelerometers every 10 milliseconds and packages the readings into a wireless network packet to be sent to the host application. The Telemetry-onHost application receives these packets and plots them on a moving graph. The green, blue and red lines represent the X, Y and Z axes respectively. It also calculates the the sum of the absolute values of all three readings together. This can be useful in determining the over acceleration applied to the device.

The Experiment

We were interested in measuring the amount of acceleration that our subject's body is exposed to as it rides the amusement park rides. It is easy to max out the 6G accelerometer readings by just waving a Sun SPOT back and forth vigorously in your hand. Clearly this would not mean that the subject's entire body was experiencing many Gs worth of force, only their hand. So we determined that it is important to make sure that the device is securely fastened somewhere near subject's center of gravity. We found a front pants pocket to be a fine place put it. Also, it is handy that the Telemetry-onHost application provides some smoothing functions that can reduce some of the noise due to ride vibration.

Now its time to ride some rides.


Starfish

starfish.jpg
The starfish is a spinning ride that basically goes around in a circle at high speed. What we expect to see then is the force of gravity pulling down, plus the cetrifugal force of the ride spinning that makes you feel yourself pulled to the outside. We see a slight oscillation in the data that is either caused by the ride not being level, or slight speed variations in the motor. Generally, however, we see observe we are measuring about 1.3G or ~12.5 m/sec^2 total acceleration. If we assume that the centripetal force of the ride is at 90 degrees to the gravitational acceleration, and we know that gravity is contributing 1G worth of acceleration, we can calculate how much acceleration the ride is contributing with the following formula:
200905080549.jpg


200905072344.jpg

By plugging in values we can deduce that the ride is providing an extra ~7.8 m/sec^2 of acceleration or about 0.8G of lateral acceleration. If we knew the diameter of the ride, we could probably calculate the speed the ride was spinning.

starfish.png

A CSV file of the raw data is available here: starfish.csv.zip

Sea Swing

Seaswing.jpg

Like the Starfish ride, this ride spins, but it adds an extra twist. The riders are suspended in a swing and the entire ride tilts. Because of the tilt, the rider feels more acceleration on the upswing and less on the downswing as the ride goes round and round. This is borne out in the data that we see below. Once again, its very easy to observe the period of the rotation.
SeaSwing.png

A CSV file of the raw data is available here: seaswing.csv


Bumper Cars

bumper.jpg

In the bumper cars we see a lot of shaking around, but generally an average of 1G punctuated by the occasional jarring 2G jolt of a collision. This data is much more noisy and ultimately much more difficult to draw conclusions from.
Bumper.png

A CSV file of the raw data is available here: bumper2.csv

Hurricane


hurricane.jpg
The hurricane is a small roller coaster, but it gives us the most acceleration of any of the rides; approximately 4Gs! We can see that the ride lasted only about 40 seconds, but a lot is packed into that short time. If you look closely you can also see a few places early on where the Sun SPOT device changes orientation slightly. These are caused by the subject sitting down and the roller coaster and then heading up the initial hill. Also note that it is really hard to tell a turn from a hill. Because the roller coaster tilts around corners, both tend to push the subject down into their seat. As with many experiments, a gyro would be very helpful here because we could then determine how the subject is tilted in order to understand how to the forces that we are measuring are being applied. For more on this see my Location, Location, Location blog entry.

Hurricane.png

A CSV file of the raw data is available here: hurricane.csv.zip

Drop Zone


dropzone.jpg   DropZoneLong.jpg

This ride carries the subject up and down a very large tower at high speed. It created some of the prettiest data for us to work with. Because the motion of the ride is restricted to a single dimension, we don't have to worry about any missing data on rotation, so we can really figure out some interesting things about this ride. As you can see, there are three main up and down thrusts followed by three or four successively smaller moves. After a couple of runs (good research requires reproducible results), we found an average of about three Gs of acceleration during the initial lift. Interestingly, our data also shows that the free fall portion of the ride is not actually a free fall. In fact the data seems to suggest that the subject is pulled down with an acceleration of approximately -1G!
DropZone.png

A CSV file of the raw data for the two runs are available here: dropzone1.csv dropzone2.csv


Your Challenge

Take some of this data and see if you can analyze it further. In particular the DropZone ride is appropriately constrained to provide an interesting area for further exploration. An interesting exercise would be to take this data and calculate how high you think the ride lifts you and how fast you go up and down. Let me know what you come up with.

If there is interest, I can analyze the data in more detail and see what we come up with in a future blog.

Don't let anyone ever tell you that research isn't fun!


200905080607.jpg

Thursday May 07, 2009

There is now a new Beta version of the Sun SPOT software available.

It includes the latest features like:

  • Radio View - wireless network analysis tool
  • Robot View - Robot Simulation
  • Link Quality Routing Protocol - more reliable wireless communication
  • SPOT Web demo - web integrated sensors
  • Optional encryption library and demos
  • Yggdrasil data collection framework and demos
  • more

Its freely available, easy to install and you can always revert back to previous versions. Take a look for yourself and let us know what you think on the forums. If you haven't installed the development kit yet, you can do so here.

Once you have done that, you can get the beta version using SPOT Manager by clicking on the "Preferences" tab and choosing "Beta Update Center"


Untitled2.png

Then go to the "SDKs" tab, choose the lasted release and click "Install." Its very easy.


Untitled.png

Have Fun!

Thursday Apr 30, 2009

I have Two bits of news:

We are looking for your Sun SPOT project video

JavaOne is coming up and Sun SPOTs will be featured in talks and a "Birds of a Feather" as well as at the Change (Y)our World section of the main floor. One of the things that we will have in on the show floor is a large screen showing some of the projects that the Sun SPOT community has done with Sun SPOTs. If you have a project, and would like to make a short video of it in the next two weeks, we may show it on the big screen. Submit your videos to YouTube with the tag "spaughts" and drop me a line to let me know that you'd like participate. No project is too big or two small. Just give us a short video that shows us anything fun, cool, interesting you have done with Sun SPOTs.

Students get in Free!

If you are a student and you are interested in attending JavaOne, you can get in for free. I just learned about this program for students. In fact educators who bring 10 students can also get in for free. That's a pretty sweet deal.

Hope to see you there.

Tuesday Apr 28, 2009

Money is tight these days. If you would like to go to JavaOne, but don't have the means, make a video about why you should go to JavaOne and you could win a conference pass and money to offset travel expenses.

Check out information about the contest here.

Remember, Sun SPOTs might be worth extra credit.

Thursday Apr 23, 2009

We have some pretty exciting new features planned for upcoming Red (V5.0) release of the Sun SPOT software environment. In particular I'm really pleased with some of the improvements in the radio stack. We have improved the performance of the system over multiple hops significantly. One of the main difficulties of programming these distributed wireless devices is that it is often debugging communications. The current development release of the Sun SPOT Java Development Kit includes a new Solarium view called RadioVIew. It shows the current state of the network of Sun SPOT devices.

200904151933.jpg

The RadioView is built into Solarium and allows you to see the topology of your radio-space. What deivces can "hear" each other and what ones can't. This can help debug some of those nasty mutihop radio bugs and aid you in tracking down dead points in your radio space. Additionally, you can get information about each node and each link from the view to see what the signal strength is like for any particular link.

200904151934.jpg

How to try it out for yourself

Since our development is completely open, you can take a sneak peek at some of these features now as we develop them. First make sure that you have installed the Sun SPOT Java Development Kit. In the SPOT Manager Tool, select "Dev Preview" under the "Preferences" tab of SPOT Manager.

DevPreview.jpg

Once you have selected "Dev Preview" return to the SDK tab and you will find all the developer releases under "Available SDKs." Install the latest red-XXXXXX release. Then upgrade your Sun SPOT devices. Remember, its an unstable developer build, but any time you run into too many bugs you can always revert back to your previous version of the SDK.

SDKChooser.jpg

Once you are up and running, open Solarium and create a RadioView under the "Views" menu. It takes a few seconds for it to interrogate the network, but once you see your devices there, click around to get information about what is happening.

Also, don't forget that, as with any other Solarium view, Radio View can be "docked" to other Solarium views or made into an independent window simply by clicking and dragging on the area just below the titlebar of the window.

Enjoy!

Wednesday Apr 22, 2009

Here's another contest for anyone 17 or under who uses open source technology (like the Sun SPOTs hint hint). The contest, called Digital Open, is sponsored by the Institute for the Future, Boing Boing and Sun Microsystems.

Submissions are being accepted for anyone under 18 who creates open projects in the following categories:

It seems to me that Sun SPOT projects would fit in multiple categories!! Have fun!

Take a look at Digital Open. If you don't qualify, pass the info on to a nearby teenagers who would.

Tuesday Apr 21, 2009


We've got our share of uncertainty these days. The global economic downturn has caused a whole lot of uncertainty. Many people are losing jobs and the economy that thrives on hope is full of doubt. Yet there is a silver lining. More than ever people are reevaluating their work and their lives. They are figuring out new ways to increase efficiency, streamline their work, focus on what is important, in short reevaluate everything. Some people who are laid off from one job are finding the time right for starting up a new venture, something they might never have taken the initiative to do before. Others are finding better strategies to make themselves more competitive.

We got a large does of uncertainty yesterday as it was announced that Oracle planning to buy Sun. This is an official proclamation, not a rumor.

oraclelogo.gif & Sun-Logo-small.jpg

Several people have been asking about how the news of Oracle buying Sun will affect the various projects here in Sun Labs. What are the implications to open source? What about Oracle's view on research in general? The short answer is that we don't really know what course this will take but there are a few important things we can say now. First is that up until the deal closes (or doesn't) this summer, we are two independent companies. We will be going about our business with our Sun-oriented priorities just as we have before. Don't expect us to be suddenly change the direction of our research or anything. Second, it will probably take some time for the news to settle in and for all the implications to follow their course. At this point no one knows the details because they don't exist. I believe that one of the reasons Oracle is interested in us is because of Sun's strong history of innovation and it's certainly my hope that Sun Labs will plays a strong part in the future as well.

..but enough about us...

Because so many of our projects in Sun Labs are community-based open source, our communities have a significant stake in this too. For those of you who have invested your valuable time and energy into our technology, what does this mean?

Let me start by saying that research labs are usually created to take on risk that is not appropriate for the other parts of the business. By definition, we take on projects that can fail. There is always the risk that a project will end regardless of who is buying whom or what the current economic climate is like. Usually this is technical risk. Its not clear that the merger puts any project at more or less risk than before.

So what about the future? The good news is that you have more influence than you might think. It used to be that consumers of technology were completely dependent on the projects that produced that technology and ultimately that company's budget and management commitment. Whether a company is purchased or goes through some tough financial times or not, projects at corporations can come and go on a whim. Today, with open source, that is no longer so true. Once the source code is out there, it can never really be taken back. It doesn't just belong to the company, it belongs to the community. In fact, that is why we like open source. By giving up a little bit of control, we gain your partnership in insights, imagination, enthusiasm, innovation, direction and leadership. What we gain from open source is exactly the fact that the community can influence the direction of the project. If, in the worst case, a project funding goes away for whatever reason, the community remains. In the case of most every Sun Labs project, the number of people in our communities dwarf the number of people actually assigned to a project here in Labs. The community is much bigger than the internal project. The technology is out there and it will continue to be used and pushed forward by the community.

More importantly, a strong community is one of the best arguments for a company's continued investment in a technology. When a project has a strong community, engineers are inspired, managers feel external validation, sales and marketing sees evidence that we are on an interesting track with market potential. When you use an open source technology and more importantly when you participate in its community, you endorse that project/technology. Just by browsing the web site and posting comments on the forums, you are casting your vote for it to continue. When it comes time for evaluation of a project, the community can make or break a project. Make sure that your favorite project has the most web site hits, forums posts and projects based on it to make it clear that it has a strong community. Blog, Twitter and otherwise spread the news to help grow the community and make it a success for everyone.

Onward

So don't think about who is being bought by whom or what the economic crisis of the moment is. Think about the technology that the world needs and become a supporter of it. Do you part to make the world a better place.

For those of you still concerned about the merger you can find some official statements from Oracle here and here.

Monday Apr 20, 2009

The upcoming release of Sun SPOT software (Red v5.0) will feature a new robotics simulator built into to Solarium. It allows you to use virtual Sun SPOTs to program virtual robots using the Sun SPOT Java Development Kit. The great thing about it is you can download it and use it for free right now! Even if you don't have Sun SPOTs.


200904151541.jpg

The simulation roughly mimics the environment that is used in a competition held in San Diego each year called IARoc sponsored by Wintriss School. In this competition students use Sun SPOTs to control and iRobot Create to navigate a maze. The Create is very much like its more popular sibling, the Roomba except it doesn't suck... by which I mean it has no vacuum... (Roombas are great, BTW) The combination of a Create and a Sun SPOT is fantastic for learning the basics of robot motion and navigation. In the simulation you write software for a Sun SPOT, and then in Solarium, create a new Robot View and Add a Robot. This will create a Robot/VIrtual Sun SPOT combination. Back on the Grid View, you will now see a Virtual SPOT. You deploy and run your software on this Virtual SPOT and it will control your simulated robot. You have your choice of three different environments to run in; an empty room, a maze, or an obstacle course. Each view includes an 'X' as a starting point and a 'O' as an ending point. Your robot includes sensors that allow you to sense when your robot is over one of these marks. We also provide a sample application that can find the center of the room, or if you poke around in the code a little, you'll see a simple wall follower. Its just enough to get you started.

Its great fun! ...and you can get as fancy as you like. For instance, you can create multiple robots that will interact in a single view. These robots can interact with each other. They can run the same code or different code... whatever you like. Of course, they can also use the the Sun SPOT radio communication library to communicate with each other. This way your robots can cooperate to carry out a task.

And of course, if it doesn't do what you like, remember you have all the source code to the entire system, so you can make it do exactly what you would like. Give it a try!

To use the simulator follow the instructions here.


200904230648.jpg

Friday Apr 17, 2009

200904161750.jpg

We on Project Sun SPOT are on a mission to drive the adoption of Java on small devices everywhere. We believe that with Sun SPOT devices we can help speed the onset of the Internet of Things by providing smart, connected devices and tools to developers, students, researchers and hobbyists. That is why we are so excited this week to announce the port of the Sun SPOT platform to the FIRST Robotics hardware (the National Instruments Compact RIO) and thereby making our software environment available to some of the best and brightest high school students. Yet another step toward Java everywhere. ...and this is a big step

_MG_1071.jpg  

The FIRST Robotics Competition is a truly inspired event originally created by Dean Kamen the inventor of the Segway. Each year tens of thousands of high school students compete with each other in head to head robotics competition. Its really a great event. I've attended the regional competition in San Jose several times now and what I've seen is nothing short of amazing. First, the robots are impressive. Its really hard to believe that high school students are able to put together such fantastic devices. These robots are usually quite large and heavy (the size of several of the students combined). They are designed to fulfill some interesting task such as retrieving large balls (several feet in diameter) and lifting them into a hoop six feet high. The teams go head-to-head with multiple robots on the playing field at one time. This year the challenge has the teams collecting some balls and trying to place them in a trailer that the opposing team is pulling behind their robot, all the time protecting their own trailer. This leads to the second amazing thing about the FIRST competition. It is great entertainment. At the regional championships in San Jose, I am just one of thousands of spectators watching the event. There is music and cheerleading and mascots and a general party atmosphere. It nearly brought a tear to my eye when I saw thousands of screaming fans watching a bunch of (and I use the term affectionately) nerds out there doing their thing. The competition is fierce with often intense rivalries between schools. While the spirit of competition is strong on the playing field, what is truly amazing is the attitude in the pits. As a walked around looking at the amazing creations, I often overheard competitors helping each other out, lending tools, advice, muscle power and general moral support. These kids get the idea that the most satisfying competition is the one where everyone is performing at their best. On the field they are competitors but in the pits they are on a mission together to change the world. These are our future technical leaders.

_MG_1052.jpg

Right now I'm in Atlanta to attend the national competition at the GeorgiaDome... The freakin' GreorgiaDome! the same thing on an even larger scale. Its all very impressive. Its clearly a life experience for the kids lucky enough to compete here. Over the last couple of days I've gotten to meet some of these competitors. They are only in high school, but this competition has already given them real-world war stories that come from trying to make something complex come together under an aggressive time schedule. This is great, real-world experience.

_MG_1021.jpg

Where does Sun SPOT fit in?

The folks at Worchester Polytechnic Institute (WPI), with some help from us, are porting the Squawk virtual Machine that underlies the Sun SPOT software stack to the controller used for this competition. This means that in next years competition the students will have the opportunity to program their robots in Java. It also mea

ns they'll have access to some of the libraries and features that we've built in Sun SPOTs. It seems that last year they did a survey of the students, and a huge percentage of them asked for Java. This makes sense since Java is the language they are tested on in their advanced placement exams. It just so happens that we have a great little open source Java environment at the core of the Sun SPOT system called the Squawk Virtual Machine. So last year, several students from WPI joined us for the summer to try porting the Squawk VM to the Compact RIO. It worked well. Now we are well on the way to making the platform available to the students so that they will have new tools to do their magic. You can learn more about FIRST and the Sun SPOT Java software here and you can get some background on the port itself here.

Welcome FIRST competitors to our little corner or the world of builders and makers. May you take your skills and competitive spirit and save the world for all of us!


_MG_1100.jpg _MG_1085.jpg _MG_1083.jpg  _MG_1081.jpg _MG_1109.jpg _MG_1113.jpg

Wednesday Apr 08, 2009

Anyone out there want a chance to show off their Sun SPOT skills and win a trip to Zurich?

Jazoon09 is a Java technology event held in Zurich, Switzerland, June 22 to 25, 2009.   Jazoon Rookie is a contest associated with Jazoon09 that lets bright young developers (must be age 26 or younger on June 22, 2009) win a free trip to the conference. Entrants make a <20 minute video of a presentation their work (a technical talk of your choosing). If your video is one of three chosen, you will be eligible to present your talk live in Switzerland at Jazoon09 (conference and travel fees paid). There isn't much time. To enter you need to submit a video by April 23... so get working now. I'd love to see some innovative Sun SPOT talks among the entries.

Don't forget that if you make a video of your talk or anything else that relates to Sun SPOTs, tag it with the keyword "spaughts" so that it will show up in our feeds (http://planets.sun.com/SunSPOT/group/SunSPOT/).

Thanks to Gary Serda for the tip on Jazoon.

Wednesday Feb 11, 2009

 Mg 3256-1

For those of you who have been following the story of Sun SPOTs for a while, you know that this has grown from a little Sun Labs research project into quite an endeavor. Sun SPOTs are used around the world by students, researchers and hobbyists whose creative minds apply them to exciting new applications every day. We originally built the Sun SPOT as a platform for our own research. They worked out very well, but we pretty quickly realized that they were just too much fun for us to just keep in our labs. The ideas started coming: Wireless sensor networks, robotics, novel user interfaces, control applications... you name it. There was no way that we could do all these interesting applications ourselves. Plus, if we could think of interesting applications, just imagine what all of you would do if you got your hands on them? We just had to get these out into the world. Of course, this meant that a small group of researchers had to start thinking about how to manufacture and distribute these gadgets - a bit of a stretch, but we were spurred on by the idea that great things would happen if we just got them in people's hands. "If you build it, they will come." We were right and the Sun SPOT community was born. It's been quite a ride so far and it doesn't show any sign of slowing down! - Thank you all!

 Mg 3252-1 Mg 3239-1

As part of this process we've gotten to be involved in a side of things that researchers rarely get to see. We plan and execute the manufacturing of our own product - not something productized by someone else, but our own gadget. It's gotten to be quite a production. We've put together a little video to show how these little devices get made. Its pretty cool.

Anyone else want to try building Sun SPOTs?

 Mg 3246-1

Because of the popularity of Sun SPOTs, manufacturing Sun SPOTs is getting to be a bit of a big deal and even a bit of a distraction from our research. We would love to be able to focus more of our energy on our software environment and HW design rather than manufacturing. We're pleased that we designed Sun SPOTs to inspire new applications and seed an industry, and it seems to be working. However, in the end, Sun's interest in Sun SPOTs is mostly in the software and enabling new hardware, not building the devices ourselves. Other companies are better equipped to build small gadgets. We've already been fortunate enough to license Java on billions(!) of cellphones, yet we don't build phones. We would love to be able to do the same thing in the trillions of sensors and embedded devices that the world will be using in the upcoming years. Of course, Sun SPOT hardware is all open source, so anyone can build these. In fact, we are actively looking for others who would like to take on manufacturing and distributing Sun SPOTs. Its the next logical step for our growing community. So if you want to build and/or distribute Sun SPOTs, drop me a line... let's talk.

Friday Dec 05, 2008

In case you hadn't noticed, Sun yesterday announced Java FX. Its pretty cool stuff, no doubt, but I'd like to direct your attention to a little piece of this system that comes from Sun Labs.

 Projects Lively Lively-Screenshot-SmallThere is a project in labs called the Lively Kernel which is blazing new trails in dynamic web programming. Its a really cool jaunt into self reference and meta-circularity. The entire system runs in a web page. That web page includes a complete development environment which is used to create everything you see on the web page, including the tools used to create/modify itself. In other words, when you bring up the web page, it includes tools like browsers and editors that allow you to change what is on the page... like the browsers and editors etc etc etc. Lots of fun, but mostly incredibly flexible. For the old school among you, think of this as the SmallTalk style of web programming (this may be because Dan Ingalls helped invent both SmallTalk and this). It really makes you think about web programming differently. The project description says:

The Lively Kernel supports desktop-style applications with rich graphics and direct manipulation capabilities, but without the installation or upgrade hassles that conventional desktop applications have. The system is written entirely in the JavaScript programming language, a language supported by all the web browsers, with the intent that the system can run in commercial web browsers without installation or any plug-in components. The system leverages the dynamic characteristics of the JavaScript language to make it possible to create, modify and deploy applications on the fly, using tools built into the system itself. In addition to its application execution capabilities, the Lively Kernel can also function as an integrated development environment (IDE), making the whole system self-sufficient and able to improve and extend itself dynamically.

Those of you who are paying attention will notice that I started out talking about JavaFX, but Lively Kernel is based on JavaScript. OK, so what does this have to do with JavaFX? It just happens that they have taken the entire system and integrated it with JavaFX. This means that from this flexible, "lively" environment, you can manipulate JavaFX programs. Pretty cool stuff.

200812051337200812051337-1

As far as I know, the JavaFX version is not yet available outside of labs, however, the JavaScript version is. For those of you with very recent versions of Safari, IE or Firefox, you can try a this link to check it out live.

Tuesday Dec 02, 2008

eProtoboardSun SPOTs aren't just for any old geek. No sir. They are for the "discerning geek." The geek who knows a thing or two about what she wants... The geek who understands the importance of appropriate accessorizing. You say you already got yourself the Brilldea eProtoboard?

Well, now there is more bling for the Sun SPOT who has everything, and its just in time for the holidays. Circuitmonkey.com has just introduced the Breakout Board for the Sun SPOT. I've used this board and I must say its pretty fun. It brings out all the connectors of the eDemoboard to a much more useable connectors. There is a serial port with DB-9 connector. There are servo connectors that can connect directly to either standard or vEx™-style servos. All the I/O lines for both analog and digital I/O come out to convenient screw terminals and even board through holes where you can connect aBreakout board scope probe if you are so inclined. The on board buttons are also replicated on this board to give you some flexibility in UI prototyping. It connects to the Sun SPOT header via the 20-pin header (don't forget the cable!). It is all very convenient. Give it a try.

There are two new books featuring Sun SPOTs recently released.

The first is called 'Sensitive' Innovation by our friend Hans Appel. In it, he outlines some of the vision we share with him of how small, networked, aware devices can change the world. In it Sun SPOTs play an important role and he shows, among other things, how they are being used at The Hanze Institute of Technology in their applied sensor research.

3075367267 A7F35A0B3E O

The second book is specifically oriented toward the Sun SPOT. I think the most salient feature of this book for most of my readers is the fact that it is a Chinese language book. This is most interesting since Sun SPOTs aren't even available in China yet (they should become available there in January some time)! My Mandarin isn't very good, but judging from the pictures, I think it includes many exercises using the emulator.

3076196284 877Fddcb73 O-1

I'm not sure how you can purchase either of these fine titles, but if I do find that they are available, I'll pass on the information.

Monday Nov 10, 2008

I'd like to take this opportunity to talk through some issues that arise when new users come to Sun SPOTs. One of the first ones is that many of them assume that a Sun SPOT, with all its sensors, must know its location. There are few very reasonable thought processes that lead one to think this. One is that you should be able to infer relative position by dead reckoning using the accelerometer readings, and another is that several Sun SPOTs should be able to triangulate using radio signal strength. It certainly seems reasonable. In this post we'll focus on the accelerometer.

Potato-Nav

The process of calculating your new position based on your old position and some estimates of how your are moving is called dead reckoning. I learned a bit about this in my sailing navigation classes where it is important to be able to estimate your speed and direction, when your GPS goes out on a foggy day, to avoid the boat eating reefs that populate many coastlines. Techniques involve logging your speed and compass heading and using these readings along with the last known position to calculate your new position. This form of navigation is known to be difficult and inaccurate because of accumulated error and has caused many a ship to become lost. Because each estimated position is based on the previous estimated position, errors tend to accumulate. Boat captains all know that as soon as you can, you should find some absolute source of position (such as sighting a known location, using stars or the Sun, or just fixing the GPS). One of my favorite forms of navigation in the fog without a GPS is called "potato navigation" which is an ingenious (and most likely fictitious) way of getting absolute navigational input even in fog that is as thick as vichyssoises. You post someone on the bow of the boat with a bag of potatoes. They throw a potato in a forward direction and listen for the splash, then repeat. If at any time they hear a thunk instead of a splash after throwing a potato, the boat must be about to hit the shore and so it would be a good time to turn. :-) ...but I digress.

 

Unfortunately, dead reckoning is much more difficult that it might appear at first. Good, reliable location continues to be a difficult thing for these types of small devices. I've found myself responding to questions about this on the forums and in person often, so I thought I would collect my thoughts together here and just point people here when they have questions. Lets take the accelerometer case first and then we'll talk about radio signal strength next time around.

 Users Rogermeike Library Application-Support Ecto3 Cache Affba7Fc-Ebd8-44B0-Abb4-07A0C237C917
In physics terms, the accelerometer measures acceleration or change in speed. Speed is in turn change in position. Therefore, in calculus terms, the integral of acceleration is speed, and the integral of speed is position (or location). Generally, you can get the integral of the Sun SPOT accelerometer measurements by simply adding up the samples. For example, if you begin from standing still and accelerate at a constant 1 meter/second^2, that means that after one second you will be traveling at 1 meter/second. After two seconds, you'll be traveling at 2 meters/second and so on. During that first second you accelerate from 0 to 1 m/s. If you assume constant acceleration you will travel .5 meter. In the 2nd second you will accelerate from 1 m/s to 2 m/s and so you will travel 1.5 more meters. So in the first 2 seconds you will travel 2 meters... and so on. It is pretty straight forward to calculate this. The graph shows an example of constant acceleration and the effect on speed and position over time.

That is all well and good, but here are the things that make this a bit more tricky. First is gravity. It is always trying to accelerate you toward the center of the earth at 1G = 9.8 m/s^2. Fortunately for all of us, the earth gets in the way and stops us from just falling endlessly. The Sun SPOT accelerometer will measure the gravitational force while the Sun SPOT is at rest. Conversely, if you drop a Sun SPOT off a cliff, aside from the air resistance slowing it and the effects of spinning (I'll talk about this below), the Sun SPOT will experience no apparent acceleration (weightlessness) as it falls and is accelerated at 9.8 m/s^2. How can this be? While it is sitting still the accelerometer will measure acceleration and while it is changing speed as it falls through the air it will measure nothing? This goes against the idea that the accelerometer measures a change in speed. So its accelerometer will measure 0 acceleration, but surely the speed and position will be changing as it speeds up toward the ground. (To understand what the accelerometer is measuring, check out the description at 45 minutes into this video) Well, it turns out that it is fairly easy to adjust for this mathematically. You simply subtract out the effects of gravity. If the Sun SPOT is on earth and the accelerometer reads 0Gs, you can assume it is accelerating at 9.8 m/s^2. Similarly, if it reads 9.8 m/s^2 down you can assume it is stationary with gravity pulling it down. So we just need to subtract 1G (9.8 m/s^2) out of the acceleration reading. This works fine.

200811061500OK, now for the tricky parts. Of course, the big problem with subtracting gravity is knowing which way is down. It's easy for the Sun SPOT to calculate tilt when it is not accelerating, however, when other forces of motion are thrown into the accelerometer readings, the tilt calculations become more difficult.

200811061506

A stationary Sun SPOT can use the 3D accelerometer to tell you quite accurately which way is down. If you accelerate that Sun SPOT laterally, that acceleration will confound the tilt calculation and make the Sun SPOT "think" it is tilted when it isn't.

Lets talk about centrifugal force http://en.wikipedia.org/wiki/Centrifugal. If you put the Sun SPOT on the end of a string and swing it around your head in a circle, the accelerometer will measure acceleration of 1G down, and many Gs outward away from you. The force the string exerts to turn the Sun SPOT in a circle around your head shows up in the accelerometer. This is centrifugal force that is essentially fighting the Sun SPOT's natural tendency to want to continue in a straight line (bodies in motion tend to stay in motion...). From the accelerometer readings, the Sun SPOT is unable to tell the difference between this spinning "fictitious force" (as centrifugal force is described) and true acceleration in a straight line. Now imagine that Sun SPOT that we dropped off a cliff. It should be happily reading 0Gs (you can read more about free falling Sun SPOTs and accelerometers here), but if it is tumbling on the way down, it won't. As the Sun SPOT tumbles and turns, it will induce centrifugal forces that will affect accelerometer reading. The accelerometer is not exactly at the center of mass of the Sun SPOT, so as the Sun SPOT spins in the air (rotating about the center of mass), the accelerometer will experience centrifugal force. A great example of this can be seen when my son and I threw Sun SPOTs around our backyard with a trebuchet (http://blogs.sun.com/roger/entry/sun_spots_and_trebuchets) where you can see the rotations of the Sun SPOT in the air. The Sun SPOT has no way to tell this type acceleration from the type that causes its position to change. You would need gyros (rotational sensors) to properly sense out this effect so that it can be subtracted from your calculations.

Additionally, to get from acceleration to position, as I mentioned before, you have to integrate twice. This means that errors you encounter compound. If you are off even slightly in the acceleration, the speed you calculate will be off and that will make your position even further off for that estimate and all future estimates. The next reading you take may also be off a little and get you a slightly incorrect speed which you will then use to calculate a distance which you apply to your already incorrect position to get a new position that will now be even further off. The Sun SPOT analog to digital converter that reads the accelerometer is reading instantaneous values from the accelerometer. The software then must interpolate between these readings by assuming a relatively smooth change from one reading to the next. Unless you can sample the accelerometer infinitely fast, (which Sun SPOTs can't) you'll miss some acceleration and your reading will be off. Furthermore, if there is vibration or noise in your readings, they can affect the accuracy of your results. Remember all these errors are additive. Thus it wont take long for your position calculations to be way off.

Thus accurately calculating distance from the accelerometer is almost impossible. I say almost because I can imagine a scenario where you could calculate position. If the Sun SPOT were constrained in some way so that its orientation never changed, for example, if we could assume that it was ALWAYS facing north, then we would not have the problem of rotational forces or tilt changes confusing our readings. Additionally, if the Sun SPOT were connected to a massive enough object to guarantee that the changes in acceleration were fairly smooth, then we shouldn't run into too much sampling error. Thirdly, if it would regularly get an absolute reading of some sort to adjust for the cumulative errors... then and only then can a Sun SPOT calculate its position using just the accelerometer.

So, if you want to calculate position, what you want is a SunSPOT based Inertial Measurement Unit (IMU) http://en.wikipedia.org/wiki/Inertial_measurement_unit. I don't know of anyone who has built such a device from a SunSPOT... yet! I've played with gyros from SparcFun (http://www.sparkfun.com/commerce/product_info.php?products_id=698) and they can be made to work (although I haven't tried to make an IMU. I connected that device through the A/D on the eDemoBoard, which was pretty straight forward. Getting it to deduce position is another matter. I'm sure there is a thesis in there for someone. IMUs generally have the drift problem unless they use some global positional information such as GPS. It's useful to have an application where there are some constraints to help counter the drift. We've been working with a group from Edinburgh that is building such devices in order to be able to track body movements. (BTW, they are not using Sun SPOTs for this) Because they know that the devices are connected to a person, they can apply the readings to a rigid body model of a person. They can be pretty sure that the person's upper arm is connected to their shoulder and thus constrain the motions appropriately. Its all about the constraints. After all, if they can deduce a car's position from an iPhone's accelerometer (http://dynolicious.com/index.html), there is hope. Certainly you should be able to do that with a Sun SPOT.

We don't have a gyro board planned at the moment, but it is certainly something that we talk about. We also have shown how to connect a GPS to a Sun SPOT for applications that need to get an outdoor position. Finding the constraints that help make your application work is the key here. Where there is a will, there is a way, so get out your bag of potatoes and teach your Sun SPOT to navigate.

In a future post I'll talk a little about the issues around using radios to infer location.

This blog copyright 2009 by roger