Saturday, June 13, 2009

Digital Electronics Final Project: Electronic Vault

Team Tesoro Casella: Josh, Rena, Caleb, Tim, Jim (Me) (Left to Right)

Over the last month I have been working on a five member team to construct an electronic locking system vault for my Digital Electronics class at school.  We were given several requirement that we had to fulfill:

-Use a CPLD(Complex Programmable Logic Device) and program in VHDL

-Have a four digit LED display.

-Be able to enter a four digit code that will unlock the safe if it is correct.

-If the code is wrong sound a whooping-siren, false an alarm LED, and lock the keypad for 5 seconds.

-Have a button inside the vault that when pressed displays the current correct code and if held down a user can enter and reset to a new code of choice.

-Give a presentation and demonstration and turn in a report documenting the project


So, we got to work on building this device and spent ~100 man hours building, programming, assembling, and testing this device.


We needed to design a circuit to power the whooping/undulating siren and LED, a system clock, and control circuit to activate our solenoid lock.


An issue we had to work with in designing our circuit was the different power circuits needed.  Our CPLD was designed to run at 3.3V while most Logic chips run at 5V.  However, after testing we found most of the basic logic chips we were going to use, a 7-Segment LED decoder and NOT gate still ran reliably at 3.3V.  Our 555 timers however did not, so we purchased 3.3V LVTTL(Low Voltage Transistor-Transistor Logic) chips to use and they worked well.  However we still had to have a 5V power circuit isolated from the rest of the circuit to power our keypad which was a PS/2 computer keypad that was spec’d to run at 5V and in testing we could only get it to run reliably down to around 4.3-4.5V.  That was all run from a single 9V battery running through two different transistor based voltage regulators.  We then had 2 separate 9V batteries connected in a + voltage and a - voltage configuration to operate an Op-Amp that would boost a 3.3V signal output from the CPLD to 12V to power our solenoid lock and also provide nearly perfect isolation to prevent current surges from coursing back through our circuit and burning up our CPLD when the solenoid was turned off.


Our clock was going to be primarily running our display which would cycle through each of the four digits one at a time so we needed a clock that could display at a minimum 60Hz per digit, for a total of at least 240Hz.  We ended up making a clock that ran at 400Hz because that assisted in the clock division inside the CPLD to produce a 5 second timer in code.  To make the clock we used a LVTTL 555 timer with 2x 12K Ohm resistors and a .1 microF capacitor.  The 555 timer does not put out a perfect square wave and so we were getting double triggers on each pulse, so we investigated using a schmitt trigger to clean it up, but we ended up just running it through a plain old NOT gate and that worked well.

An Oscilloscope Readout of Our Clock Signal


For the Siren circuit I used a modified version of a circuit I found on the internet.  I changed some values, 47K to 10K, and removed a wire between pin 6 and 5 of the two timers.  One of the timers produces a ~72Hz signal that makes the high pitched tone and the other produces a ~1Hz signal that causes the volume undulation of the other signal giving the siren sound.  While it worked, it tended to be a rather finicky setup.  It also interfered with our clock when it was on producing a low frequency beat on the clock signal and a high frequency interference on each square-wave pulse.  We worked to remove this by investigating a ferrite bead, though we ended up being at too low of frequencies to use it, a voltage follower which removed the low frequency beat, and a capacitor to ground off the Vcc input line of the clock.  This helped some, but not real well.   Thankfully it ended up not mattering, as when the siren was on while the CPLD was counting the clock signals and dividing them down, in the scale of 5 seconds a few missed or double triggered pulses out of 400 didn’t make a noticeable difference.  In the long run it would have been nice to just have used a dedicated external crystal oscillator for our clock so as to not have these problems.

Final Circuit Schematic


Our final circuit ended up being made on a solder less breadboard, but we had wanted to mill a PCB to solder all of the components on to for a far more finished look and to remove the worry of wires coming out at the last minute and not knowing where they need to go.  One of our team members entered our circuit design into NI Ultiboard and was going to mill it.  However, this to was foiled because of time constraints.  We made some last minute hardware revisions, and more importantly we were not able to get our hands on a drill bit to finish our board in time to still be able to solder it up and have it ready to be presented since we were the second of six teams to present.  Ideally, we would have had enough time to send our design off to have it laser etched which creates a far nicer board than a milling machine.  Still, it was good experience to learn how this is done even if we only got it partly finished.



Our Circuit During Testing


Our Essentially Completed Circuit Breadboard


For our keypad we used a PS/2 interface like from a computer keyboard.  All the other teams used a matrix type keypad where the computer tested a matrix of connections to see where they were made and so what key is pressed.  The keypad we used, while not looking as nice, was a little cheaper and used only two I/O pins on the CPLD rather than  the 7-8 which initially we thought was going to be an issue.  The PS/2 protocol uses a single data line and a single clock line to send synchronous data.  The lines float high and when a key is pressed the clock is activated sending packets of 11 clock pulses with a data bit on each pulse.  These 11 bits consist of a start bit(0), 8 data bits, an odd parity bit, and a stop bit(1).  We hooked a keyboard up to a digital oscilloscope and looked at the data being sent to get a feel for what we needed to do and understand it better.   


