Posts Tagged ‘electronics’

Rocket Rigor Mortis

October 12, 2008 - 6:24 pm No Comments

The accelerometer is packed into the home made rocket, the nose cone is set. We light the engine’s fuse and wait. Will the engine explode and incinerate the miniature flight computer? The rocket sputters, coughs, and roars to life. It sails gracefully into the air, leaving only a smoke trail behind. The luck ends there: the parachutes don’t fire and the rocket is coming down like a meteorite.

It all started a month ago. My school allows seniors to leave early and work on independent projects. I was a junior, and I helped a group that was finding the best design of model rockets. My job was to design a device that measures acceleration, drop it in the rocket, and then figure out how high the rocket went. The way that accelerometer chips output acceleration is trivial. Higher voltage means a higher acceleration. I only needed some way of converting the voltage into a number, and this was not a problem. I had a PIC microcontroller with an onboard ADC (analog to digital converter) unit. I also had to save the results to somewhere inside the rocket. Since the rocket moves fast, it is necessary to take many samples, generating enormous amounts of data. The solution was to write to an external memory chip quickly enough. I had a whole month to do this, and it theoretically was very simple. I thought I wouldn’t break a sweat.

Two weeks into the process I changed my mind. It was not easy after all. The clock read four in the morning, I had school the next day, and initial plans were not working out. The pins on the three axis accelerometer are so tiny that I couldn’t solder them on. The external memory to which readings are saved was slower than dialup internet. I contemplated on giving up. I could have told the group building the rockets that I couldn’t do it. They could use a stop watch to find the height at apogee. I blamed my setbacks on not having a mentor and never taking physics, let alone an electronics class. I went to sleep that morning feeling defeated.

Yet I felt an illogical, burning desire to finish the job. I didn’t do homework for two whole weeks, pulled too many all nighters, and spent lunchtime hunching over part datasheets. Day by day I made progress. I managed to physically attach the accelerometer and optimize the memory write speed. A divine stroke of intuition helped me fix the memory corruption in the EEPROM. After innumerable compilations, burns, and tests, I finished the device.

On launch day, I watch the rocket hurtle to the ground and make a small crater in my backyard, to the dismay of my mother. Fingers shaking, I attach the device to a laptop. Did the crash landing damage the chip? Did it detect the launch and record anything at all? The laptop slowly outputs the flight data. The acceleration curve exactly matches the thrust curve of the rocket engine. It worked!

None of my grades or science fair ribbons could produce the satisfaction I feel from seeing that graph. I had built something from start to finish entirely by myself – something that I supposedly didn’t have the background to do. I taught myself electronics and embedded programming, and felt as if I were on top of the world. Everyone from a baker to a rocket scientist has felt the intimacy with something they have created – the smallest details, the long nights. That is why I love tinkering and making things.

Tracking a Rocket

May 15, 2008 - 9:54 am No Comments

Tracking the flight path of a rocket is tricky business. You cannot easily measure the velocity or displacement of the rocket. Wind speed and radar are silly things to measure on a rocket smaller than a big sandwich. All that is left to measure is instantaneous acceleration. If you know how fast you are accelerating in a given direction, you can use some simple calculus (or even addition) to determine your position. This technique is called dead reckoning. There are devices that can measure acceleration called accelerometers. These chips are becoming very popular: cell phones (iPhone), laptops (Lenovo) and other devices are using accelerometers to protect hard drives and rotate screen orientation. The human body detects linear acceleration with otolithic organs — layers of viscous gel in your inner ear. When you accelerate in some direction, the gel is slightly displaced and the change is detected by tiny hairs called kinocilia.

But linear acceleration isn’t enough. Your body, for example, also measures your rotation in space. Even with your eyes closed you can tell if you are lying sideway or are upside down. When your sense of orientation fails (when you’re dizzy), you get very confused about where you’re moving. It is similarly impossible (or at least very inaccurate) to determine position from acceleration alone on a rocket. A device that can measure this is called a gyrometer.
Your semicircular canal in your inner ear is filled with liquid; it senses your orientation (yaw, roll, and pitch) with tiny hairs. A gyrometer is an electrical analog: a tiny “tuning fork” is slightly bent when the device spins, causing a change in capacitance that can be detected. Not only is it imperative to track acceleration, we have to measure the rotational position of the rocket as well.

The funny thing about all these sensors is that they’re ratiometric. They don’t output the rockets speed in miles per hour or tilt in degrees. Instead, analog sensors output a higher voltage for a higher speed and gyrometers function analogously for tilt. It is therefore necessary to calibrate these sensors to 1g (9.8 meters/second/second) for accelerometers and standstill (parallel to ground) for the gyrometers. The linearity of the output of these signals is also not perfect: it is reasonable to expect that the output voltage would scale in a 1:1 ratio as speed increases, but this is not the case. All of these factors lead to a device that is of suspect accuracy and the results of which need to be verifiable.

