# Digital Logic Design Project

The end of the semester is closing in, and the final projects have been assigned.

Here’s the one I drew:

Design a sequential circuit which adds six to a binary number in the range 0000 through 1001. The input and output should be serial with the least significant bit first. Find a state table with a minimum number of states. Design the circuit using NAND gates, NOR gates, and three D flip-flops. Any solution which is minimal for your state assignment and uses 10 or fewer gates and inverters is acceptable. (Assign 000 to the reset state.)

Test Procedure: First, check out your state table by starting in each state and making sure that the present output and next state are correct for each input. Then, starting in the reset state, determine the output sequence for each of the ten possible input sequences and make a table.

At first glance, it doesn’t sounds too complicated. Though, as with the first design project, I’m sure there are a ton of ways to get it working and minimize gate counts.

First order of business: Make a Truth Table!
I have omitted the “Don’t Cares” from this table, since my input range is restricted to inputs 0-9.

Next, we need a State Diagram. We’ve spent very little time on these, so admittedly, I expect this part to be a bit more messy.

# “Later Shelves”

After I made my last post I realized “Later Shelves” isn’t part of the vernacular. The idea is pretty straight forward: It’s the place I keep projects that are in progress that I want to finish, but can’t be due to either lack of gumption or resources. I kept having my work space overrun by these halfway built whatsits. I tried a few different organization methods, but could never find a suitable fix for this specific problem. I wanted something anti-static, compact, inexpensive, with easy access to get projects in and out of it.

I don’t recall where I saw it, (I think it may have been an URBEX photo page) but I saw something that really struck my eye. It was some form of map/blueprint/large document holder. Large flat shelves that rolled out of an open faced cabinet. I liked that. Easy to slide the projects in and out, and easy to see what was in each bin, but it was a huge and unwieldy solution. So that is out.

I then happened on the the “In/Out” boxes at my former workplace. Much better as far as size was concerned, and they were wooden, meaning no static issues, but kind of cumbersome to get things in an out of. I knew that I was much closer to what I wanted, and one day strolling through IKEA, it showed itself. The KVISSLE Letter Tray. Easy to see into, sliding trays that were lined with cork, and it’s got about a square foot footprint.

These are my “Later Shelves”. Top shelf used to hold the trinket clock. Looks like I need a new project. Nature abhors a vacuum.

Of course, sometimes later becomes a LONG time later, like the case of the SparkFun Metro-Gnome that I gave Molly as a gift. It wasn’t loud enough for her, so I planned to amp it. Still haven’t figured that one out… Sorry, love. Um. I’m working on it?

# Trinket Clock – Completed!

After being designated to the “Later Shelves” for months, I finally worked up some gumption this afternoon and finished the trinket clock. I’d originally posted about this build in the “Asking for Help” post in November. Now I don’t feel like I’ve wasted my entire winter break with family and playing GTA V.

My batteries on my camera were totally dead, so I didn’t document the build process. To be honest though, there wasn’t much to document: I made some measurements from the backs of the meters for the mounting holes, printed up the HOURS/MINUTES faceplates, and cut a big hole in an old lunchbox. Not much to write home about.

I did amaze my roommate with my spectacularly jerry-built internals:

Why yes, that is Scotch Tape holding that metal tab in place.

Q: What is the best way to mount a PCB?
A: Cardboard and zip-ties, son!

I think it turned out looking mighty sharp. The plain aluminum lunchbox with the simple meter faces came out very clean. It may even be my favorite new clock.

Lunchbox clock: Completed

# Lab Work – Flip flops.

“I said, a flip flop the flippie the flippie
To the flip flip flop, a you don’t stop
The rock it to the bang, bang boogie
Say up jumped the boogie
To the rhythm of the boogie, the beat”

My apologies to Sugarhill Gang…

Today’s lab project was considerably less complex than the one that preceded it. We’ve been studying flip-flops (though this is technically a latch), and the lab work today was to design a circuit using the same Quad NAND gate IC we’d been working with to create a SR-Bar latch.

In a nutshell: A flip-flop is able to store whatever state it’s been set to, high or low. It’s a circuit with a memory. Unlike the last section of lab, this one only took about an hour to get through from assignment to completion and being checked off by the instructor. I was pretty happy about that.

I even took a victory photo:

A few weeks ago, I gave into my insatiable lust for building clocks, and picked up the parts to construct this awesome clock.