An Oscilloscope output of a packet being sent. 


 The protocol has certain make and break codes specified for each key.  A make code is sent when the key is pressed and the break codes are sent when the key is released.  Most keys have 1 make and 2 breaks for a total of 33 bits per key.  However, some special keys, such as the keypad enter, use 2 makes and 3 breaks for 55 bits total which was a contingency we had to program for.  The data is sent at ~12KHz.  Once we had the protocol specified we just had a comparison table in the code to determine what button was pressed, and it turns out when dealing with only the keypad we only needed to inspect the first 4 data bits after the start bit to tell what key was being pressed which helped save on macrocells, program storage, in our code.


In terms of programming, which I was not in charge of, our two biggest challenges were learning VHDL and not being able to fit our I/O and logic on one chip.  We continually ran out of macrocells, essentially the storage, and were unable to fit everything on one chip so we ended up using 2 CPLD chips and facilitating data communication between the two.  This was a problem every team ran into.  The other teams either used two CPLDs or just didn’t have full functionality with only one team being able to fit all essential functionality on one chip.  A lab assistant at school who is quite proficient in VHDL also didn’t seem to think it was possible to fit everything onto one chip, of course this was the first semester this project has been done with this particular chip.  In the end we ended up with ~450 lines of code, which with more time and VHDL experience probably could have been slimmed down a little.


Our box design we made out of wood instead of steel because of time constraints, and partly because of cost.  Since it was wood we decided to make it kind of classy looking with a nice wood and a stained exterior.  We did have a few hitches such as the hinges were on the outside of the door, unfortunately another side effect of time constraints and our mechanical engineer who was in charge of it was also involved in 3 other large projects in other classes over a similar time frame, but otherwise a very nice box.


Here is our completed vault and a video of it functioning.  This was quite a large project for a sophomore level 3-hour class, but I guess that is Dr. Kim’s way and pleasantly when we presented our box and demonstrated it it worked quite well, something that seems to rarely happen on projects, praise the Lord.






It's Finally Done!


The Electronics Compartment at the Top of the Vault








A Demonstration of our Vault


Hopps

41

Tuesday, April 21, 2009

I must thank my friend Copernicus for reminding me of MuteMath’s recent release of their new music video for Spotlight off their Spotlight EP.  It was release last week and is a marvelous video for marvelous music.  I personally love how MuteMath in their videos like to do things that kind of mess with the flow of time, their videos are simple and not too fancy but very entertaining and make you wonder how they did it.  They also don’t detract from the fantastic music.  I would highly recommend all their music to you, as Copernicus would put it, their style is “electro-synth-jam-improv-soundscape rock” and is amazing, as are their live shows which are incredibly energetic and well done!  Check them out.


MUTEMATH - Spotlight


Here is their first music video for their song “Typical,” it to is a wonderful song and music video.




This is a sweet video about the making of Typical.


Enjoy,


Hopps

41

Wednesday, April 15, 2009

Tea Party!




Today, April 15th, is the dreaded day of the year on which you must have sent in your income tax returns or have filed for an extension.  However, on this day in 2009 there will also be a large number of “Tea Parties” across the nation that have been organized to protest the rampant spending and taxing by the Federal Government.


The idea of a Tea Party and what sort of kickstarted this all is the rant by Rick Santelli on the Chicago trading floor in February live on CNBC.  He was talking of the Feds using the bailouts to rewards bad decisions and greed and he mentioned teh original Boston Tea Party that was a protest of the British taxing shipping and Tea in the colonies, partly to help the foundering East India Company.  He said we need to have another Tea Party, more or less figuratively, but the idea took off and there were numerous “Tea Parties” around the shortly thereafter where people gathered and often dumped tea into rivers and had peaceful protests.


A large effort has been made to combine efforts and “Tea Parties” all aroudn the nation on April 15th, Tax day.  This is largely being headed up by the AFA and their Taxed Enough Aready(TEA) Party initiative.  They are currently scheduled to happen in over 2,000 cities today around noon.  The actual parties though are all grassroots organizers.


ACORN, the infamous community group that is under scrutiny for massive voter fraud in the last elections, is also helping organize rallies on the same day in support of President Obama’s budget; they deny that they are going to try to interrupt the Tea Parties.  Most Tea Party organizers aren’t worried though.  Story


Anyways, I would encourage you to check it out.  If you are interested you can find one in your area by going to http://www.teapartyday.com/.  If you believe in it, even if you think it won’t be hardly noticed or make any difference, still attend!  If you are only talking about it you will make even less difference!  Remember though, this is a peaceful protest, as citizens have the right to have their voice heard, but they don’t need to be violent and disruptive.


