High Altitude Arduino at linux.conf.au

This January, for the 5th year in a row and the 6th time overall, I attended linux.conf.au.  This year I did not submit a main conference talk as I was busy finishing my final year project as the call for papers went out.  I did submit and have accepted two miniconf talks; one about my final year project for the Research and Student Innovation Miniconf, and another with Mark Jessop delivered at the Ardunio Miniconf.

Arduino Miniconf

For the past two conferences Jon Oxer, a microcontroller enthusiast from Melbroune, has run the Arduino Miniconf.  It grew out of past tutorials where Jon has provided Arduino boards for the audience to purchase and walked through how to program them.  It also replaced the Embedded Miniconf which was last run in Melbourne 2008.

The morning is set aside for hardware hacking, which for this group involves soldering together various through-hole PCBs containing various sensors attached to an Atmel ATmega microcontroller.  Add the Arduino bootloader and you have something that is commonly referred to as an Arduino – a term that indicates a certain ease of use for those who don’t want to get down and dirty with the specifics of a microcontroller’s programming interface and data types.  As Jon says in his call for papers, “the Arduino Miniconf gives hard-core software devs who typically attend linux.conf.au an opportunity to experience the joy of hardware hacking”.

Our talk was titled Project Horus: High Altitude Arduino, and it introduced attendees to Project Horus and high altitude ballooning in general.  We focused on the hardware and software that is used, and explained how a balloon is tracked following a launch.  That lead nicely into some story telling where Mark and I told the tale of Horus 8, where Mark’s final year project flew as a payload and landed in the ocean, to be rescued by myself in a canoe and our project founder, Terry.

MobSenDat

The two boards being assembled was the KitTen starter kit, and the MobSenDat, a flight computer designed by Luke Weston for recording telemetry in the model rockets that many attendees were building the following day.

MobSenDat top layer PCB layout

It is released as an open source design that you can download and re-use for free. The board contains the following instruments:

The software we flew was derived from the balloon telemetry code written by Terry and the sensor test code by Luke.  We named it MobSenDatHab, and it can be found here.

MobSenDat for Hight Altitude Ballooning

The 8MHz ATmega328P can store this information to SD card, or transmit it over either a XBee (yuck!) or a Radiometrix module; we used the 434MHz NTX2 on one board and the 151MHz TX1h. As we explained in the talk, the modules are used as a voltage controlled oscillator to transmit 300baud frequency shift keyed (FSK) RTTY data to a ground station.  The ground station consists of a upper side band (USB) receiver which mixes it down to audio frequencies, and a laptop which takes this audio signal and feeds it into fldigi, an opensource program for decoding various text-based modulation schemes used by amateur radio operators.

Joel with the MobSenDatHab Horus 14 payload

Horus 14

The week before the conference we had launched Horus 14; a multi-payload flight where we tested the first of the MobSenDat fight computers.  The board performed very well, and was able to be received at times that the normal Nut payload was not.  This could be explained by the higher transmit power – 10dBm vs 20dBm – however a small contribution could also be from the lower frequency used, as path loss is proportional to frequency.  The other payload we flew was a special one.  It contained the HD camera playload that had been flown before, but instead of simply filming the scenery, a small plush Tux – the Linux kernel’s mascot – was placed in the field of view.  Tux flew to 30 276m, covering 180km and flying for 2h 19m.

Horus 14 spacenear.us online tracker screenshot

We recorded 1080p footage all the way up and all the way down, but kept it secret until premiereing it at the miniconf.  It was enjoyed by all, and kept under wraps for a further two days until we showed it to the entire delegation of conference atendees.  Unfortunatly a technical error meant only half the video was seen, but everyone enjoyed it none the less.  Since then it has been made public, and has recieved 2 607 views to date.



In addition to showing people a cool video, the purpose of the flight was to create a unique item to auction off at the conference dinner.  In the past money has been raised for Tasmaian Devil face cancer research, and New Zealand emergency services.  This year the money raised was donated to the Queensland Premier’s Disaster Relief Appeal, to help out those who have suffered due to the extreme flooding in Queensland this summer.  The conference managed to raise $23,239, by auctioning off both the plush Tux and a large print of Tux at apogee signed by conference keynote speakers Mark Pesce, Eric Allman, Geof Huston and Vint Cerf, as well as Linus Torvalds.

