mbeds in rockets

The Goal

To find out what we can do with a mbed inside a rocket.

Possible Applications of the mbed

  • Accelerometer, to track the acceleration of the rocket.
  • GPRS unit,so as to stream data to the internet in real time and prehaps to communicate with the rocket i.e To control fins.
  • Coloured smoke, to be released precisely to perform Dot Matrix printing, prehaps using a mobile and GPRS unit to send and recive text.

  • Speedometer, to see the speed of the rocket.
  • GPS, to locate the rocket after landing, the GPRS unit could be used to text mobiles the direction of the rocket. Could also be used to map the path of the rocket, assuming a connection could be maintained (alternatively an X,Y,Z axis accelerometer could be used).

Choosing the rocket

Firstly and most importantly we had to choose our rocket. It had to be big and strong enough to carry whatever crazy stuff we decided to include later on.
After much searching we decide on Blu 97B-Cluster bomb. It had a wide diameter to fit loads of electronics into and was simple enough for us to comprehend (though the deal was done when we found it came with a free sticker!).

Testing

Our next objective was to get an accelerometer up and running with an mbed. For this we used the cookbook page LIS302 Digital accelerometer funhttp://www.mbed.co.uk/projects/cookbook/wiki/LIS302?version=5.

The first accelerometer had unfortunately been ravanged by a hot glue gun and was giving out some very suspicious numbers. The next one we tried didn't seem much better, claiming all the axis were at 0.018g, but then it transpired that the CS was plugged into the wrong pin. Once that was sorted out it happily chugged away, churning out far more belivible figures, our first success!

Once we had got the accelerometer up and running we wanted to be able to see the data in Excel. Que CSV (comma seperated values) files and Local storage. We used the cookbook page http://mbed.co.uk/projects/cookbook/wiki/HowCold, which was originaly written for a thermometer, and squidged it about to fit our accelerometer. You can also grab the finished code from http://www.mbed.co.uk/projects/cookbook/wiki/AccelerationDatalogger.
It took a while to get it right but we eventually finished with an accelerometer which would record its readings into a handy CSV file onto its local storage, nice. To make things even better Excel kindly accepts CSV files and orders them in to nice little columns. After that it was easy to plot the data into a simple graph:

This chunk of code is for the Gyro rather than the Accelerometer, but they are essentially the same.

#include "mbed.h"

LocalFileSystem local("local");               

AnalogIn xin(19);
AnalogIn yin(20);

Serial pc (USBTX,USBRX);
 //first we create a sample delay of 0.001 seconds
float sample_delay = 0.001;


int main (){
 //next we open a new file in local storage called Gyro.csv
FILE *fp = fopen("/local/Gyro.csv", "w");

int x;
 //we then set a for loop adding 1 to X a every time until X becomes larger than 1000
 for ( x = 0; x < 1000; x++ ){
  
 //we get the mbed to print the figures to the new file (fprintf) and to the screen via Tera Term (pc.printf), and get it to wait the sample delay
  fprintf(fp,"%.2f,%.2f,%.2f\n",xin.read(),yin.read());
  pc.printf("%.2f,%.2f\n",xin.read(),yin.read());
       wait (sample_delay);
       
 //finally we close the file
  }
fclose(fp);  
 }

Constructing the Rocket

Now we could log data from the accelerometer it was time to build the rocket!

First was the Engine mount. This was essentially a cardboard tube to fit the engine in. Sound easy huh? What we hadn't factored in was that the written instructions and the pictures were telling different stories, but once we had added up the different figures and chosen the most reliable things went smoothly enough. The next instruction to mount the engine mount called for the glue to be smeared around with a finger, but as we were using a hot gun gun we decided a different approach was advisible. Eventually the engine mount was mounted and the launch lugs applied and it was time for the fins.

As the fins were the only things preventing the rocket from doing a U turn and heading straight for us they had to be pretty exact. And so, typicaly, Estes had kindly supplied us with one intact fin, and three broken ones. But we persevered and coated them with card and superglue (which is suprisingly quick setting, but there were no serious incidents). With the fins on all was left was to insert the payload and parachute. Having forgotten to buy fireproof wadding we were forced to turn to the next best alternitive, tissues. This done our rocket was ready to fly! (hopefully)

The Flight

The first launch was, intresting. With a payload of sponge and batteries to simulate a phone we assembled in a field (the location of which will remain undisclosed) and pressed the fire button. The rocket then fired and, though it was clear the C engines weren't quite up to the job, landed perfectly as we had predicted. That was ALL that happened at the first launch. Nothing else whatsoever happened.

