Thursday, May 5, 2011

Remembering Alan Shepard

Today the news services are remembering Alan Shepard’s flight in the Freedom 7 capsule fifty years ago, on May 5, 1961. He was the first American to fly in space and a true American hero. This seems a fitting day to share my own small personal recollection of him.

When I was in sixth grade I was fitted with a large, uncomfortable back brace that I had to wear 24 hours a day. That was the current treatment for scoliosis in 1967. It was physically uncomfortable and limited my activities, but far more burdensome to a young middle school student were the unwelcome stares and notoriety at school. My mom and dad knew I was having a hard time, but what could they do? As a parent now I can imagine how they felt.

Dad worked at NASA, and one day he was telling some of his colleagues about his concern for his son. One of those colleagues was Alan Shepard, and when he heard the story he wanted to do more than just sympathize. “Would it help if I came to visit him at school?” Dad thought that was a great idea, so they picked a day and made the arrangements. The two of them took off work one morning, drove to my school (about an hour from the Center) and visited me in my sixth grade math class. All the kids were so eager to meet a famous astronaut they practically leaped out of their seats. He shook hands, signed autographs, and answered questions from the class for about fifteen minutes. Then they left and drove back to work. I was an instant celebrity.

I never met him again after that day, but I will always be grateful. Alan Shepard was not only an American hero, he was a good and decent human being.

Saturday, October 2, 2010

Robot Redux

After many months of inactivity, Alan and I have restarted the robot project. If you recall, we wanted to build a robot that would balance on two wheels and could be controlled by a remote. Last time we succeeded in building a robot that could travel about horizontally on three wheels (actually two wheels and a caster). But it didn't have enough power to do a wheelie. In our attempts to increase the power by increasing the voltage of the battery pack I think we managed to burn out one of the motors. It began to lose power so that the robot could not drive straight. Since one goal of the project was to see how cheaply we could build such a robot, the motors we used in Rev 1 were very cheap. This time around we decided to rebuild the original design with better motors. Below is a picture of the new Rev 2. Notice how small the motors are! They are actually more powerful than the last ones. I put a quarter on top of the right motor to give you a sense of scale:

And here is a picture of the internals showing all the breadboard wiring. In this picture, the robot is plugged into my PC via the USB port. That's how we download new software and upload performance data:

Here's a close-up of some of the breadboard wiring:

Here's a video of Rev 2 showing it being successfully driven around our kitchen right after we finished building it. We initially set the power level at only 25% of full throttle to make sure we didn't burn anything out right away, so the vehicle can move faster than this, but not a lot faster:

Even though we bought more powerful motors, this version is still nowhere near powerful enough to do a wheelie. Not even close. My goal for this round is to experiment with the balancing logic, even if the vehicle has to be manually helped to an upright position.

The big issue is still whether we can balance at all using this design. Because we were going for a cheap design, the current vehicle has no encoders to determine wheel movement and no gyro to determine rotation rate. The only sensor is an inexpensive 3 axis accelerometer (the MMA7260Q). This is a configuration that conventional wisdom says cannot be made to balance successfully. We will probably succeed only in proving the conventional wisdom, but I want to give it a go, anyway.

After these photos were taken, last week Alan wired up the accelerometer to the Arduino microprocessor board. Unfortunately, I forgot to add a line in the software to set the ADC circuit to the right mode so I burned out that part of the microprocessor. The rest of it still works, but it cannot do any analog-to-digital conversions. So I couldn't start work on the balancing software. I ordered a replacement chip which arrived this week. It's going to be a bit of a pain for Alan, because he will have to practically disassemble the thing to replace the CPU. Hopefully this weekend we can do the repair and we'll be back in business.

Thursday, September 10, 2009

Post Mortem - Robot Rev 1

It's been a long time since I posted our progress on the self-balancing robot project. As you may have guessed, that's because it's been a long time since we worked on it. Our first attempt didn't go all that well, and we both got busy with other projects. Recently Alan and I have been wanting to jump back in and try again. This report will describe what we learned from our first attempt.