Mark and Joel with the print signed by Linus and the keynote speakers

Links

Posted in tech | Tagged , , , | Leave a comment

Project Horus: High Altitude Ballooning

One of the hobbies I’ve taken up over the last few months has been High Altitude Ballooning with Project Horus. A group of interested people design, simulate, launch and recover a helium filled latex balloon. The flight and recovery generally last a full afternoon, and the balloon regularly reaches above 30km, with 35km being the highest achieved so far.

Background

The ballons fly a telemetry payload which provides tracking through the reception of GPS signals and transmission of position, altitude and speed to receivers on the ground. The payload modulates the carrier of a narrow band FM transmitter in order to produce two tones, a modulation technique known as binary frequency shift keying (FSK).  Data is encapsulated in RTTY strings; 7-bit ASCII characters with coded start and stop bits, as well as parity information. The strings themselves carry a CRC16 checksum; 4 symbols of error detection for each string of approximately 50 symbols.  The transmission rate is 300 baud, at 10mW on the 70cm band using a quarter wave monopole above a ground plane.

The two FSK tones carrying RTTY as seen by fldigi

The receiver is a scanner capable of decoding Single Side Band transmissions. This decoding produces a two tone audio frequency signal that is fed into a computer, and proceed by a modified version of the fldigi program, called dl-fldigi. The modifications provide convenient presets for high altitude ballooning, as well as the facility to upload to spacenear.us, a web based tracking application.  The spacenear.us site allows the team to open up balloon tracking to anyone able to receive the telemetry signal, which can cover a large proportion of the state as the balloon reaches altitude, and provides attribution by listing the call sign of anyone who uploads a sentence.

Web based tracking software spacenear.us

Chase cars are able to also submit their GPS coordinates to spacenear.us, which helps with the chase teams knowing each other’s location, as well as for spectators watching online.

Other payloads have been flown such as APRS beacons, voice repeaters, a few experimental flight computers, and some multimedia payloads for recording the flight.

Horus 8

The first launch I attended was back in October where Horus 8 was flown in order to test my classmate’s final year project; a telemetry payload designed to operate in the Antarctic and transmit data back to a receiver in Australia.  Mark’s project was flown along with the normal Nut flight computer, as well as a HD camera intended to record 1080p video footage for the duration of the balloon flight.

Horus 8 Launch at Grahams place outside of Mt Barker

Some misshaps occured right at the start; the full balloon escaped our clutches and released an amount of it’s helium.  With limited reserve supplies, we flew with the bare minium required to obtain lift, and this meant a very slow accent rate.  Possibly due to the slow ascent rate, the balloon began to float at apogee – not gaining altitude, and therefore the normal drop in external pressure that causes the balloon to expand and busrt did not occur.

Chasing Horus 8: The front seat car computer running dl-fldigi

As it headed out over the coast towards the open ocean, it did burst, but the landing site was 50m out to sea at Carrickalinga.  As the sun went down, a strong offshore wind was pushing the payload further out of reach.  A dramatic recovery involving Terry, the project founder, employing his swimming tallents, and myself jumping on a “borrowed” canoe that we found on the beach resulted in a reocvery of all the payloads, but the electronics did not fare so well having come into contact with the sea water.

Terry on the left, myself canoeing on the right with balloon in tow

Landing path in the sea at Carrickalinga

Horus 12

Since Horus 8, I attended a second launch that was much more successful.  This launch was funded by Tony Wheeler of Lonely Planet, and the idea came from artist Chris Lansell. It flew a HD camera and a still camera, and it obtained some stunning shots at burst of the balloon fragments passing between the lens and the sun.

Horus 8 capturing balloon fragments in the sun as it tumbles

The balloon also captured some images of the recently refilled Murray River system, including Lake Alexandrina. It landed in a field of cows about 100m to the west of the river, just outside of Murray Bridge.

Coming in for landing over the river at Murray Bridge

Yorke Penisula; Gulf St Vincent; Adelaide; River Murray

I look forward to more adventures with the Horus guys as time goes by. Look out for more blog posts about experiments we fly, and the adventures we have whilst recovering them.

Links

Posted in tech | Tagged , , | 1 Comment

Back to blogging