I know, I know… Broke college student should probably not be spending what little funds he earns on MORE electronics… I think as I punched in my credit card number, I’d convinced myself that it was somehow school related, or at the very least educational. And therefore a justifiable expense…

It’s a pretty neat little project, the gist of it is this: A tiny microcontroller designed by Adafruit called the Trinket uses Pulse Width Modulation to control two ammeters. By varying the relative current through each meter, one can be read as an hour output, and one a minute output… Sexy!

During the build of this project, there were many opportunities to learn. (Read: I screwed a bunch of things up completely.) I’d never used a Trinket before. Getting it set up on my computer turned into sort of an ordeal. There are two methods to configure the Trinket, and while they’re similar, they are not the same. After banging my head against it for about 10 hours over the course of two days, I finally asked for help in the Adafruit support forum, and within two posts they quickly diagnosed where the problem was, and in turn I figured out what I was doing wrong.
(I had been modifying a config file for one method (AVRDUDE), when I meant to be doing it for the other (ARDUINO)…)

Asking for help is hard sometimes. A habit one would do well to develop before their mid-thirties. It’s a humbling experience to say “I can’t do this solo”, and I’ve had to do it a lot more often recently. It’s getting easier, though still pride still trips me up on occasion. Anyway…..

Once the Trinket was happily blinking along with the test LED pattern, it was time to move onto something a bit more fun: Building the circuit! I’ve done a bit of breadboarding, and had already finished making the circuit before I even had the Trinket up and running. Sadly, there’s not a picture of it, it was beautiful. Since this is to be a permanent addition to the clock collection, it needed to be made a bit more permanent. Fortunately, there’s a solution for this problem: Protoboard!

Now, this was a first. In this past I’ve put together kits from other people, but I’ve never had the freedom to lay out the components any way I want. A bit intimidating initially, but kind of nice, in the end. I opted to use rows of headers instead of soldering the Trinket and the RTC onto the protoboard. Something in me said “You never know when yo’re going to either a) want one of those components for something else, or b) need to replace them.”

Here’s a look at the top of the curcuit:

And here’s one of the back:

All powered up:

Detail of the meters without the hour/minute face plates in them:

Lessons learned:

• Read instructions slowly, and when you aren’t frustrated. The potential to misread things seems to be higher at those times.
• Keep in mind what Mitch Hennessy had to say about assumption.
• Leave a little wiggle room on the protoboard.
• Don’t be stingy. Buy some of these boards. Then you can use the exact layout from the breadboard.

# Design Lab Work

Today’s Digital Systems Design lab somehow managed to totally confuse the hell out of me… Since I couldn’t seem to get anything done while I was there, I figured I would poke at it when I got home.

The basic gist of the assignment is this:

wire a simple logic circuit and look at its output to gain experience with
correct breadboarding techniques. Then we will look at how CMOS (complementary
metal-oxide-semiconductor) logic circuits differentiate between a logical 0 and logical 1 state. As you know, these circuits use voltage to determine logical states, so there is some threshold which the voltage must be clearly greater than or less than in order to correspond clearly to one of the states. The difference between the output voltage and the input threshold is known as the noise margin.

This assignment uses a Texas Instruments 74HC00 Quad NAND IC, hooked up to a function generator on the inputs, and output to a scope. The lab manual gave us these diagrams and a few pointers to get us going.

I also grabbed the datasheet from TI’s website, which gave me the pinouts.

Each of the gates is labeled 1-4, with A & B inputs, and Y output. I’m still a bit confused as to how exactly the function generator, power supply, and scope plug into this, but I think I’ve managed to get a very pretty breadboard working here at home.

All of the red wires are 5V positive, the black goes to ground, the green wire is the input to the function generator, and the yellow will connect to my scope. (I’ve since looped it like the green one.)

Oh yes, I must give credit for my fairly neat breadboards to Michael Ciuffo at ch00ftech for his awesome video advice about breadboarding. Basically, he’s got some of the slickest breadboard skills I’ve ever seen, and which you can watch here:

# Sense of Accomplishment

This semester has been kind of hard on me. In addition to a crazy course load, I’ve had a lot of personal distractions going on, and settling into the role of a full time student has been a lot more difficult than expected.

So on the few occasions where I’ve really shined, I’m feeling rather proud of those moments. And tonight was a big one. My Digital Systems Design course has been a mixed bag. I did mediocre on the Boolean algebra, and now we’re designing circuits. Somehow, I seem to be pretty good at that especially now that we’re allowed some tools to help us out.

