Thursday, February 25, 2010

Friday Night SMS - Feasible via Zigbee

One of the new features in the FLOW is the inclusion of a Zigbee modem, instead of the currently prevalent bluetooth. If you get a Overo Fire - it will have a bluetooth on board. A while back we came up with the Friday night phone call idea, routing a call through the wireless of all the unused phones in the area, very useful in crowded club districts.

Voice is a different matter it requires some decent bandwidth, bluetooth can provide it for wireless headsets. The telcos charge exorbinant amounts for the very low-bandwidth SMS services, why ? Because they have centralized user-management and routing systems, they also theoretically have a lot of QoS, security and privacy policies. Yet again in the club scenario SMS is one of the best ways to communicate, voice will be lost in the din and will require the callee to switch location.

Let's consider how we can break the monopoly without paying zillions to licence our own mobile band. Solution will be to build a user maintained/powered/administered zigbee mesh. Zigbee can power itself from energy-harvesting - thumping on the dance floor, peltier sucking off some of the coldness in your beer or the heat in your coffee. We always go over the top in our energy use, it would be nice to channel some of it into free/cheaper communication. The zigbee mesh can take and channel the first hop, suppose the SMS target is beyond mesh reach, what do we do ? We hop on the old faithful - IP.

Before there was internet, there were lots of small intranets. Now we have and 'SMS like' service running over http with lots of users - Twitter seems to have no trouble raising funds. May be it can offer a cheaper solution to all the user to user functions the telco claims to perform. The mesh network links to an IP gateway and the SMS hops onto the twitter channel as a direct message. For that matter any chat engine will do, jabber, msn etc etc, just need to address the target properly.

But at the end someone has to pay the piper (the transmitter of data). Working out who does that and how much is a political issue, but I definitely want a cheaper piper. If energy harvesting lets me sing and dance to send an SMS I will do that.

Wednesday, February 24, 2010

Bringing NearMap to WorldWind

I promised myself I will do this soon and it has been a month or so since I thought about it. NearMap provides a nice Google like URL resource to pull tiles from and WorldWind provides 3d perspective (since admittedly the NearMap elevation is strange at times). The projection is not quite right in the on-the-fly transform from Google Projection to LatLon, I am using the Mercator projection built-in worldwind. Anyway enough talk screenshot time. Here are couple of Microsoft Bing Maps vs NearMap. I hope I will do the maths for the 900913 projection right soon and fix up the little inconsistencies.

Tuesday, February 23, 2010

Learning PCB Cad - then finding someone who knows it all

One of the great pleasure of diving around on the web is finding those ah-ha things. I have been contemplating buying bits and pieces from the gumstix shop. Then I found that all expansion boards are open design. So I downloaded some, converted from Eagle to Gerber and sent off to a fab shop for a quote. The fab shop is very responsive and even provided a custom how-to on converting from Eagle to Gerber. I think I will get a fair few PCB's made and loaded for the project.
 Some more snooping around for a camera to attach followed. There are lots of suggestions on attaching a USB camera to the USB host slot, but that somehow feels clunky to me. I would like a high bandwidth camera directly attached to the PXA using DMA. Some seem to have already made a lot of progress with the Overo COM's and gotten to a phone-like devide with lots of bits. Time to see how much it will cost to get a FLOW to Australia.

Saturday, February 20, 2010

Evolution - superficial and speciation

Time Machine discusses evolution and dichotomy. Speciation is not such a common occurence unless there are heavy evolutionary drivers. I just read Michael Crichton's Prey, all his books carry the same cautionary finger about new technology. Crichton has inspired more research than caution by a lot of his work. Ultimately it is human hubris to blame.