Whilst upgrading the servers that host Tim’s blog, my wiki and this blog, I managed to break wordpress.  If you were listening to the RSS feed you would have seen all kinds of duplicate posts, drafts and empty posts.  Sorry about that!  The purpose of this message is to tell you that it’s safe to come back now, and service should resume as usual.

A note to those using Google reader; it appears that the old RSS has been cached, so you may still see the old spammy feed.  Hopefully Google refreshes it’s cache soon.

Posted in Uncategorized | Leave a comment

Throughput of an ADSL2+ Connection

In our apartment we have a Adam Internet Naked ADSL2+ connection. Our Billion BiPAC 7401VGPR3 modem reports a sync speed of 21.302Mbit/s downstream and 1.176Mbit/s upstream. The high sync speed is probably attributed to the 150m as the crow flies between us and the exchange. Adam’s control panel reports a 5.1dB SNR, the modem roughly agrees at 5.5dB. We are using the Adventurous line profile that provides 24Mbit/s with interleaving. There is one higher speed line profile that turns off interleaving, but this increases the likelihood of transmission errors.

Enough of the details, this post is about collecting some real-world throughput data. The idea comes from Vincent’s blog, which I read through Planet Debian. He is trialing a high speed internet service, and used curl to perform some throughput testing. In his case the servers tested were not up to his 50Mbit/s connection; something to think about with our 1000Mbit/s National Broadband Network on the way.

Using Vincent’s method of scraping curl‘s output, which provides a throughput every second, and displaying using gnuplot, I collected a number of data sets. I tested using the file servers of Adam Internet; mirror.filearena.net, as well as those of Internode, another local ISP that peer with Adam Internet.

The bash and gnuplot scripts used to produce the data, as well as the source data, is here. If you’re interested in running the tests yourself, use a large file from your ISP. Whilst my ISPs have test files, I instead chose an Ubuntu ISO as the file size is consistent across mirrors. Credit goes to Vincent for both snippets.

Late night and Early Morning

The first graph shows the difference between night time and weekday morning throughput. Adam have an off-peak period that allows dowloading from midnight until 8am, meaning many users queue up large downloads to complete over night. On the other hand, during business hours there are more people awake and using the net, so it is hard to draw any conclusions without looking at the ISP’s data.

Friday Evening

I also took a look at the difference between downloading the file from my 100BASE-TX switched wired network, versus the 802.11g WiFi network. A laptop to server file transfer is greater than the 2Mbit/s observed on the DSL connection, so the throughput characteristics of the WiFi should not matter. I was interested to see if the extra 0.5ms of latency that the WiFi network brings would make a difference. The answer is yes, by a small margin.

Friday Evening: WiFi and Wired

The most interesting result of these tests was Internode’s mirror gave higher throughput than the mirror provided by my own ISP. This comes with some surprise, and I do not have any suggestions for why it is the case. If you have a theory as to the discrepancy in throughput please leave a comment.

Posted in tech | Leave a comment

Audio Output with the ML605 FPGA

In my final year project I used the Xilinx ML605 Virtex-6 development board. Whilst having a large number of I/O options, it lacks any audio output. It does have 7, 5V CMOS I/O pins plus voltage rails used by a socketed 24-character LCD board, which were appropriated for this project.

ML605 LCD Header (J41), p33 of xtp052_ml605_schematics.pdf

The chosen audio Digital-to-Analog Converter (DAC) was the The Cirrus Logic CS4344, as it is easy to source, does 5V logic, and requires few pins to interface with. The CS4344 takes I2S (Intergrated Interchip Sound), a 4-wire bus protocol for serially transmitting sound data to a DAC. A search found Eric Brombaugh‘s site, where he provides Verilog for producing I2S samples. Using this already tested and written code saved time writing our own, so thanks Eric.

CS4344 datasheet [PDF] provides an example circuit appropriate for our application. The schematic is reproduced below.

CS4344 Audio Schematic

Audio Schematic

The CS4344 comes in a TSSOP10 surface mount package. For prototyping, it was attached to a DIP socket and placed on a breadboard.

Audio Breakout Prototype

To interface with the FPGA systems already built a the I2S generator was wapped in a VHDL state machine that takes input from a FSL Slave. FSL was chosen as a small amount of VHDL is needed to produce a port, and the interface is appropriate for feeding sequential sound samples. To integrate with Xilinx’s XPS toolflow, the following directory structure is required:


