Wednesday, March 12, 2008

07 Bluetooth

I finally got around to charging the provided Bluetooth GPS receiver last week; the given charger is a car charger, rather than a mains charger - a small hindrance, but not insurmountable. Once I got the unit charged, I took baby steps in testing the Gumstix's Bluetooth capabilities, attaching the antenna for the first time.
Scanning for nearby Bluetooth devices is fairly similar to scanning for WIFI networks. Using the single command:

hcitool scan

the Gumstix is able to list (with some accuracy) Bluetooth devices in the vicinity. I was able to pick up both my phone and the GPS unit with this scan; so far, so good. Apparently, some Gumstix revisions have issues with the default speed of Bluetooth communication, but thankfully I didn't run into this problem.

Scanning out of the way, pinging was equally little hassle. The scan had provided me with the MAC address and name of the Bluetooth device scanned, and pinging is another single command:

l2ping 00:0E:6D:5B:41:05

The first character is a lower-case L rather than a 1, and the characters following the ping are the MAC address of the GPS unit.

Things start to get a little hazy here.

On the Gumstix's Bluetooth wiki there is a guideline on setting up a GPS unit with the Gumstix system. Everything was pretty self explanatory until I happened upon mentions of "rfcomm bindings". A bit of reading lead me to understand that to establish a serial Bluetooth connection to another device (a "pseudo-tty" connection as one of the documents mentioned), we must use a Bluetooth protocol named "Radio Frequency Communications". Seems understandable enough, but it'll still need further reading to get fully.

Anyway, to help me get to grips with what the rfcomm binding actually did, I attempted to create an rfcomm binding to my phone rather than straight to the GPS unit, as my phone has an interface, and I'd be able to see if anything was happening. Yet another single command:

rfcomm bind 1 00:0E:6D:5B:41:05

The number after "bind" tells the Gumstix which pseudo-serial port to use, and the subsequent characters are, again, the MAC address of the destination unit.
I started to get requests on my phone for a connection to the Gumstix; excellent! However, they were looking for a PIN. At first, I tried entering nothing, but that lead me nowhere. Some more reading informed me that I'd have to set the security options on the Gumstix, which I considered doing until I located the PIN file in the "/etc/bluetooth" directory. Using the PIN in this file, I still couldn't connect my phone to the Gumstix, but when the PIN was entered it took slightly longer in refusing my connection, so I guess that's good; besides I'd established that the Gumstix was attempting to communicate with my phone; enough for the time being.

I tried the same rfcomm connection with the GPS unit, and it connected without hassle. However, the next steps listed on the wiki lead nowhere, as the command to start the GPS daemon (gpsd) failed, as it's not on the Buildroot revision on the Gumstix. I'll have to enable this, and the GPS pipe (gpspipe, handily enough) to get decent data from the GPS unit.
This means I'll have to flash the file-system ASAP if I want to get GPS set up, so I'll be doing this over the break. I'm going to enable C++ in the Buildroot also, as Semir's asked for it. I was considering putting python on, but I believe this takes up a good bit of space on the Gumstix itself because of the compilation utilities, and I'd rather keep the space on the Gumstix as free as possible, to avoid using the CF card and adding any extra weight.

That's about it for my recent activity. I weighed the components the other day for Donal: the GPS receiver, WIFIstix, Connex board, and Robostix weighed in at roughly 150g - not even eligable for Flyweight category in boxing, but an excellent weight for attaching to our blimp.

I'm off to Nice for a week, beginning Thursday. Work will re-commence upon my return!

Tuesday, March 4, 2008

06 Pictures

As promised, this post will contain a mostly pictures of the system, and a few screenshots of the Gumstix in motion so, without further ado...


Here is the given Gumstix computer, with a ten cent coin placed tactfully nearby for size comparisons. This picture includes the mainboard, console board and wifistix, and would be capable of using Wifi, or connecting to a computer via serial.


Of course, just leaving the Gumstix sitting there is fairly pointless, so I connected it via serial port to one of our computers to get it set up. I used hyperterminal to set up a connection, using the information from this very useful wiki page






Having connected to the computer, I worked on getting wireless working properly on my home router, as discussed previously. Restarting the wireless connection a few times led to my happiness in seeing my given static IP popping up each time, so I was able to disconnect the serial board from the Gumstix and connect only the wifistix.



Of course, Murphy's law states that having bragged about getting a static IP working on the Gumstix, when I go to get a screen-grab of me SSHing triumphantly into the Gumstix, my laptop decides that it's not having any of it, so my faithful readers(!) will have to make do with a putty SSH.



So I've remotely logged into the Gumstix computer, which gets rid of many restrictions on the unit, as we now know what IP it will have each time it boots which means that we don't need the serial connection unless we're flashing the file-system, or changing the wireless information. Also, in testing the cross-compilation toolchain previously mentioned that comes with Buildroot, I had to SCP (secure copy) the compiled binary from the host machine onto the Gumstix, which confirmed that transferring files between host computer and Gumstix is very easy.
Finally, here is the little "Hello World" C program at work on the Gumstix computer. I'll be working on trying to cross-compile more advanced programs next, as well as working on the Bluetooth aspect of the project.



So that's about it for pictures. I'll have a few more screengrabs and hardware pictures when I start working on the Bluetooth aspects of the project; the cross-compiled programs will likely speak for themselves.

Right now though, I'm planning on setting up a TODO wiki page for the project on the CSI trac (which I'm not finding half as useful as the old GForge page, unfortunately).

Over and out!