I must say it would be pretty neat if this ended up being really big! :-D


Hopps

41

Tuesday, April 14, 2009

Somali Pirate Incident

As you are probably aware if you have been following the news at all there was an American ship off the Eastern coast of Africa that was attacked by Somali pirates last week.  The pirates boarded and then the crew fought them off for awhile.  Eventually the Captain gave himself up as a hostage so crew could go free.  The captain was held hostage in a lifeboat surrounded by the US Navy for nearly 5 days before being rescued when his life was deemed in immediate danger and Navy snipers took out 3 of the pirates while one had already surrundered earlier for medical treatment after his hand, which had been wounded inthe inital vessel capture, had become infected.  The goal was not to kill the pirates, but to capture them unharmed as was made abundantly clear numerous times.  However, if Captain Phillip’s life was in danger they were authorized, by President Obama, to use lethal force.  The pirates were being very threatening to Phillips, one of them pointing their weapon at him and they were talking very aggressively so the order was given to the SEAL snipers to shoot the pirates.  They made 3 shots that were quite precise taking all 3  out.


A couple comments:

  • Though I overall I disagree with a great many of President Obama’s policies and ideals, I think he made the right decision in this instance and I applaude him for that.  I personally was afraid he might pull a Carter and sort of commit, but not really, and cause a huge gaff.  However, he made a firm decision to use force to protect an American citizen and American shipping interests, interstingly the last time America attacked maritime maruaders was when Thomas Jefferson ordered the Marines to attack the Barbary Pirates at Tripoli in the early 19th century(Which ended up turning out well).
  • I also am happy that, at least apparently, the way things were done the Navy was given authorization and allowed to make their own decision without to much meddling from “higher-ups”.
  • There tend to be fewer ships flying an American flag, even if crewed by Americans and owned by an American company, than many other countries because of a large number, possibly excessive though I am not well versed in these things, of regulations and such that are costly and take a lot fo time.  This however is one very good reason to be flying an American flag, you have the United States Navy far more readily available and likely to help when things go wrong.
  • This alone is by no means going to stop the pirate action along the Somali coast, that would require a mixture of more forces and a stable government in Somlia to crack down on the land that has been lawless for two decades and to allow for legitimate business operations so the people can support themselves.
  • While it may not stop all pirating and attacks, I think this is very important to show that America means business and will fight to protect her shipping interests and citizens and that you don’t mess with America if you want to live.  It is that respect that has helped America in her wealth over the years.  This is also an extremely heavy factor in why the U.S. Dollar is the international currency that people and nations invest in when they want something that is incredibly stable and safe(or at least has been in the past).  The military might(and willingness) along with a stable economy and stable government are things that have made the U.S. Dollar accepted worldwide for years, hopefully that might continue though I fear that may not be the case.
  • I think this ties in very closely with the War on Terror.  It was absolutely necessary to do something after 9/11 to show that you can’t blatantly attack America and get away with it, unfortunately through many things from many sides, that I will by no means attempt to discuss here, it has drug on for a long time and will probably still take some time to finish out in Iraq and Afghanistan satisfactorily.
  • There is now talk of possible plans for more military action in the region, possibly helping the current Somali government.  While the violence there is bad, and might need military ships guarding things, I think any sort of broad military operation would not be good right now.  Besides the fact the military can’t handle it since they are stretched thin over Afghanistan and Iraq, partly because of huge budget cuts in the 90s, I don’t think the American public would like it, and it would turn into a long term commitment to help stabilize and rebuild the government that we honestly don’t need more of right at this time.



So those are some thoughts on this recent International incident that has so far ended happily and hopefully will not cause a large escalation in violence in that region.




For more information regarding the Somali pirate incident you can Google it or here are a few articles I found real quick:

Somali Pirate article from the LA Times.

Additional force in the area.


Hopps

41

Monday, April 13, 2009

World of Goo

Over the past few months I have been kind of participating in an online game of sorts calledMacHeist.  It is a website that has different puzzles and missions that allow you to win free software.  At the end they have a bundle deal for $39 that has a ton of software worth like $900.  Anyways, I bought it and have been playing a game that came with it called World of Goo.  It is quite a fun and rather addicting game where your goal is to assemble structures out of the balls of goo that stick together to get to a pipe at the end of the puzzle where you have to have a certain number left over to get sucked in.  Here are a few screenshots of that game.




Granted it does look a little crazy, but it is a lot of fun.  The guy who made this started with the website ExperimentalGameplay which has a lot of free basic games that are fun to play.  Each was made in one week by one person, it started as a project for a graduate level computer science class at Carnegie Mellon University.