As you may recall, last time I reported that the robot was able to roll around and respond to commands from the remote control. We had two problems, however. The first was that one wheel started turning immediately after we switched on the power. It would continue to turn for a couple of seconds until the Arduino microprocessor finished booting. Our proposed fix worked well. We installed a couple of pull down resistors to hold the control line low until the computer began driving the signal low. (They were hard to add, though, because the finished breadboard wiring was very messy. That's another area we want to improve next time.)

There was still a question about how the motors were drawing any current when the USB was connected to the Arduino but the battery wasn't. After some discussions on the Arduino message board, it was decided that indeed there would be some voltage on the VIN pin if you applied power to the 5V pin. So that mystery was solved. With all of that, we now had a dandy little remote control car.

However, we were a long way from a self balancing robot. The second problem was more fundamental. The motors clearly didn't have enough speed and/or torque for the robot to do a "wheelie". If it couldn't raise itself up on two wheels to start with, there was no way it was going to balance on two wheels. We tried increasing the voltage by switching to 8 AAA batteries instead of 6 AAs. But it was nowhere near enough. On top of that, after we had made a number of attempts to fix the problem the motors began to turn even more slowly. One wheel, in particular, was turning very slowly. We checked the voltage across the motor leads and that wasn't the problem. Clearly the motor itself was failing. So the bottom line is we are going to need new, more powerful motors. The ripple effect of that change will result in several more design changes. For instance, more powerful motors will draw more current than the current H-bridge can handle. They also may not fit in the same location on the chassis. At that point we realized we were going to need a Rev 2 on the whole design.

It's not all bad news, however. Here are the things that went well:
  • Using the DVD remote control worked great!
  • Programming the Arduino was easy and fun.
  • The motor control circuit worked well once we added the extra pull down resistors.
  • The overall physical design worked well, including the idea of using a plastic project box as the chassis.
So we actually managed to build a remote controlled car from scratch. That in itself was fun and rewarding. To close, I finally have a few pictures to post so you can see what we built.

Here is the robot all assembled. Do you like the racing stripes? We were experimenting with AAs versus AAAs, so we had rubber bands holding the battery packs on:

This is a closer shot of the front end showing the roller that serves as the front wheel (there's one on each side) as well as the IR remote control receiver and an LED to indicate system status:

And here is a closer shot of the back end. It shows the power switch as well as the USB port used to program the Arduino. The small black button is a reset button. We never needed it because the software worked great:

Saturday, July 18, 2009

Remembering Apollo

I was raised on the space program. On my sixth birthday in 1962 my family moved from Fort Worth to Houston so my father could take a job at NASA. He was an aeronautical engineer at General Dynamics in Fort Worth when it was announced that NASA was building a new space center in Houston. He applied immediately, but it was some months before he landed a job there. At that time the Mercury program was in full swing, but Dad was hired to work on Apollo. President Kennedy had already committed the nation to go to the moon.

It took hundreds of thousands of people to make Apollo 11 possible. I am proud of my father’s role, but it is humbling to realize how many others were involved. He worked initially on the aerodynamic design of the launch escape system. That’s the small rocket that sits atop the capsule, ready to lift it quickly to safety if anything goes wrong with the booster. We still have a wind tunnel model which was used to test one of the early designs. Later he worked on the reentry aerodynamics. Coming back from the moon, the Apollo command module would reenter the Earth’s atmosphere at 25,000 mph, much faster than any previous spacecraft. This was an aerodynamic challenge of the first order. On top of that, Apollo was the first capsule designed to be a solid lifting body, so the astronauts could fly it down to the designated target area. With this ability the Apollo missions routinely landed within sight of the recovery ship.

I remember being a space junkie even before we left Fort Worth. At that time, every mission received full TV coverage from launch to splashdown. I was always glued to the tube. I watched the coverage of John Glenn’s first orbital flight, and I remember, even at five years old, the anxiety about whether his heat shield was loose during reentry. Later I followed every achievement of the Gemini program as NASA worked out the techniques that would be needed for Apollo: longer flights, larger crews, spacewalks, rendezvous and docking. Other boys collected baseball cards and memorized game stats. I became a walking encyclopedia of space trivia. I could tell you the height of the Saturn V rocket, the thrust of each stage, and every detail of the mission profile. I knew the names of most of the astronauts and could tell you which missions they had flown on. I had posters of rockets on my bedroom wall. A packet of publicity photos from NASA was one of my most treasured possessions.

The night of July 20, 1969 our whole family gathered around the TV to watch as the Eagle touched down on the moon. What an exciting time it was to be alive. Something like a quarter of the entire world population was watching with us at that same moment. The sense of wonder, pride and history was palpable. After the landing, it was to be several hours before the astronauts exited the vehicle. I remember we went outside and stood in the backyard, staring up at the moon. How strange to think that two men were there on the surface at that moment. I remember marveling at the thought that something could be in plain view, and yet so far away as to be invisible. It was hard to imagine just how far away they were.

When the moon walk started we were again glued to the television. We sat in the darkened living room of our home: my parents, my sister, my grandfather and me. I sat on the floor near the TV with my grandfather behind me on the couch. When the first ghostly images began to be transmitted we strained to make out what we were seeing. There was no doubt, though, about what was happening the moment Neil Armstrong stepped off the landing pad and onto the lunar surface. His words are burned in my memory. “I’m going to step off the LEM now. That’s one small step for a man, one giant leap for mankind.” The words seemed so appropriate.

However great the novelty and wonder of that moment was for me, I cannot fathom what it must have been like for my grandfather. Born in the Oklahoma Territory in 1892, he often told us stories of the first time he ever saw an automobile and the first time he heard about the Wright brothers at Kitty Hawk. In his lifetime mankind had gone from the first halting steps at heavier-than-air flying machines to massive rockets propelling three people to the moon, a quarter of a million miles away. As we watched the astronauts exploring the surface, every few minutes a title graphic would be displayed on the screen saying “Man on the Moon”. And every time it came on the screen my grandfather would read it out loud, in a tone of voice that spoke volumes. It was as if he couldn’t quite believe he wasn’t dreaming.

My grandfather died in 1979 and my father died in 1995. I have gazed up at the moon thousands of times in the past 40 years, and on none of those occasions was any human presence there to wonder at. Will there ever be again? Surely it will happen again someday, but my grandfather will not be here to see it, nor my father, nor perhaps will I. And now as I think back to that magical night 40 years ago it is as much with sadness as with wonder. The promise of that moment seems yet unfulfilled. I am still a space junkie. I still await eagerly each new development in the conquest of space, but I am chastened by the slow pace at which the future becomes the present. It is in this context that the accomplishments of my father’s generation seem even more extraordinary. Congratulations, Dad, to you and all your colleagues for a feat that only in hindsight, perhaps, we can fully appreciate.

Friday, March 13, 2009

The robot is rolling (literally)

Last weekend Alan finished assembly of the self-balancing robot, Rev 1. This first version isn't supposed to balance on two wheels yet, just roll around on three wheels. It works! Well, sort of. We have some debugging to do, and some design changes are in the offing. I still have no pictures to post, for which I apologize. Alan has the camera and I haven't had a chance to upload them.

It was pretty exciting when we first powered it up. Alan plugged the Arduino into the USB cable so we could download the software, and immediately one of the two wheels started turning! It didn't stop until the control program was finished downloading and booted up.

Now, mind you, I was pretty shocked because we hadn't connected the batteries yet, and the motors are supposed to be getting their drive current from the batteries. Somehow they were getting 5V power from the USB via the Arduino. I was concerned because the Arduino can only source 40mA from each pin and if we were drawing too much current it might be damaged. We discovered, though, that if we go ahead and unplug the USB and run from the batteries, the wheel still turns a couple of seconds, but then everything seems to work after it boots. We can use the IR remote control to drive it around on the floor. Pretty cool!

So now I have several questions to investigate:

1. How can the motor draw power from the USB through the Arduino?
2. Why is it only one motor that turns at power up?
3. How can I fix it?

Here's the circuit diagram (click for a larger version):

The H-bridge is actually an SN754410 although the diagram says L293E.

I think we can probably keep the wheels from turning at power on by adding pull down resisters to the enable lines on the H-bridge. I'm guessing the enable pin voltage is basically drifting until the Arduino drives it low in the setup routine. But I really don't understand how the power is getting to the motor. I hope to get some help from the Arduino user forum.

Aside from the mystery of the spinning wheel we have one major design issue. The motors I selected have plenty of torque, but not nearly enough speed, for the robot to lift itself to a vertical position. We are looking at ways we can address this short of simply buying different motors. The first thing we want to try is to get a little more speed out of the existing motors by upping the voltage. We intend to replace the six AA NiMH batteries with eight AAA NiMH batteries. This also makes the robot lighter. Eight cells will give us a nominal 9.6V, which after the 1.4V drop in the H-bridge becomes 8.2V. This is substantially higher than the net 5.8V we have now. The motors are supposedly rated at 12V, although I'm pretty sure they would overheat quickly if driven continuously at this voltage. But it will only take a fraction of a second for it to raise itself to vertical.

We'll try the pull down resisters this weekend, but we're waiting for parts to convert from AA to AAA batteries.