Reconstruction

The rocket did require certain repairs and modifications after its maiden voyage. These included a complete overhaul of the nose cone. This time, rather than placing the 'phone' inside the rocket we were going to insert it in to the nose cone, as well as protecting the 'phone' from the ejection charge this would also help stabilise the rocket (trust us). We also decided to modify the engine mount to hold D engines instead of C's (the biggest rocket engine you could buy without a firearms licence). This required a suprising amount of work as, in the previous construction, copious amounts of hot glue has been applied (which, when dry, is suprisingly tough). Once the engine mount was prised out A new one had to be constructed to accommodate for the new motor. This also meant the rear of the rocket had to be enlarged, as you can see this job was treated with the same loving care for precise precision as the rest of the rocket was:

Once this was done and a new nose cone was fashioned the rocket was ready to fly again.

The second flight

Again with the dummy phone we prepped the rocket for a second launch. Taking the D engine into account we assembled this time in a far larger (public) location (obviously safer). Apprehensively we stood as far back as the launching device allowed us and set it off. After a split second the rocket fired and, apart from a slight mishap with the parachute, completed what we can honestly say was a perfect flight. As a bonus not only was the 'phone' intact but the rocket also survived. This meant that we could immediatly fire it again, this time containing it's first real payload.

Swapping the payload and a bit of onsite reconstruction (darn that parachute).

The third flight

With the real phone safely secured within the rocket and some considerable untangling of the parachute we were ready to begin the real experiment. The nose cone and the 'chute were both held on with tape, but with our last success nothing could go wrong... and it didn't, nearly. The rocket fired and seemed to be going well, until a small black shape detached itself and floated away. It became apparent very soon that this had been the parachute (prehaps something to do with the tape holding it together?). As it was the rocket and and phone were both perfectly fine, and even better it hadn't been our bodged job with tape which had broken the parachute, in fact the ejection charge had singed and snapped the string in half (prehaps tissues weren't such a great subsitute for fireproof wadding).

Watch the launch here http://www.youtube.com/watch?v=zyY451Rb-50

The result

Obviously the most important question was whether the experiment was sucessful, and the answer was yes. A GPRS connection can be maintained during flight, which is great news for us as it means we can push data to the internet in real time!

So, what next?

Now we knew a GPRS link could be maintained our next objective was to send up the rocket with the GPRS unit, an accelerometer, a gyro and an mbed (obviously) and to push the data live to the internet.

The payload

The first task was choosing the gyro we were going to use. As we had almost no idea about what all the figures meant this was going to be tricky. After much trawling of the web we eventually decided on a triple axis gyro which, though perfect in every other respect, was unfortunately analog. While we waited for that to arrive we began to solder the rest of the components. We tried to squeeze as much as we could into the smallest area possible to fit in the rocket, soldering pieces under each other (which meant that tweezers had to be employed to place certain components into position). These included the triple axis accelerometer, a duel axis gyro and a sim card reader (so we could store way more information!). Once they were soldered it was time to start on the GPRS unit. The unit had come with a connector which was far too big to fit in the rocket, and as we didn't need all fifty pins it was decide that the best way was to wire up our own connector. Only six wires had to soldered, but unfortunately each pin was a quarter of a millimeter across. And so, after two and a half hours in a tiny room staring down a microscope they were all soldered on (We hoped).

Coding

The coding for most of the device was simple, it used the afore mentioned links and http://www.mbed.co.uk/projects/cookbook/wiki/SDCard which were all mish mashed together to form a device which would take accelerometer and gyro readings and pop them onto a convinient SD card as CSV files. That was the easy part, what was much harder was the coding for the GPRS unit. For that we were partly using PHP. First we had to make the GPRS unit take all our data and send it to the internet as an url (values can be passed along urls in the form of www.website.co.uk?values&morevalues&value=evenmorevalues using _GET).It had to be programmed to switch on (not as easy as you might think!), create a buffer (more on that later) and finally sent the data to our computer. Then the PHP came into play. It had to retrive the values, we decided on using _POST as it allowed us to transport far more data(data sent using _POST is hidden and, unlike _GET, is not shown with the url), and place them into a mySQL database.

Construction

As we had finally achieved what seemed to be the perfect design after two launches the rocket needed little maintenance. All that was left to do was to fit the payload snugly into the nose cone and attach the two launching wires, oh, and of course there was the new parachute to make.

Attachments