fsl_i2s_v1_00_a/
|-- data
|   |-- fsl_i2s_v2_1_0.mpd
|   `-- fsl_i2s_v2_1_0.pao
`-- hdl
    |-- verilog
    |   |-- clkgen.v
    |   `-- i2s_out.v
    `-- vhdl
        `-- fsl_i2s.vhd

The .pao file lists the HDL code present in the module. .mpd files are used to indicate what buses are used, and the name and type of I/O pins to expose to XPS, and any configuration paramaters. The version numbers for these files corresponds to Xilinx’s requirements, not the version of the IP.

XPS IP Catalog tab showing the custom peripherals.

Xilinx XPS GUI: IP Catalog tab, showing custom peripherals

HDL files are placed under their own directory, with a subdirectory used for the language used. The entire lot is placed in the pcores directory at the root of a project. When launching XPS, the module will now show up as a usable in the IP Catalog tab.

The frequency of the I2S clocks can be selected from one of a number of options depending on the desired output frequency. Table 1 in the CS4344 data sheet describe the options. It was chosen that a 44.1kHz output rate would be chosen, meaning an 88.2kHz LRCLK, and MCLK would be 11.2896MHz. Due to the properties of the ML605′s MMCM (Multi-Mode Clock Module), the exact frequency chosen was 11.290323MHz, for 64ppm of error. A python script used to select the clock, and calculate the error, can be downloaded here.

By connecting the FSL slave of the nes_fsl to a Microblaze and supplying the appropriate clock, sound can be output by performing 32-bit writes to the slave. The upper half-word is the left sample, and the lower half-word the right. Samples are 16-bit signed little big endian, that native endianness of the Microblaze.  The use of the swapix function can be removed from fsl_i2s.vhd if it is more convenient to use little endian data.

A number of enhancements were made to the base audio output peripheral:

  • It will intentionally cause the output to ‘pop’ if samples are not received when the state machine tries to fetch them. This highlights the importance of meeting real-time requirements in an audio systems.
  • A deadline counter, providing an 8-bit register that counts logarithmically up whenever a deadline miss occurs, and down whenever a sample is successfully retrieved.  This can be hooked up to the 8-bit LEDs on the ML605 to make the counter externally visible.
  • A second FSL slave was added to provide a hardware mixer. This was not completed.

The peripheral can be downloaded here. To use, unzip it into the pcores directory of a XPS project and add it to your system. The clock port needs to be connected to a 11.2896MHz clock, and the SFSL interface connected to the slave port of a FSL. It would be great to hear from you if you happen to use it as part of a design.

Posted in tech | Leave a comment

There’s Something on my ARM

There’s something on my ARM is the name of a talk I first gave at the Open Source Developers Conference in Brisbane, Australia, in December 2009. Since drafting this post I have given an updated version of the talk to LinuxSA, my local Linux Users Group.

In the talk, I gave an introduction to the software used in Chromium and some of the neater features present in the browser, followed by some information about the code I wrote as part of my Google Summer of Code project working on Chromium’s Linux port. Finally, I spoke about the ARM port of Chromium that I maintain and showed some power usage data I collected comparing Chromium to Firefox running on the BeagleBoard, the core of which is the OMAP3430, an ARM based system-on-chip. This page goes into some detail about the power usage setup.

Power usage

Method

Initially I was using a bench power supply with a digital ammeter borrowed off of local open source hardware hacker David Rowe. This method did not allow the automatic collection of data, relying on the visual inspection and noting of the readout from the ammeter. I also had to return the bench supply, so I desired a better method.

After perusing the BeagleBoard System Reference Manual,
I discovered the board has a 0.1Ω sense resistor (R6) on the 5V input power rail. The two pins of the resistor can be accessed via the pads at J2. See section 8.2.5 of the BBSRM for more information.

It should be noted that the resistance of the sense resistor has an error factor of 5% on the early revC models (C2), and I presume that it is a similar case for the revB, making the absolute numbers potentially inaccurate. The relative differences are still valid.

As described by a thread on the BeagleBoard mailing list, the revC version has this resistor connected to the TWL4030 IC, allowing it to be measured via I²C. As I only had a revB board available, I had to use an alternate method.

I removed a jumper from an old PCI card and attached it to J2. Using a cable from the reset switch of an old PC case, I attached it to a Arduino board.

The Arduino Diecimila contains an ATmega168 8-bit microcontroller. It also has a 10-bit analog input suitable for measuring the voltage drop across the Beagle’s sense resistor. The analog input can use a 5V or internal 1.1V reference, I chose the 1.1V reference as the measured voltage ranges from 0 to 50mV.

The Arduino was programmed to use the 1.1V reference and read from analog pin 0 every 15ms, and send the value down the serial port to a host PC. A python script, grabserial, was used to capture this output and write it along with a timestamp. This output was post-processed using pylab to smooth the data, and graphed using matplotlib.

Software

Firefox was installed from the Ubuntu Karmic repository, version 3.5.5. Chromium was built from top-of-tree using the Code Sourcery 2009q3 cross compiler, and linked against a Ubuntu Karmic rootfs. It was built with the following gcc options:

-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mthumb -mfloat-abi=softfp

For more information on cross compiling Chromium, see the page I wrote at LinuxChromiumArm. The same rootfs as used for linking was placed on a class 4 SD card and booted using a 2.6.32-omap kernel.

Results

Cold start

The system must make do with 128MB of RAM, and a small swap file mounted on a very slow root file system. Chromium starts faster than Firefox, even in the low resource environment present on the BeagleBoard. The peak power draw is higher, however the area that Chromium’s use is above that of Firefoxes is much smaller than the area that Firefox is above Chromium.

Warm start

Chromium starts much faster than Firefox on warm start, and manages to get close to idle power draw before Firefox has reached it’s peak draw.

The steady state, where both are displaying their static home page, draw is similar for both browsers. The peaks that can be seen around the 40 second mark are suspected to be due to a timer expiring, causing the kernel to flush it’s page cache to disk.

Gmail load and idle start

When displaying a dynamic page Chromium does a btter job of staying idle. Again the peak power draw is higher for chromium, but it drops to a steady state and stays in that state for a long time. Firefox does not achieve an idle state after two minutes of zero user interaction.

Conclusion

These tests show that Chromium’s has the ability to get to idle quickly, and stay there whilst running a large web application. This is useful information byond the current data we have on load time and memory usage.

Further work

In my Summer of Code proposal I outlined the creation of a power aware buildbot, a system that would run a subset of Chromium’s page load tests, as well as a idle test, and graph the results so that improvements and regressions can be tracked as the code base is worked on. I intend to prototype this system, using the BeagleBoard along with a OLPC XO-1.5 pre-production machine. There is some evidence that ChromeOS engineers at Google have a setup doing power instrumentation.

A goal would be to show a shift in power usage, either up or down, over time, that can be attributed to code changes in the browser. A use of this information could be to correlate power usage against memory, other I/O, and CPU usage, to see which of these metrics affects power usage the most.

The OMAP3 system on chip consists of many small components that can be individually powered down. In my tests above, the kernel was not aware of these features, meaning there is potential for lower power usage, especially when idle. Re-running the tests with a power management enabled kernel may offer new insights into the systems behaviour.

Links

Some simliar articles that I have found since doing my work:

The script I used to post-process and create the graphs. I used python and matplotlib:

I originally wrote this up on my wiki:

Posted in tech | Leave a comment

Decked out

For Christmas this year Mandy’s parents and mine gave us presents to use on our balcony. My parents gave us a Webber Baby Q, a small hooded gas barbecue produced by Webber, who are more commonly known for their kettle barbecues.

The barbie can fit a decent amount of meat on it despite it’s small size. It has a single oval shaped burner inside, which does a good job of heating the entire grill. Unfortunately the small size means there is no plate for cooking onion. We were also given a stand designed for the device; it is quite low and wobbles a lot when scraping the barbie clean. Despite these two complaints it I am very happy with it, and have cooked 4 meals on it since setting it up on Friday.

Mandy’s parents gave us a stained wooden outdoor setting: a table and two chairs. It fits nicely on the balcony, and is great for enjoying the sunshine. I sat out there for 4 hours with my laptop setting up this blog over the weekend.

Posted in life | Leave a comment