Another application that I got in the MacHeist bundle is called KineMac.  It is essentially a smaller version of Apple's Motion software, a 2D/3D animated graphics application.  I don't have much time right now, but I'm hoping this summer when I am just working a job that I can get some time to play around with it and post some stuff.

This may not have been a very exciting post, but I wanted to post something and I couldn't think of much.  So this is what I posted.

Hopps
41

Tuesday, April 7, 2009

Music Blog-Copernicus

Music is an interesting and fascinating part of life.  It is something very unique to humans and is truly amazing in the way it can affect and touch the human soul and emotion.  There are so many different types and styles of music, some good, some bad, some different, some unique.  I personally have many different tastes and preferences concerning music, I try to have a broad taste in music, but keep it narrowed to good music.

The reason I am mentioning this is a friend, Copernicus, has started a very nice music blog called Copernicus the Music Connoisseur.   He typically posts a song of the week covering different varieties and tastes of music, but always "good music."  He will also occasionally post other things and information he feels is pertinent.  He is far more skilled in the world of music than I am so I would encourage you to check it out.  He is also in my site list on my blog sidebar.


Hopps
41

Thursday, January 22, 2009

The Next 100 Years

Yes, I know I need to eventually write something of my own up here, but for now here is an excerpt from the first chapter of the #1 best selling non-fiction book on Amazon. I have not personally read this book, but I thought the first chapter was quite intriguing and the author, George Friedman, founded Stratfor, from whom I have posted articles before. This book, The Next 100 Years: A Forecast for the 21st Century, discusses some general ideas and forecasts concerning world politics over the next century, I thought many of his ideas quite interesting, and not what many people would expect. So enjoy this and I will try to post something of my own sometime soon.


Hopps
41


OVERTURE
An Introduction to the American Age

Imagine that you were alive in the summer of 1900, living in London, then the capital of the world. Europe ruled the Eastern Hemisphere. There was hardly a place that, if not ruled directly, was not indirectly controlled from a European capital. Europe was at peace and enjoying unprecedented prosperity. Indeed, European interdependence due to trade and investment was so great that serious people were claiming that war had become impossible—and if not impossible, would end within weeks of beginning—because global financial markets couldn’t withstand the strain. The future seemed fixed: a peaceful, prosperous Europe would rule the world.

Imagine yourself now in the summer of 1920. Europe had been torn apart by an agonizing war. The continent was in tatters. The Austro-Hungarian, Russian, German, and Ottoman empires were gone and millions had died in a war that lasted for years. The war ended when an American army of a million men intervened—an army that came and then just as quickly left. Communism dominated Russia, but it was not clear that it could survive. Countries that had been on the periphery of European power, like the United States and Japan, suddenly emerged as great powers. But one thing was certain—the peace treaty that had been imposed on Germany guaranteed that it would not soon reemerge.

Imagine the summer of 1940. Germany had not only reemerged but conquered France and dominated Europe. Communism had survived and the Soviet Union now was allied with Nazi Germany. Great Britain alone stood against Germany, and from the point of view of most reasonable people, the war was over. If there was not to be a thousand-year Reich, then certainly Europe’s fate had been decided for a century. Germany would dominate Europe and inherit its empire.

Imagine now the summer of 1960. Germany had been crushed in the war, defeated less than five years later. Europe was occupied, split down the middle by the United States and the Soviet Union. The European empires were collapsing, and the United States and Soviet Union were competing over who would be their heir. The United States had the Soviet Union
surrounded and, with an overwhelming arsenal of nuclear weapons, could annihilate it in hours. The United States had emerged as the global superpower. It dominated all of the world’s oceans, and with its nuclear force could dictate terms to anyone in the world. Stalemate was the best the Soviets could hope for—unless the Soviets invaded Germany and conquered Europe. That was the war everyone was preparing for. And in the back of everyone’s mind, the Maoist Chinese, seen as fanatical, were the other danger.

Now imagine the summer of 1980. The United States had been defeated in a seven-year war—not by the Soviet Union, but by communist North Vietnam. The nation was seen, and saw itself, as being in retreat. Expelled from Vietnam, it was then expelled from Iran as well, where the oil fields, which it no longer controlled, seemed about to fall into the hands of the Soviet Union. To contain the Soviet Union, the United States had formed an alliance with Maoist China—the American president and the Chinese chairman holding an amiable meeting in Beijing. Only this alliance seemed able to contain the powerful Soviet Union, which appeared to be surging.

Imagine now the summer of 2000. The Soviet Union had completely collapsed. China was still communist in name but had become capitalist in practice. NATO had advanced into Eastern Europe and even into the former Soviet Union. The world was prosperous and peaceful. Everyone knew that geopolitical considerations had become secondary to economic considerations, and the only problems were regional ones in basket cases like Haiti or Kosovo.