We’ve each been assigned a different final project for the course. The one I ended up with was this:

Design a circuit which multiplies two 2-bit binary numbers and displays the answer in decimal on a seven-segment indicator. In Figure 8-14, A and B are two bits of a binary number N1, and C and D are two bits of a binary number N2. The product (N1  N2) is to be displayed in decimal by lighting appropriate segments of the seven-segment indicator. For example, if A  1, B  0, C  l, and D  0, the number “4” is displayed by lighting segments 2, 3, 6, and 7.
Design your circuit using only two-, three-, and four-input NAND gates and inverters. Try to minimize the number of gates required.The variables A, B, C, and D will be available from toggle switches. Any solution that uses 18 or fewer gates and inverters (not counting the four inverters for the inputs) is acceptable.

Just 12 short hours ago, I was in class banging my head against the desk trying to figure out how to reduce the number of gates. (The count then was 20.) After much playing with Karnaugh Maps, some new solutions dawned upon me, re-groupings happened, and I managed to the my gate count down to 15!

I’m pretty sure that I’m in “A” territory for this project. Hopefully that will bring up my dreadful midterm grade in this course. (Curse you, Consensus Theorem!)

Here’s a peek at the final wiring diagram:

# Welcome Diversions

This semester has been especially brutal. My courses are far more difficult than anticipated, and I’ve had next to no time for anything outside of studying, more studying, and further studying… Last night I decided I should shift gears, and, boy, what a welcome change that was.

After digging around my electronics bins for something to tinker with, I came across a kit I’d purchased months ago, and never got around to assembling: An Adafruit DS1307 Real Time Clock.

I had originally purchased it with the intentions of building some sort of security/surveillance device built off an Arduino platform. And since I already have the rest of the components, and just got a brand new Arduino Leonardo clone from Borderless Electronics, I figured now is as good as time as any to put this thing together. That way, I can test out the new Arduino, and get the clock set up at the same time.

Soldering the kit took all of 10 minutes, including the time it took to unpack all my gear and heat up the iron. A really elegantly simple kit.

Once it was all assembled, I hooked it up to the Arduino and fired up the compiler…. Which turned out to be WAY out of date, so I upgraded the Arduino software, and transferred all my libraries to the new location. Now that THAT was taken care of, surely we would get to the business of setting the clock, right? Not so fast, me…

The directions for setting the clock from Adafruit’s amazing tutorial center: Adafruit Learning System used a different model Arduino, and I hadn’t read up on the I2C pin changes between the older models and the Leonardo model that I’m using… After about 30 minutes of digging around the Adafruit forums, I managed to rectify my problem and get the clock happily ticking along:

2013/10/2 23:58:28
since midnight 1/1/1970 = 1380758308s = 15980d
now + 7d + 30s: 2013/10/9 23:58:58

I probably won’t have time to actually cobble this together before this semester is through, but here’s the rest of the parts list so far, much of which I probably will decide is excessive:

That’s all I have for now. Updates to follow as time permits.

# Electra Bearcat III Scanner

One of the perks of my job is people will occasionally ask us to recycle their functional electronics. Which often translates to: “More toys for Marc”. A number of months ago I pulled this old scanner from the bin, mostly because I was drawn to its aesthetics. It’s an Electra Bearcat III, early 1970’s vintage. I saved it from the bin thinking at the very least, I could use the housing for another project at some point. It is simply too cool looking to be tossed in the trash.

Behold, a Bearcat

After sitting on the shelf for months, last night I decided to tear into it and see if I could make it work. Now, it should be noted that I know nothing about scanners, radios, what-have-you. This proved to be an advantage, since it seemed a smart move to document everything for my own reference.

The controls:
Fairly straightforward, there’s a Volume/Power knob, a Squelch knob, a toggle swithch for Auto scanning or manual channel selection, and on/off switches for each of the 8 channels. Red LEDs serve as channel indicators.

Internals:
The enclosure is held together by a single screw in the back, and the cover slides off to the rear. Looking down at the main board, there are the crystals in an array on the lower left.

There are 8 crystals, one per channel. There are also two modules; A and B, which correspond to the installed boards on the bottom of the main board. Here’s a close-up of the crystals, all installed in Module B. You can see some of the frequencies printed on the tops of the crystals.