I have lately been excited by the possibilities of distributed processing and mesh networking as discussed in Prey. I can't operate at the nano scale yet, but we can have half-hour endurance swarms with decent processing. The Xbee is great for mesh networking as I have found, currently each node needs to be individually configured, but that can be done over air soon enough. The current version of the quadcopter autopilot can read euler angles from the IMU, read GPS locations at 1Hz and send I2C commands to an Arduino to control motor speeds. What needs to be completed is the control/feedback loop to tie all this together. The hardware also needs to be cleaned up and a power supply segment built, all the bits take so many different voltages - IMU(9V), Arduino+Gumstix(5V), Xbee(3.3V).

The last 2 nights have been spent setting up Xbees correctly. Apparently the fidelity is best in point-to-point mode, where a single router/end-point sends to another - this is achieved by setting the SH/SL and DH/DL registers. The Xbee has a lot of config options, the other neat thing in X-CTU is the inbuilt signal quality testing app. Running cat /dev/ttyS0 on the gumstix lets me create a software loopback and test the signal quality while moving the transmitter around.

Tuesday, February 16, 2010

Mailing list to the rescue - working Gumstix + 3DM-GX2

Finally had to put up a thread on Gumstix mailing list to get the misnomers sorted. Dave Hyland, the maintainer of the robostix code came forward to iron out most of the strangeness and provided the sertest utility to finally sort out the issues with the port. So now I can access both the GPS stream and my IMU reading of choice (Euler angles, possibly linear and angular acceleration). The IMU commands can be lined up and sent as a larger sequence in continuous mode to achieve better reading throughput than the 1 reading per second I am currently getting. Here are a couple of GPS and IMU streams. For a change the GPS was very stable for the few seconds it took to do the screenshot. Need to get the uBlox explorer and see it drift around, same for Microstrain.

Sunday, February 14, 2010

I wanted a UART but I got GPIO

Time finally came to hookup IMU to Gumstix. I carefully soldered a couple of ribbon cables and put on a scope at the RXD and TXD pins to see if I could run a loopback test. The Gumstix UART page is suitably vague and confusing. Fine I can do some guesswork and deal with ambiguities. I soldered both the HWUART and the BTUART since that's where the ambiguity lies. I tried to send some data to the serial using cat. Lo and behold it did not work. So I put both receive and transmit pins in GPIO mode and manually toggled the state using:

 while(true);do echo "GPIO out set" > /proc/gpio/GPIO43;sleep 1;echo "GPIO out clear" > /proc/gpio/GPIO43;sleep 1;done

My soldering is rock solid (I have gotten better) and I got a 1 second pulse on the cable soldered to the the supposedly unused HWUART. More fiddling is needed before I can get the 3rd UART I need.

Saturday, February 13, 2010

Why make when you can buy - Australian import culture

Lately I have been doing lots of ordering of parts from the US and China via ebay and Little Bird. It all seems pretty cheap in Australian terms. I realize this must be due to the lately strong Australian dollar, second 0.90 plus peak in 2 years. I lack the economic expertise to analyse this fact, but I do know someone who did a PhD on macroeconomics and impact on exchange rates. The graph is created with a live link and will change as this post ages, but right now it demonstrates the point I am trying to make.

Australia has plenty of bespoke engineering, often aimed at the defence industry and not the larger and potentially more valuable commercial industry. This is most likely because defence is a protected field and bespoke engineering has high barrier to entry. Australian companies don't have the human talent and financial pool to play in the shark infested competitive world of commercial. Curse of small population base, lack of talent pool to pick and choose from. So in the end all commercial electronics gets imported as well as designed somewhere else. The ads on TV proudly tout that stuff is German Engineered or features European Luxury - while the same said Germans would rather live in Australia than in Germany. We would have all German engineers folking here if we can set-up industry and have decent education system. Engineering education needs to move beyond basics (move the basics to high school) and tailor students for the current market capturing all the principles. Not just technology - technology moves too fast to teach it for 4 years, but trends.

