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







video
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