Then came September 11, 2001, and the world turned on its head again. At a certain level, when it comes to the future, the only thing one can be sure of is that common sense will be wrong. There is no magic twenty-year cycle; there is no simplistic force governing this pattern. It is simply that the things that appear to be so permanent and dominant at any given moment in history can change with stunning rapidity. Eras come and go. In international relations, the way the world looks right now is not at all how it will look in twenty years . . . or even less. The fall of the Soviet Union was hard to imagine, and that is exactly the point. Conventional political analysis suffers from a profound failure of imagination. It imagines passing clouds to be permanent and is blind to powerful, long- term shifts taking place in full
view of the world.

If we were at the beginning of the twentieth century, it would be impossible to forecast the particular events I’ve just listed. But there are some things that could have been—and, in fact, were—forecast. For example, it was obvious that Germany, having united in 1871, was a major power in an insecure position (trapped between Russia and France) and wanted to redefine the European and global systems. Most of the conflicts in the first half of the twentieth century were about Germany’s status in Europe. While the times and places of wars couldn’t be forecast, the probability that there would be a war could be and was forecast by many Europeans.

The harder part of this equation would be forecasting that the wars would be so devastating and that after the first and second world wars were over, Europe would lose its empire. But there were those, particularly after the invention of dynamite, who predicted that war would now be catastrophic. If the forecasting on technology had been combined with the forecasting
on geopolitics, the shattering of Europe might well have been predicted. Certainly the rise of the United States and Russia was predicted in the nineteenth century. Both Alexis de Tocqueville and Friedrich Nietzsche forecast the preeminence of these two countries. So, standing at the beginning of the twentieth century, it would have been possible to forecast
its general outlines, with discipline and some luck.

the twenty-first century
Standing at the beginning of the twenty-first century, we need to identify the single pivotal event for this century, the equivalent of German unification for the twentieth century. After the debris of the European empire is cleared away, as well as what’s left of the Soviet Union, one power remains standing and overwhelmingly powerful. That power is the United States. Certainly, as is usually the case, the United States currently appears to be making a mess of things around the world. But it’s important not to be confused by the passing chaos. The United States is economically, militarily, and politically the most powerful country in the world, and there is no real challenger to that power. Like the Spanish-American War, a hundred years from now the war between the United States and the radical Islamists will be little remembered regardless of the prevailing sentiment of this time.

Ever since the Civil War, the United States has been on an extraordinary economic surge. It has turned from a marginal developing nation into an economy bigger than the next four countries combined. Militarily, it has gone from being an insignificant force to dominating the globe. Politically, the United States touches virtually everything, sometimes intentionally and sometimes simply because of its presence. As you read this book, it will seem that it is America- centric, written from an American point of view. That may be true, but the argument I’m making is that the world does, in fact, pivot around the United States.

This is not only due to American power. It also has to do with a fundamental shift in the way the world works. For the past five hundred years, Europe was the center of the international system, its empires creating a single global system for the first time in human history. The main highway to Europe was the North Atlantic. Whoever controlled the North Atlantic controlled access to Europe—and Europe’s access to the world. The basic geography of global politics was locked into place.

Then, in the early 1980s, something remarkable happened. For the first time in history, transpacific trade equaled transatlantic trade. With Europe reduced to a collection of secondary powers after World War II, and the shift in trade patterns, the North Atlantic was no longer the single key to anything. Now whatever country controlled both the North Atlantic and the Pacific could control, if it wished, the world’s trading system, and therefore the global economy. In the twenty-first century, any nation located on both oceans has a tremendous advantage.

Given the cost of building naval power and the huge cost of deploying it around the world, the power native to both oceans became the preeminent actor in the international system for the same reason that Britain dominated the nineteenth century: it lived on the sea it had to control. In this way, North America has replaced Europe as the center of gravity in the world, and whoever dominates North America is virtually assured of being the dominant global power. For the twenty-first century at least, that will be the United States.

The inherent power of the United States coupled with its geographic position makes the United States the pivotal actor of the twenty-first century. That certainly doesn’t make it loved. On the contrary, its power makes it feared. The history of the twenty-first century, therefore, particularly the first half, will revolve around two opposing struggles. One will be secondary powers forming coalitions to try to contain and control the United States. The second will be the United States acting preemptively to prevent an effective coalition from forming.

If we view the beginning of the twenty-first century as the dawn of the American Age (superseding the European Age), we see that it began with a group of Muslims seeking to re- create the Caliphate—the great Islamic empire that once ran from the Atlantic to the Pacific. Inevitably, they had to strike at the United States in an attempt to draw the world’s primary power into war, trying to demonstrate its weakness in order to trigger an Islamic uprising. The United States responded by invading the Islamic world. But its goal wasn’t victory. It wasn’t even clear what victory would mean. Its goal was simply to disrupt the Islamic world and set it against itself, so that an Islamic empire could not emerge.