Suppose someone takes the bull by the horns and starts something native. Unless there is stellar talent, marketing, money and faith behind this drive - the Australian market will simply not sustain it. Another curse of small pool. You may develop a solution, but the client will simply walk off to a similarly skilled and probably longer established American or European operation to buy.

3DM-GX2 to Linux via Serial

The 3DM-GX2 is not a naive 6-axis IMU. It performs onboard Kalman filtering and stabilization and can sample very fast. The serial interface operates at 115200 baud and offers various data sampling modes with commands. I decided to test Euler Angle output, with nominal static test resolution of ± 0.5°. Getting the serial port functioning properly was a bit of a challenge on Linux, especially via a virtual machine - had to keep on connecting and disconnecting the USB/Serial converter (PL2303).

The unit takes a byte command and outputs a sequence with the command repeated, roll, pitch and yaw coded in floating point radians, a system time stamp and a checksum. The standard API for windows includes all the command parsing sections except the serial communication bits. As usual to test the stability of the unit I did a static run. The attitude stability is indeed 1° peak-to-peak. The graphs show some high frequency noise, the flight control needs to perform some smoothing and rounding to deal with that.

Here is the version of the Linux sample ported from the 3DM-GX1 Linux sample provided by Microstrain.

Thursday, February 11, 2010

Xbees are on the way - Wish they had data rates to encrypt drone feeds

I have finally bitten the bullet and ordered a couple of XBee Pros for use with the Quad. This is the 50mW nominal 1.6km range version operating at 2.4GHz for licencing in Australia. The concern with wireless in Scientific band is that it is already crowded with Wifi, Bluetooth and Microwave oven. Apparently the frequency hopping Xbee has pretty good noise rejection and can sustain decent data rates. The data rates are not very high, best suited for byte command line streaming than video. The low data rate also allows advanced techniques to be applied cheaply such as AES-128 encryption. Even the ARM CPU can do this in realtime.

Encrypting high data rate-streams such as videos requires a lot more computing power, and Intel is only just now breaking into the scene with processors capable of pervasive encryption during the network latency periods. You would expect military hardware to have permanent encryption, but they deploy these in the field expecting ignorance from the opponents and inability to decrypt weakly encrypted streams. The UAV Video hacks point to the fact that the military development contains unrealistic assumptions about the abilities of the opponents and serious corner-cutting.

So no non-encryped video streams. I think we will even encrypt the still the platform captures and saves on SD.

Tuesday, February 9, 2010

VLC ad-inifinitum - Doing graffiti with Video Streaming

I had a very fun night the other day hanging out with guys from the GRL Australia - Perth. They mentioned that they have been trying to get the drawing pad wireless without doing anything too fancy and I thought about VLC screen streaming. It can get pretty nice and recursive if done incorrectly as shown below. If VLC runs off-screen and the graffiti drawing app runs in full-screen then we can easily send off the drawn work to the projector connected to say small computer (Gumstix strikes again) running VLC in full screen mode.

So we have Graffiti App->Screen->VLC->Over Air->VLC->Second Screen/Projector. I would have drawn a nice block diagram but the GRL folk can do that.

Now here is the second interesting part , some projects such as LightTwist and PixelFlex do camera based projector auto-calibration. Why not use the same ideas and build multi-projector graffitis, also we have a camera image to display to the tablet user as the surface on which the graffiti is going and the auto-calibration can ensure what is drawn goes where it's drawn including messy mesh manipulation etc.  giving the feel of real graffiti drawing. So here is another flow:
Camera->VLC->On Air->Drawing Pad->Back ground to Graffiti drawing app.
For now it can be just a static image, eventually proper feedback will help with colour selection and positioning elements of the drawing.

Monday, February 8, 2010

Gumstix - Arduino Communication via I2C

