Sunday, 29 September 2013

The Second GPS Tracker

When we started the project last year, the aim was always to get that infamous picture of the Earth’s blue haze and to say that we put something into near space – at the time, the method and technology was thought of as a means to an end. It didn’t really matter ‘that much’ how we did it, just that we did. However as we got more into the project and, after the second launch had issues with getting GPS lock, I decided it was time to improve the GPS tracker and make it ‘my own’. Using the prebuilt breakout boards and the Arduino Uno was definitely the way to go when we started out with personal electronic devices – it meant that the harder, unfamiliar electronics work had been done already. Therefore it was just a case of programming, based on the sample code, in order to get it working. I was, and still am, really proud of the first tracker, but I knew there were definitely areas that could be improved:
  • It was comparatively quite big and heavy, which ultimately meant that we needed more space and helium to take it up.
  • It took too many batteries to power it.
  • It was very much a ‘prototype’, where the components were soldered on to strip board – not always the most reliable method.
  • It was not very robust – we were always scared of dropping it – or it breaking on landing.
After speaking to a few guys on the #HighAltitude IRC channel, it became apparent that the best (and most fun) way of creating a new tracker would be to design my own in CAD and have my own circuit board created… so that’s what I did!

Designing the new tracker

The first thing I needed to do is work out what I wanted to achieve with the new tracker. If you aren't familiar with our first tracker, have a look here. I identified a few key areas:
  • Must be under 100g.
  • 3 or less AA batteries.
  • Look a lot more ‘professional (!)’.
  • Be a lot more robust.
  • Future-proof – with the ability to add additional features at a later stage.
STRATODEAN Designing the layout in Eagle CAD
Designing the layout in Eagle CAD
The second thing was – how do I build it!? It was at this point I managed to get some really helpful hints and tips from Chris Stubbs on IRC (chrisstubbs) on using the Eagle CAD software, and ensuring that my circuit would work! Chris has produced some really good tutorial videos on how to use Eagle – you can see them here and here.

The idea of Eagle is first to create a schematic. This is basically the circuit in block form, showing the logical connections and providing an overview of what is joined to what. Once you are happy with your schematic, you then move into the physical ‘view’ where you can then decide where on the finished circuit board the components will end up. Having not done this before, I found it quite time consuming but really enjoyable to work towards a finished board.

It was at this time that I had to make a decision on the form-factor of the components. On the first tracker I used ‘hole-through’ components – those that you have to poke through the board and solder on the other side. My third requirement above however, said that the new board needs to look more professional – so for this reason I decided that the best (and more challenging) way would be to use ‘surface-mount’ components. These, as their name describes, are soldered directly onto the surface of the circuit board and give that ‘made by a machine’ look. I knew this would test my soldering skills but I just went for it.

Circuit and components

Because prototyping on a breadboard has been known to introduce more problems than there would actually be, I took some advice and decided to create the board, have it checked and then hope it would work when I soldered it – a little risky but it had worked for others before, so I hoped for the same! I already knew I would be getting the boards from Hackvana for a very reasonable price, so it was a risk I was willing to take if I had to change the board because of some unfixable problem.

STRATODEAN Main components of new tracker
Main components of tracker
This circuit is designed to run off a minimum of 3AA batteries, but can run up to 6+ (if the additional external components require it). It does this by using the LP2992 voltage regulator, which takes any input voltage between 4v and 16v and outputs 3.3v. There is an error with the above diagram. I had mistakenly connected the bypass directly to ground, instead of through a capacitor to ground. Initially this was giving an output of half the expected voltage and took a little while to debug. The resolution was to simply disconnect the bypass altogether from the circuit, by cutting the leg off the regulator.

I decided to stick with the same microcontroller as in the first tracker, the ATMega328. This was because I was already familiar with this way of working and coding, so wouldn’t have to relearn this element. The other key components were also familiar – the same NTX2 model as before and the uBlox GPS chip, although this time using the upgraded Max7C which promised better power consumption. The GPS antenna also remained the same Sarantel brand as before, though this time a different model than was found on the previous breakout board. I later learned that Sarantel have gone into administration (at the time of writing), so I guess stocks of this antenna will soon diminish – will have to keep an eye on this. The same one-wire DS18B20 temperature sensors were included, I mounted one directly on the board and ensured I had a connection for the same external probe as on our second launch. Finally I included a micro-SD card reader to record our data as before.
For our next launches, we wanted some way of moving the camera or an object in near space. To do this I have made previsions to allow for a servo to be connected, with the power being delivered through a MOSFET to allow us to turn it on and off to save power.

Olimex ISP-500 AVR
Olimex ISP-500 AVR
When creating the first tracker, the interface with the computer I was using to program this was very straightforward – the USB lead from the Arduino Uno. In order to program this new board, I had to implement a different method – ‘In-Circuit Serial Programming’ – ICSP. For this to work, I purchased an Olimex ISP-500 AVR programmer from eBay, which would work in conjunction with the ICSP header on the board. One tip for the capacitors and resistors is to buy a sample book, which has every value you need – I got my one from eBay, posted from China. After a little configuring, programming the board was done in much the same way as before.

Soldering the new board

New boards!
Once I had received the fantastic new boards from Hackvana, it was then necessary to start soldering. The components were either ordered as manufacturer samples, or from eBay and HAB Supplies. I had done a fair bit of soldering in the past but never SMD. To research and get some knowledge on how to do this, I looked at these YouTube tutorials. As long as you have the right tools (small soldering head, small gauge solder, tweezers and flux) and take your time, soldering SMD components is a somewhat satisfying experience!

New code

The code from the first tracker was not ideal, it did the job but was not very refined and I knew many improvements could be made. I decided that if I was making new hardware, then the software would get the same attention. The main thing to improve with the first tracker was the fact that it was doing everything sequentially – looking for a GPS position, processing it, sending it over the radio, repeat. After some research I and talking with some people on IRC, the concept of ‘Interrupts’ was brought to my attention – they are fantastic! The idea is that you can set up a scenario where two portions of the code can be run at the same time. To do this you create your main repeating chunk of code in the loop, but at the same set up ‘timers’ which then ‘interrupt’ the main flow of code to process some other code, while continuing with the main flow. For our purposes, the GPS data receive and processing is the main body, while the radio transmission is our interrupt element. This has improved the reliability of the code no-end and I really do recommend trying to use interrupts instead of the delay code. You can see the basic working GPS and radio code on my Github code repository.

The finished tracker

STRATODEAN Second Tracker
The New Tracker
So here it is - I hope you agree it looks a lot more professional than the first one! We are very proud of this new tracker and can't wait to launch it.  It is 100g lighter than the first one and runs off 3 AA batteries so saving both weight and power. I have connections on the left for power, external temperature and two servos if required. Also included is the micro SD card. I haven't gone into too many technical details here, but if you do want to find out more, please drop us an email

We look forward to flying it soon!

No comments:

Post a Comment