The United States doesn’t need to win wars. It needs to simply disrupt things so the other side can’t build up sufficient strength to challenge it. On one level, the twenty-first century will see a series of confrontations involving lesser powers trying to build coalitions to control American behavior and the United States’ mounting military operations to disrupt them. The twenty-first century will see even more war than the twentieth century, but the wars will be much less catastrophic, because of both technological changes and the nature of the geopolitical challenge.

As we’ve seen, the changes that lead to the next era are always shockingly unexpected, and the first twenty years of this new century will be no exception. The U.S.–Islamist war is already ending and the next conflict is in sight. Russia is re-creating its old sphere of influence, and that sphere of influence will inevitably challenge the United States. The Russians will be moving westward on the great northern European plain. As Russia reconstructs its power, it will encounter the U.S.-dominated NATO in the three Baltic countries—Estonia, Latvia, and Lithuania—as well as in Poland. There will be other points of friction in the early twenty-first century, but this new cold war will supply the flash points after the U.S.–Islamist war dies down.

The Russians can’t avoid trying to reassert power, and the United States can’t avoid trying to resist. But in the end Russia can’t win. Its deep internal problems, massively declining population, and poor infrastructure ultimately make Russia’s long- term survival prospects bleak. And the second cold war, less frightening and much less global than the first, will end as the first did, with the collapse of Russia.

There are many who predict that China is the next challenger to the United States, not Russia. I don’t agree with that view for three reasons. First, when you look at a map of China closely, you see that it is really a very isolated country physically. With Siberia in the north, the Himalayas and jungles to the south, and most of China’s population in the eastern part of the country, the Chinese aren’t going to easily expand. Second, China has not been a major naval power for centuries, and building a navy requires a long time not only to build ships but to create well-trained and experienced sailors.

Third, there is a deeper reason for not worrying about China. China is inherently unstable. Whenever it opens its borders to the outside world, the coastal region becomes prosperous, but the vast majority of Chinese in the interior remain impoverished. This leads to tension, conflict, and instability. It also leads to economic decisions made for political reasons, resulting in inefficiency and corruption. This is not the first time that China has opened itself to foreign trade, and it will not be the last time that it becomes unstable as a result. Nor will it be the last time that a figure like Mao emerges to close the country off from the outside, equalize the wealth—or poverty—and begin the cycle anew. There are some who believe that the trends of the last thirty years will continue indefinitely. I believe the Chinese cycle will move to its next and inevitable phase in the coming decade. Far from being a challenger, China is a country the United States will be trying to bolster and hold together as a counterweight to the Russians. Current Chinese economic dynamism does not translate into long-term success.

In the middle of the century, other powers will emerge, countries that aren’t thought of as great powers today, but that I expect will become more powerful and assertive over the next few decades. Three stand out in particular. The first is Japan. It’s the second- largest economy in the world and the most vulnerable, being highly dependent on the importation of raw materials, since it has almost none of its own. With a history of militarism, Japan will not remain the marginal pacifistic power it has been. It cannot. Its own deep population problems and abhorrence of large- scale immigration will force it to look for new workers in other countries. Japan’s vulnerabilities, which I’ve written about in the past and which the Japanese have managed better than I’ve expected up until this point, in the end will force a shift in policy.

Then there is Turkey, currently the seventeenth-largest economy in the world. Historically, when a major Islamic empire has emerged, it has been dominated by the Turks. The Ottomans collapsed at the end of World War I, leaving modern Turkey in its wake. But Turkey is a stable platform in the midst of chaos. The Balkans, the Caucasus, and the Arab world to the south are all unstable. As Turkey’s power grows—and its economy and military are already the most powerful in the region—so will Turkish influence.

Finally there is Poland. Poland hasn’t been a great power since the sixteenth century. But it once was—and, I think, will be again. Two factors make this possible. First will be the decline of Germany. Its economy is large and still growing, but it has lost the dynamism it has had for two centuries. In addition, its population is going to fall dramatically in the next fifty years, further undermining its economic power. Second, as the Russians press on the Poles from the east, the Germans won’t have an appetite for a third war with Russia. The United States, however, will back Poland, providing it with massive economic and technical support. Wars—when your country isn’t destroyed—stimulate economic growth, and Poland will become the leading power in a coalition of states facing the Russians.

Japan, Turkey, and Poland will each be facing a United States even more confident than it was after the second fall of the Soviet Union. That will be an explosive situation. As we will see during the course of this book, the relationships among these four countries will greatly affect the twenty-first century, leading, ultimately, to the next global war. This war will be fought differently from any in history—with weapons that are today in the realm of science fiction. But as I will try to outline, this mid-twenty-first century conflict will grow out of the dynamic forces born in the early part of the new century.