There are three easy methods to double-check the data from these sensors. Air pressure is very high at the surface of the planet (imagine a two kilometer column of air above you) and drops as you travel away from the earth. Unfortunately this decrease is not linear, but the US Air Force has developed a formula that can approximate height based on atmospheric pressure. Atmospheric air pressure sensors are easily obtained and can also be included in the payload. Two other ways can confirm the apogee of the rocket: by measuring the angle the rocket makes relative to the ground, and by timing the time the rocket spends in the air.

The data from these sensors needs to be saved in flight and retrieved after landing. Therefore, a microcontroller will be needed to save these results. Rockets travel quickly and it will be necessary to poll the sensors often. An arbitrary starting figure is 50Hz (50 times per second). Since the sensors output analog data (a change in voltage) as opposed to digital (a change in pulse frequency), a microcontroller with an analog digital converter (ADC) will be needed. The PIC16F684 was conveniently on hand and has an ADC with a resolution of 10 bits — each voltage reading can be converted into a number from 0 to 1024. If there are three accelerations and two rotations (the spin of the rocket is irrelevant since it is a rod) plus a pressure reading, the controller will need to save six figures fifty times per second.

The rocket will track six 10 bit values fifty times per second. That means for each second of flight 3000 bits will be saved (about 3 kilobytes). On a computer, a 3000 letter document takes up 3 kilobytes. Microcontrollers feature paltry onboard memory, so an Electrically Erasable Programmable Read Only Memory chip is required. A one megabit module was available on hand, which is enough for about six minutes of flight time. To detect a launch, the controller will wait for a +5g impulse from the accelerometers to begin writing to EEPROM (it will keep a buffer of ten seconds prior to launch). Some optimizations can be made to the data that is saved: the 10 bit ADC is not very accurate and the last two bits can be discarded. Similarly, the pressure reading is not relevant until the nose cone is released (or else you’ll be recording the somewhat pressurized rocket tube).

The data on the memory needs to be uploaded to a computer. The microcontroller will need to interface with another circuit that will upload information to the computer. A two pin header will exist on the payload controller which will upload the flight data via an I2C (two wire) protocol. The “ground control” circuit will upload the results via an RS-232 (serial) interface. A software program will read the results which will be analyzed in Excel or Matlab using a Kalman Filter, an algorithm that smooths out noisy readings.

Some small features should include LEDs that signify recording state and proper orientation (if all accelerometers are reading proper values for a rocket perpendicular to the ground).

Building Rockets

May 5, 2008 - 12:26 pm No Comments

After the collapse of the Soviet Union, capitalist governments worldwide breathed a sigh of collective relief. No more opposing ideologies, no more space races, and no more competition.

Sputnik, in its intimidating shiny exterior, encourages young scientists no longer. Fervor for science is now motivated by desire for personal success. Patriotism and pride are replaced with the less romantic drive to get more money.

It is plainly apparent that there is not much interest in doing science and engineering (which is not the same as taking a class). There are few students that go home and whip out their chemistry sets and soldering irons.

Encouraging Creativity

Science and engineering is not about reading textbooks. It’s not about solving word problems. It’s not about going to class.

It is about playing in the sandbox. It is about building stuff. Most importantly, it’s about being creative. Science and engineering is like painting or writing novels, except you use a soldering iron as a pencil and brush.

My high school created a program where seniors (12th grade) can work on independent projects. They can make a play, start a band, or intern at a company.This is a trend in many schools across the country: schools are integrating “real world” learning into their curriculum. I’m participating in said program, and we’ll find out if it succeeds in teaching relevant stuff.

Building Rockets

I’m building rockets this year. I found a book at the school library on Amateur Rocketry. On the first page there is an insert that lists who took out the book and when. When do you think was the last time someone read that book?

April, 1983.

Nobody is interested in going to Mars anymore. I guess the Martians will be satisfied after all.
Anybody can build a rocket out of a kit: but its more fun to build it from scratch. What’s even more interesting is tracking the the flight path of the rocket. If your grandfather listened to Sputnik over the radio, he would probably track the altitude of his rocket with a stopwatch or by measuring the angle it made relative to the ground. But in the age of silicon, it is so much more appropriate to build an electronic payload.

So here’s what I’m doing. I’m building an altimeter using three accelerometers and a pressure sensor for verification. The accelerometers will provide three axes of acceleration data: X, Y, Z. The pressure sensor will provide the apogee (pressure is lower at a higher altitude). All this data will be stored by a PIC microcontroller onto a small EEPROM memory chip. Upon landing, the device will be recovered and stored data will be analyzed.

This data is useful in designing a rocket that will fly higher.