Men built the tower of babel to reach the heaven, then it all fell down and everyone started talking different languages and could not co-operate since they could not communicate. Now I am trying to reach some 10m above the ground with the quad-copter and ghosts of babel still haunt me. The arduino speaks PWM to the electronic speed controller, fine I can deal with that. I need to speak to the arduino, can't have 2 serials over radio on-board so I will speak to the arduino from the gumstix via i2c. So now I speak to the gumstix via serial and it can run the flight control and speak to the GPS and IMU over serial as well - it has 3 serial ports (UARTS). After all is said and done we have no more free ports left - how are we going to talk to the system while in flight ?

We will have to sacrifice the hardwired serial console to the gumstix (FFUART) and pass-it through a X-bee or similar. I could also shell out a few hundred and get a wireless chip enabled clipon board, but it will have much shorter range than the Zigbee.

4 channel 50hz PWM in Arduino

Finally had a chance to hop into the lab and test the 4-channel sofware PWM using a scope. I has some jitter, but works pretty well on average. Now need the real ESC's to test the motor response. The rotors we have seem a trifle small for the frame size - which Fabrice has completed with all the bits screwed together. Looking very nice indeed.

The I2C interface on the gumstix is also soldered, now need to send some data out to the arduino and see how it behaves. If only the shipping on the gumstix bit was lower, I would have already ordered the wifi kit to act as a remote.

Sunday, February 7, 2010

Matching things up - SIFT Landmark matching via OTB

Orfeo Toolbox has implemented a few landmark identification techniques - SIFT and SURF. Transforms can be calculated from 2 sets of landmark points using an appropriate model. I had some trouble bringing it to Qgis, the output is just one band. The sample code needs to be extended to work with multi-band images. The in-memory representation of the match images is in double, this can cause array allocation failures. Otherwise this feature matching provides correlation free image matching for images with different dynamics - such as SAR to Optical.

Friday, February 5, 2010

Testing uBlox GPS accuracy with Gumstix

The Gumstix Verdex comes with a GPS Expansion board which carries a uBlox GPS module spitting out data in NMEA format. It also has power supply for an active GPS antenna and I got a simple one to test things out with.

I had the antenna up on the ledge and logging for a few minutes. The whole thing points to the fact that unassisted GPS cannot really be trusted. Here are the logs graphed.

The GPS will need to be supplemented with assistance from CORS stations, IMU and possibly ultrasonic or laser range finders on board the flying UAV platform. We can try out a newer ublox with online almanac update features, but I doubt that performance will be much better.

Together with GPS the other power consuming part of a UAV system is the control radio. Thanks to the emerging Zigbee radios we can do with very low power receivers and great range from the XTend modules (advertised at 40miles). With these we can obtain near real-time high level control interfaces and synthetically coded channels.

Monday, February 1, 2010

Italian made Arduino - almost like an affordable Ferrari

I received my Arduino today, surprised to see Italy stamped all over it. A little flag on top, a little map at the back and proudly stenciled "Made in Italy". Almost made me feel like a performance car owner, not that I am into such stuff. The IDE is simplified but effective, after much pains with the AVR Butterfly el-cheapo TTL-RS232 converter which made it impossible to put it in programming mode - the ease of the Arduino was a breath of fresh air. Atmel should take a leaf and make some decent dev boards and installers which run on hampered systems such as Vista ( could not get AVRStudio to install).

The 1st thing to do on microcontrollers is obviously to make a blinking LED, so I went ahead and made a 50Hz PWM timer interrupt based one - using the nifty millis() function. I believe our quadcopter will not run for 50 days and it is perfectly safe to use. On the other hand it gives us only around 1/20 resolution in ESC based motor control, if this is found to be too coarse other solutions using proper PWM will need to be sought.

For production I also got an Arduino Mini for use in production. Needs some soldering and off-board FTDI USB-Serial, but it is super small in all SMD. Finally I did some waving around of the blinking LED to demonstrate the 50% or so duty cycle. Works well since there is a power LED in the background providing constancy. Now have to make 4 of these and an I2C instruction parser to set the duty cycle on each channel.