Tremendous technical advances will come out of this war, as they did out of World War II, and one of them will be especially critical. All sides will be looking for new forms of energy to substitute for hydrocarbons, for many obvious reasons. Solar power is theoretically the most efficient energy source on earth, but solar power requires massive arrays of receivers. Those receivers take up a lot of space on the earth’s surface and have many negative environmental impacts—not to mention being subject to the disruptive cycles of night and day. During the coming global war, however, concepts developed prior to the war for space- based electrical generation, beamed to earth in the form of microwave radiation, will be rapidly translated from prototype to reality. Getting a free ride on the back of military space launch capability, the new energy source will be underwritten in much the same way as the Internet or the railroads were, by government support. And that will kick off a massive economic boom.

But underlying all of this will be the single most important fact of the twenty-first century: the end of the population explosion. By 2050, advanced industrial countries will be losing population at a dramatic rate. By 2100, even the most underdeveloped countries will have reached birthrates that will stabilize their populations. The entire global system has been built since 1750 on the expectation of continually expanding populations. More workers, more consumers, more soldiers—this was always the expectation. In the twenty-first century, however, that will cease to be true. The entire system of production will shift. The shift will force the world into a greater dependence on technology—particularly robots that will substitute for human labor, and intensified genetic research (not so much for the purpose of extending life but to make people productive longer).

What will be the more immediate result of a shrinking world population? Quite simply, in the first half of the century, the population bust will create a major labor shortage in advanced industrial countries. Today, developed countries see the problem as keeping immigrants out. Later in the first half of the twenty-first century, the problem will be persuading them to come. Countries will go so far as to pay people to move there. This will include the United States, which will be competing for increasingly scarce immigrants and will be doing everything it can to induce Mexicans to come to the United States—an ironic but inevitable shift.

These changes will lead to the final crisis of the twenty-first century. Mexico currently is the fifteenth-largest economy in the world. As the Europeans slip out, the Mexicans, like the Turks, will rise in the rankings until by the late twenty-first century they will be one of the major economic powers in the world. During the great migration north encouraged by the United States, the population balance in the old Mexican Cession (that is, the areas of the United States taken from Mexico in the nineteenth century) will shift dramatically until much of the region is predominantly Mexican.

The social reality will be viewed by the Mexican government simply as rectification of historical defeats. By 2080 I expect there to be a serious confrontation between the United States and an increasingly powerful and assertive Mexico. That confrontation may well have unforeseen consequences for the United States, and will likely not end by 2100.

Much of what I’ve said here may seem pretty hard to fathom. The idea that the twenty-first century will culminate in a confrontation between Mexico and the United States is certainly hard to imagine in 2009, as is a powerful Turkey or Poland. But go back to the beginning of this chapter, when I described how the world looked at twenty-year intervals during the
twentieth century, and you can see what I’m driving at: common sense is the one thing that will certainly be wrong. Obviously, the more granular the description, the less reliable it gets. It is impossible to forecast precise details of a coming century—apart from the fact that I’ll be long dead by then and won’t know what mistakes I made.

But it’s my contention that it is indeed possible to see the broad outlines of what is going to happen, and to try to give it some definition, however speculative that definition might be. That’s what this book is about.

forecasting a hundred years ahead
Before I delve into any details of global wars, population trends, or technological shifts, it is important that I address my method—that is, precisely how I can forecast what I do. I don’t intend to be taken seriously on the details of the war in 2050 that I forecast. But I do want to be taken seriously in terms of how wars will be fought then, about the centrality of American power, about the likelihood of other countries challenging that power, and about some of the countries I think will—and won’t—challenge that power.

And doing that takes some justification. The idea of a U.S.–Mexican confrontation and even war will leave most reasonable people dubious, but I would like to demonstrate why and how these assertions can be made. One point I’ve already made is that reasonable people are incapable of anticipating the future. The old New Left slogan “Be Practical, Demand the Impossible” needs to be changed: “Be Practical, Expect the Impossible.” This idea is at the heart of my method. From another, more substantial perspective, this is called geopolitics.

Geopolitics is not simply a pretentious way of saying “international relations.” It is a method for thinking about the world and forecasting what will happen down the road. Economists talk about an invisible hand, in which the self-interested, short-term activities of people lead to what Adam Smith called “the wealth of nations.” Geopolitics applies the concept of the invisible hand to the behavior of nations and other international actors. The pursuit of short-term self-interest by nations and by their leaders leads, if not to the wealth of nations, then at least to predictable behavior and, therefore, the ability to forecast the shape of the future international system.

Geopolitics and economics both assume that the players are rational, at least in the sense of knowing their own short-term self-interest. As rational actors, reality provides them with limited choices. It is assumed that, on the whole, people and nations will pursue their self-interest, if not flawlessly, then at least not randomly. Think of a chess game. On the surface, it appears that each player has twenty potential opening moves. In fact, there are many fewer because most of these moves are so bad that they quickly lead to defeat. The better you are at chess, the more clearly you see your options, and the fewer moves there actually are available. The better the player, the more predictable the moves. The grandmaster plays with absolute predictable precision—until that one brilliant, unexpected stroke.

