Sunny Affairs

Rolling the Spaughts!!

Friday Apr 04, 2008

This post will get you started to build your own applications with Sun SPOTs, in case you haven't started yet.

I received a Sun SPOT kit in the month of February. I had been badly waiting to get my hands on the Sun SPOTs, and it took me no time to unpack it and try out the Bounce demo which it is preloaded with. I had a little trouble to configure Leopard cause quite a few things have changed from Tiger. But after spending some time with the SunSPOTWorld forum, I managed to get it running on my Notebook. Soon enough I decided to make a small Sun SPOT controlled car, maybe because it is one of the easiest and fun-filled application. Thankfully Anil had also made a car and blogged about it.

I soon contacted a few of my friends (Jyotirmoy and Rupak) and started off with the project as soon as one of them got over with his GRE exam. There were a few goals that I had set for this project. Firstly, it should be different. Of course, when you use a Sun SPOT to build any kind of robotic application, it does end up to be different. But in this case I wanted to make it a lot smaller than the other robotic moving vehicles that others in my college have developed before. Secondly, I wanted this robot it run on 3 wheels, like an auto. Most of the robotic cars have four wheels because they are heavy and unstable on three wheels. Also, I wanted to incorporate speed variation in this car. I wanted to be able to speed it up and slow down as an when required. Now most of the cars that the students of my institute make is used for robo-wars and similar contest, and thus they end up being big and bulky. Usually they weigh around 2 kgs. My final goal was to be able to close the SunRoof even after this project, which means I should not be soldering any wire to my SunSPOT, because I got only one.

To make the car small and light, we decided to use only one motor to drive both the real wheels. Also we had the speed variation in mind, so we purchased a 500 rpm geared DC motor that can work on a voltage range of 6V to 24V. Also the motor had a good torque. We used a L293D current driver to drive the motor. Since the car is going to be small and light, we decided to use big rear wheels that would help it move on many surfaces. I also purchased a small toy bike for the front wheel and a stepper motor (PM25L-024) to give it a precise left and right turn. Also to drive the stepper motor we purchased a ULN2004 current driver. Thankfully, this current driver was able to drive the stepper motor with a 9V cell and a 3V control signal from the D0-D4 lines. Speed variation was a tricky part. I had purchased a motor controlled potentiometer to vary the voltage input to the DC motor, but since this component is very bulky, I did not want to use it. Eventually, Jyotirmoy found a way to vary the speed of the DC motor using a PWM input and varying it duty-cycle. Sun SPOT sdk also gives a easy function setPWM() for a PWM output on the I/O pins. Anyways everything worked out and here is our car:



It weighs about half a kilogram and has a turning radius of about 8 inches.

Perhaps the most difficult part was to use this setup without soldering anything with the Sun SPOT. I was unable to find any solder-less connector in the market, so I had to do lots of hit and trial. What finally worked out really well is this: I purchased a 20-wire ribbon with a 20 pin female connector at the end of the wire. For the Sun SPOT, instead of using a 20-pin male connector, I used 2 10-pin male connectors. Using pliers I bent the pins and then forced them into the female connector. This made it firm and also kept a firm connection with the eDemo board. There is neither any slipping, nor any loss of connection. It worked out brilliantly. This is how I did it:




Here is the schematic (click to enlarge):



And finally here is the source code. I have used multithreading to make sure everything runs seamlessly including the light indicators and the communication. Before running the code, make sure you replace the mac addresses in the code with the one you are using. The Client.java acts as the remote, while the Server.java acts as the car-controller. Do point out any scope for improvement.

Find more pictures of the Sun SPOT controlled car here.

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

Sun Small Programmable Object Technology (Sun SPOT) Demonstration

Friday Apr 04, 2008

Jyotirmoy Banerjee and I gave a Technical Demonstration on Sun SPOTs on 1st April to the students of my college. It was the most interactive session so far esp because most of the students had not been exposed to a gadget of this sort ever before. I started with a brief description of wireless sensor networks and then followed it with Telemetry demo. After explaining the device and programming in detail I gave a demo on AirText and Bounce. Jyotirmoy continued with the presentation from thereon and explained the eDemo Board and how to interface the Sun SPOT to external sensors and devices. He also introduced the students to the other add on boards. This was followed by a demonstration of the Sun SPOT controlled Car that we had built along with Rupak Banerjee sometime back. Jyotirmoy also explained the difference between Sun SPOT and the other competitive products. Finally I demonstrated the Sun SPOT emulator (Solarium) to get them started even if they do not have the hardware.

Everyone was more interested in the robotic Car and they had a closer look at it and asked some more questions at the end of the sessions. A few pens, cap and chocolates were given to the attendees.

I have uploaded the presentation and the photographs.

The following day I demonstrated the Sun SPOT device to our Director Prof BS Sohi and a senior Faculty Prof DN Singh. Even they were pretty amazed to see the variety of applications that the Sun SPOT can be used for.

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

All round update/upgrade for SunSPOTs

Thursday Mar 06, 2008

It's time for a all round update/upgrade for SunSPOTs.

Here is a link to Roger Meike's blogpost which introduces you to some new Open Source SunSPOT add-on boards which can surely upgrade the functionality of SunSPOTs

Also, from the Software side, David releases the SunSPOT "purple" sdk for download. Also you can get a SunSPOT emulator, which can help you try out a "virtual" SPOT.

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

Sun SPOTs me....

Monday Feb 04, 2008

I have lots of things to post here, related mostly to Solaris. But they have been delayed due to my Sessional exams.

But I can't wait for the sessionals to get over for this post.



Someone has taken my camera, so had to rely on the iSight on my Macbook Pro.

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

Announcements from California - Squawk!!!

Saturday Jan 26, 2008

The Java Mobile & Embedded Developer Days recently took place at Sun Santa Clara Campus Auditorium, California, USA on January 23-24, 2008. It has brought out another announcement.

The Squawk Virtual Machine is now Open Source. Roger Meike, who works at Sun Labs, and is also involved in Project SunSPOT has put up this blog entry with a few links.

What's Squawk?
Project Squawk is a Sun Labs initiative about taking Java to the mobile and embedded space.

As Zhiqi has rightly pointed out... have a look at this quote in the Squawk Project Page
"Squawk is an open source virtual machine for the Java language that examines better ways of building virtual machines. Most commercial virtual machines are written in low level languages such as C and assembler. We believe that virtual machines can be simplified by writing them in a higher level language, and further simplified by implementing the VM in the language that the VM is implementing."
... Can't deny, thats an interesting approach.

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