One of the coolest projects I have done so-far with my kids is a “near-space” balloon. That’s not quite into space itself (100Km+) but so high that the sky looks black and you can start to see the curvature of the earth below you.
The Flickr set with the photos from our first launch is here: http://flic.kr/s/aHsjK22nDc
This is a quick-fire slideshow of the photos from the balloon, formatted as a 2.5 frames/sec video. I’m having trouble embedding it so the link is here
In order to take this kind of photo you need to send a camera up to the stratosphere. Ours went 38Km (124,000 feet) straight up. This is easy enough: you attach it to a massive balloon, let it rise until the balloon bursts (due to the v. low pressure at the edge of the atmosphere) and then it will fall back to earth.
In order to see the photos that you have taken, you then need to find the camera afterwards. This is the trick.
Fortunately, at least in the UK and increasingly across Europe, the very helpful guys at the UK High Altitude Society (ukhas.org.uk) have developed a distributed network of trackers who will receive a signal from your balloon, upload the data to a server and plot the position for you on a Google Maps based page (spacenear.us/tracker/).
In order to take advantage of this wonderful network of helpers, we need to build a tracker that will communicate with their equipment. That is what I will outline in this instructable.
There are plenty of rules and regulations regarding what you can fly and which parts of the radio spectrum you can use for various tasks. The approach I will use in this instructable is suitable for the UK under the rules prevailing in 2013. If you live elsewhere or you are doing this significantly after I write this instructable, please check the rules that apply to you. The guys at UKHAS are fantastically helpful.
So – let’s build a radio-tracker.
Step 1: Things we need
The tracker is based upon the Atmel ATMeag328 Microcontroller which forms the heart of many of the popular “Arduino” boards. We are going to make an “Arduino Compatible” board which we can program using the Arduino IDE.
Because the GPS module and SD card both require 3.3v and we have plenty of computing power, we may as well make the whole tracker run on 3v3. That means that we can’t clock the ‘328 up to its full 16MHz but it will run happily at 8MHz on 3v3, and that’s plenty for our purposes.
The tracker is designed on a custom PCB which is 5 x 5 cm in size. This means that it can be fabricated on some incredibly cheap PCB fab’ sites. The design files for the tracker board and more details on the design are in the later steps.
These are the materials I used for my design. There may well be better options but this worked well for me:
1 x Custom Tracker Board (see next step)
1 x ATMega 328**
1 x 8MHz Crystal (NB not the usual 16MHz)
2 x 22 pf ceramic caps
1 x Radiometrix NTX2 (e.g. from UPU’s store)
1 x GPS breakout board with antenna (the board is designed for this one)
1 x SD card breakout board (e-bay)*
1 x board-mount DS1820 temperature sensor*
1 x external DS1820 Temperature sensor (e-bay)*
1 x HoneyWell HSCDANN001BA2A3 board-mount absolute pressure sensor (Mouser)*
1 x tactile switch
3 x 100nf ceramic caps
1 x 100 uf electrolytic cap
1 x MCP1825 ultra-low dropout 3v3 regulator
1K resistors (around 5)
10K resistors (2-3)
4k7 resistors (4-5)
3mm LEDs (0-4 according to preference, different colours)*
Selection of 1% resistors (I used: 47K/6.8K for the battery sensor and 6.8K/10K for the radio driver )
Male header pins (0.1″) – some straight, some 90′
Soldering station and solder
Programming / Debugging Tools:
PC with Arduino IDE installed
USB to UART adaptor (I use a cheap CP2102. FTDI would work too) or program with ISP (see below)
Arduino + breadboard or ISP shield
* – These sensors and indicators are not essential to the function of
the board but allow you to send some interesting data and log it for analysis offline.
**You can buy pre-bootloaded chips but they expect a 16MHz crystal. You would likely at least have to correct the timings in the code to make it work on 8MHz. It is certainly preferable to burn an 8MHz bootloader (see later). It’s not hard to do.
Step 2: Tracker Design
Attached to this step are the Eagle schematic and board files that I used for my tracker board, along with two .zip files: one with the board and schematic files and one containing all of the gerber files for the various layers. My board worked fine, but was not 100% perfect, for example, the LEDs on the serial port lines should really pull up to +3v3 rather than pulling down to ground so that they are off when there is not activity.
You may well prefer to design your own board, or at least modify mine. If you do this then there are a number of features that are necessary and/or useful for a High-Altitude tracker. These are some that are worth considering:
You can’t send an alkaline battery up into the atmosphere – it get’s down to -50’C and they just stop working.
Even though you will insulate your payload, you want to use disposable lithium batteries – the are light and work well at low temperatures.
The GPS and SD-card run at 3.3v only. 5v will fry then. If you can run everything on the same voltage you save wasting too much power in voltage conversions.
If you use a switching power supply or an ultra-low dropout regulator then you can wring more flight-time from your power-pack.
You could make your circuit up with lots of loose wires, with sockets or on stripboard, but it’s going to get very cold and shaken about!
If you can it’s worth designing a custom PCB and soldering everything directly to it. No sockets to lose contact, at least for the critical parts. My PCB is small and cheap but will allow soldering of the processor, crystal, GPS and radio. I elected for direct soldering of the radio antenna too.
Radio – in the UK there are only a few narrow frequencies you can use from the air and even then you are only allowed 10mW. The NTX2 is one of the few viable options for radio modules.
GPS – layout of a GPS module can be difficult and ideally you would keep it away from everything else. I opted for a pre-made module that could be soldered above and off to the side from the main board. It’s important to note also that many GPSs don’t operate above 14km height. Ublox GPSs have a flight mode that does work. For any others you will need to do your research before you buy/use.
Microcontroller – the ATMega 328 is a great option because it can be programmed from the very easy Arduino IDE. It will also run on 3v3 but only a 8MHz. However that’s plenty of processing power for reading a GPS and running a low baud-rate radio.
Temperature – a temperature sensor provides interesting data but many are not rated down to the -50’C that we could encounter at the tropopause. The DS18B20 is a good option because they are pretty cheap and are rated to low temperatures. You can get “external” ones which are sealed in a stainless tube for added protection. We’ll use one board-mounted one and one external.
Pressure – there are not too many “absolute” pressure sensors that I have found. The Honeywell HSCDANN001BA2A3 supposedly goes down to “0” mBar and in practice performed well down to 8mBar on the flight. Its i2c interface is pretty easy to handle. Honeywell make about a zillion variants but many are “relative” sensors – they measure the difference between a certain pressure and atmospheric. You need an “absolute” pressures sensor because it’s atmospheric pressure we are measuring.
SD card – you could potentially surface-mount your own SD card holder but that’s pretty fiddly and I didn’t have enough board area anyway. SD-card breakouts are cheap and easily available so I elected to solder one underneath the main board to be compact and easy. A lighter approach would be to solder wires to the pads of a micro-SD adaptor and use it as a socket for a micro-SD card.
Step 3: Bootloading
In order to use the Arduino IDE reliably at 8MHz, you need to burn the “Arduino Pro Mini 8MHz” bootloader onto your ATMega328.
There are all sorts of ways of doing this, but I will assume here that you have a ‘328 based Arduino board (like an Uno, nano or Duemilanove). Using this you can bootload your ‘328 using either a dedicated “shield” or just a solderless breadboard.
1) Place your ‘328 in the centre of your breadboard. Run +5v and Gnd from your arduino to the power rails on your breadboard.
2) Run a 10K from pin 1 on the BB (reset) to +5v.
3) Fit a crystal (8 or 16MHz) and cap’s (22pf) on pins 9 and 10 on the BB.
4) Join pins 7 and 20 (on the BB) to +5v and pins 8 and 22 to Gnd with jumper wires.
5) Jump from D11, D12 and D13 of the Ardu’ to pins 17, 18, 19 on the breadboard.
6) Jump from D10 on the Ardu’ to pin 1 on the BB.
7) Plug the Ardu’ into your PC and burn the the Arduino ISP sketch onto your Ardu’ from the Examples.
8) Put a 10uf capacitor from reset to Gnd on the Arduino (not the BB).
9) In the IDE, select “board” as Arduino Pro Mini 8MHz. Select the programmer as “Arduino ISP”
10) In the IDE click “burn bootloader”.
11) The lights will flicker for a bit while the bootloader is transferred.
12) When it’s finished, the D13 light on the Ardu should flash regularly. That’s in parallel with D13 on the new chip and tells you the blink sketch, which is burned with the bootloader, is running on it.
I got fed up with laying out BBs the whole time so I made an small ISP shield. The picture is of mine but if you don’t want to make your own then you can buy one from EMSL.
The procedure is very similar but reduces the setting up to one step:
1) Burn the Arduino ISP sketch onto the Arduino & un-plug it.
2) Put your ‘328 in the shield and the shield on the Arduino.
3) Plug in the Arduino and disable auto-reset (jumper or switch on the shield)
4) In the IDE, select “board” as Arduino Pro Mini 8MHz. Select the programmer as “Arduino ISP”
5) In the IDE click “burn bootloader”.
6) The lights will flicker for a bit while the bootloader is transferred.
7) When it’s finished, the D13 light on the Ardu should flash regularly. That’s in parallel with D13 on the new chip and tells you the blink sketch, which is burned with the bootloader, is running on it.
Your ‘328 should now be ready to be programmed.
If you want to test it before soldering directly onto the board then you can lay it out as a breadboard Arduino as described above. Now, disconnect the Arduino from the Breadboard and connect up the CP2102 USB to TTL converter. That will go to +5v and Gnd, with Tx on the CP2102 going to D0 and Rx to D1. Some CP2102s are marked backwards so you may need to switch these two. Finally you need to add a reset switch between pin 1 and Gnd. You might also want an LED and resistor (say 1k) between pin 19 and Gnd.
To load a sketch, select Arduino Pro Mini 8MHz as the board and upload a sketch. Just when it finishes compiling and tells you the final size at the bottom of the IDE, press and release the reset button to start the upload. You should be able to upload the blick sketch and see the D13 LED flashing with a new timing.
You can burn the final sketch now if you want. It will save you connecting the CP2102 up to the tracker board. See a later step for the sketch.
Step 4: Put it Together..
There are several options on this board – you can control the GPS by serial or using i2c, you can tie the “control” line of the radio direct to ground or you can control from the microcontroller etc.
The board is made so that you can put pin headers on the various options and change them around with jumpers. This is very useful in development. However, for the actual flight build, I wanted to hard-solder all of the jumpers to avoid anything losing contact in the harsh conditions of flight. This build therefore solders all of the jumpers but if you are developing your tracker you may well want to use jumpers until you know which option you want to use.
In general, I started from the centre and worked outwards for ease of soldering. The SD-card breakout needs to go on late because it covers a lot of the under-side and so prevents you from soldering on very much else once it’s there.
There’s a lot crammed into this board to make it small and cheap and light. That means it’s not terribly suitable for a first soldering project. However, it’s all through-hole so apart from being a little tight in places it’s not at all difficult.
The pressure-sensor mounted above the board on the ends of its legs. This just allows it to be clipped off again if we wish. It’s the most expensive component and you might want to use it on another project later.
The 1Ks for the status LEDs, the pullups for the DS18B20s, header for the external DS18B20 plus the crystal and caps. Nearly all resistors are vertical on this board to save space. Remember to use an 8MHz crystal!
The NTX decoupling cap, control line and voltage divider. The NTX changes frequency according to a voltage supplied on the control pin. To transmit RTTY 50 baud, we want a shift of around 500 Hz. I used 10K and 6K8. 1% resistors are a good plan here.
Microcontroller – make sure you bootload it first! If you haven’t done that yet, go back to the last step and do it now! Then solder it in. Don’t worry about direct soldering it, AVRs are hard as nails, but do get the notch at the right end – it’ll be a pig to un-solder.
Internal DS18B20 and reset switch. Dead easy.
Header – all pins of the ‘328 are broken out but most of them you don’t need. If you want to re-program it in place then you will need a 4-pin header for the Tx, Rx, Vcc and Gnd lines. Try to work out what other pins you might need and whether you want to access them from the top or side.
The voltage divider for battery sensing connects to A0 and senses against the 1v1 internal standard. You need to set the range according to the maximum your battery pack can provide because this input cannot go above 1v1 without risking damage (remember a 1.5v battery can be significantly higher when new). I used the arrangement: Batt-47K-A0-6.8K-Gnd which is safe to around 8.7v.
Now is a good time to add the status LEDs, smoothing cap and GPS jumpers. In the version of the board shown later the i2c pullups are properly on-board next to the pressure sensor. I forgot them on the first version so I added them on the underside, connected to the sda and scl jumper positions.
The NTX2 radio module slips in next, then have a good look over the board. I did not add all of the possible LEDs or headers. If you want any others, add them now because once the SD-card is in, it’s going to get a whole lot harder to solder anything!
The SD card sits under the board with its header pins soldered in from the top. A foam sticky pad will keep the boards from shorting and hold it nicely while you solder it.
Finally, the GPS breakout board attaches to the edge on header pins. I used the full length of the pins to put the GPS physically above and to the side of the main board.
For more detail: Make a High-Altitude Balloon Tracker (Arduino)