Nations behave the same way. The millions or hundreds of millions of people who make up a nation are constrained by reality. They generate leaders who would not become leaders if they were irrational. Climbing to the top of millions of people is not something fools often do. Leaders understand their menu of next moves and execute them, if not flawlessly, then at least pretty well. An occasional master will come along with a stunningly unexpected and successful move, but for the most part, the act of governance is simply executing the necessary and logical next step. When politicians run a country’s foreign policy, they operate the same way. If a leader dies and is replaced, another emerges and more likely than not continues what the first one was doing.

I am not arguing that political leaders are geniuses, scholars, or even gentlemen and ladies. Simply, political leaders know how to be leaders or they wouldn’t have emerged as such. It is the delight of all societies to belittle their political leaders, and leaders surely do make mistakes. But the mistakes they make, when carefully examined, are rarely stupid. More likely, mistakes are forced on them by circumstance. We would all like to believe that we— or our favorite candidate—would never have acted so stupidly. It is rarely true. Geopolitics therefore does not take the individual leader very seriously, any more than economics takes the individual businessman too seriously. Both are players who know how to manage a process but are not free to break the very rigid rules of their professions.

Politicians are therefore rarely free actors. Their actions are determined by circumstances, and public policy is a response to reality. Within narrow margins, political decisions can matter. But the most brilliant leader of Iceland will never turn it into a world power, while the stupidest leader of Rome at its height could not undermine Rome’s fundamental power. Geopolitics is not about the right and wrong of things, it is not about the virtues or vices of politicians, and it is not about foreign policy debates. Geopolitics is about broad impersonal forces that constrain nations and human beings and compel them to act in certain ways.

The key to understanding economics is accepting that there are always unintended consequences. Actions people take for their own good reasons have results they don’t envision or intend. The same is true with geopolitics. It is doubtful that the village of Rome, when it started its expansion in the seventh century BC, had a master plan for conquering the Mediterranean world five hundred years later. But the first action its inhabitants took against neighboring villages set in motion a process that was both constrained by reality and filled with unintended consequences. Rome wasn’t planned, and neither did it just happen.

Geopolitical forecasting, therefore, doesn’t assume that everything is predetermined. It does mean that what people think they are doing, what they hope to achieve, and what the final outcome is are not the same things. Nations and politicians pursue their immediate ends, as constrained by reality as a grandmaster is constrained by the chessboard, the pieces, and the rules. Sometimes they increase the power of the nation. Sometimes they lead the nation to catastrophe. It is rare that the final outcome will be what they initially intended to achieve.

Geopolitics assumes two things. First, it assumes that humans organize themselves into units larger than families, and that by doing this, they must engage in politics. It also assumes that humans have a natural loyalty to the things they were born into, the people and the places. Loyalty to a tribe, a city, or a nation is natural to people. In our time, national identity matters a great deal. Geopolitics teaches that the relationship between these nations is a vital dimension of human life, and that means that war is ubiquitous. Second, geopolitics assumes that the character of a nation is determined to a great extent by geography, as is the relationship between nations. We use the term geography broadly. It includes the physical characteristics of a location, but it goes beyond that to look at the effects of a place on individuals and communities. In antiquity, the difference between Sparta and Athens was the difference between a landlocked city and a maritime empire. Athens was wealthy and cosmopolitan, while Sparta was poor, provincial, and very tough. A Spartan was very different from an Athenian in both culture and politics.

If you understand those assumptions, then it is possible to think about large numbers of human beings, linked together through natural human bonds, constrained by geography, acting in certain ways. The United States is the United States and therefore must behave in a certain way. The same goes for Japan or Turkey or Mexico. When you drill down and see the forces that are shaping nations, you can see that the menu from which they choose is limited.

The twenty-first century will be like all other centuries. There will be wars, there will be poverty, there will be triumphs and defeats. There will be tragedy and good luck. People will go to work, make money, have children, fall in love, and come to hate. That is the one thing that is not cyclical. It is the permanent human condition. But the twenty-first century will be extraordinary in two senses: it will be the beginning of a new age, and it will see a new global power astride the world. That doesn’t happen very often. We are now in an America-centric age. To understand this age, we must understand the United States, not only because it is so powerful but because its culture will permeate the world and define it. Just as French culture and British culture were definitive during their times of power, so American culture, as young and barbaric as it is, will define the way the world thinks and lives. So studying the twenty-first century means studying the United States.

If there were only one argument I could make about the twenty-first century, it would be that the European Age has ended and that the North American Age has begun, and that North America will be dominated by the United States for the next hundred years. The events of the twenty-first century will pivot around the United States. That doesn’t guarantee that the United States is necessarily a just or moral regime. It certainly does not mean that America has yet developed a mature civilization. It does mean that in many ways the history of the United States will be the history of the twenty-first century.