On the underside of the unit there are two boards for the High and Low Bands. So plugging a crystal into one side or the other determines which board it connects to. Pretty cool. I would assume that means if I could find the parts, I could possibly get Citizen and other bands by replacing those boards.

Close-up of the boards, one covers a band from 30-50MHz, and the other covers 150-174MHz.

Okay, now that we’re familiar with the internals, I can start messing with things, right? Wrong. Despite my desire to tear into things all willy-nilly, discretion told me it might be a good idea to look over some documentation first. Thanks to the internets, I managed to locate a PDF of the manual!

Also, taking Adam Savage’s words of wisdom to heart, I made sure to take thorough notes.

First, I pulled each crystal, and noted frequency and location in module. After that I found a list of frequencies in my area, and jotted down any that sounded like they’d be interesting. Then since I misread the manual, I banged my head against the wall trying to sort out how to make the channels “be the correct frequency”… It doesn’t exactly work like that, and it took me almost an hour to figure out that I had misinterpreted what the manual was telling me. Somehow I got it into my head that with certian combinations of placing crystals in the modules, I could “tune” it. I was close, but it doesn’t quite work that way. For a crystal radio, you need the crystal with whatever frequency you are interested in. Without the desired crystal, it isn’t going to pick up that frequency. The End.

After cross referencing the list of frequencies I had, and placing them back into correct module, I figured I was out of luck. None of the crystals in either module had picked up the slightest trace of activity. It was closing in on midnight, and I had work in the morning. Dejected that I either had a dead scanner or a bunch of bunk crystals, I decided to call it a night. I liked the LEDs blinking though, so I left it running in my lab, figuring I’d poke at it this evening.

Just as I was drifting off to sleep, I heard voices coming from down the hall. As I got up to investigate, I heard an ambulance dispatcher speaking from my lab! Hey! It works after all!

What did I learn?
That taking the time to really understand documentation makes a big difference. I learned that sometimes thing are actually more simple than they appear. From researching I learned a bunch about the various radio bands and what’s on them. And, as I told Molly this morning before I wrote this blog: “Sometimes you have no clue what you’re doing, but that shouldn’t stop you from getting in there and doing it.” I think that may be the one of the most important lessons that anyone can learn. While it’ll occasionally blow up in your face, the experience is almost always worth it.

So now what?
As it turns out, crystals are still fairly easy to come across. A number of them can be found on eBay for about \$5 each. It’s a possibility that I’ll shell out the coins if I can somehow verify that I will be able to pick some interesting things with it. I have to imagine that the local HAMS would have that information, some forum digging is in my future.

# Nootropic Design Defusable Clock

Back in April, I went to the Minnefaire at The Hack Factory in Minneapolis. If you’re a local maker, this is an event you don’t want to miss when it rolls around next year. I got to meet Gordon Smuder of Transylvania TV fame. (Thanks for those puppet eyeballs, Gordon!) I also had a chance to speak with a couple makers whose work I’ve admired for a while now, Adam Wolf, one of the founders of Wayne & Layne, and Michael Krumpus of nootropic design.

While I love Wayne & Layne’s mission and think they have some cool kits to choose from, Michael is the designer of a fantastic clock kit that I have had my eye on for a LONG time… If you know me really well, you know I have a soft spot for clocks. My better half would say it borders on is an obsession. She’s probably right. I digress.

As I approached Michael’s vendor table, I saw the bright red 7 segment displays, crazy wires sticking every which way. Immediately recognizable as “the bomb clock” I’d seen around the web a year before. Somehow I wasn’t able to pull the trigger and buy one before, but here they were. Staring at me. It wasn’t long before I found my wallet in my hand.

It wasn’t even fair…

For around \$30, you get a kit with all the fixings to make the guts of the clock. Which is nice, because half the fun of this thing is making it look scary. Sadly, I didn’t document the build, because I’m terrible at taking pictures as I go, that said, here are a couple taken tonight after finishing the rest of the “prop”.

What makes this such a fun and unique alarm clock is the mechanism to disarm it: To disable the alarm, you need to cut the correct wire before the counter gets to 0:00. (Or pull it from the terminal, if you leave the screws loosened.) There’s logic built into it that randomizes which wire it will be each time. Great design, Michael. Really neat ideas like this are the reason I’m going into engineering. I only hope that my projects are this much fun when my time comes.

My clock build:
Clock Kit
1″ Dowels
Brown packaging paper with dynamite labeling.
(I found the PDF label on his forums somewhere.)
Electrical tape to bind them together