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.

truth.table.16.4

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.

Transom Lettering

Serenity has been a good little boat; she’s kept all her passengers safe, weathered rough conditions with only minor damage, and has been generally fun to be aboard.

There’s just one minor problem she’d been having: She looks so damned boring. There are plenty of gray boxes floating around out there. Some of them are pretty impressive, Serenity so far, is not. So what was a captain to do?
Continue reading

Simple machines

Something about simple machines always impresses me. A few nights ago I purchased a ½ ton chain hoist for my garage. I promptly used it to lift SV Serenity from its trailer and onto a pair of sawhorses. I did this lifting with one hand

That, my friends, is awesome.

In the sailing world, one uses blocks all the time to obtain a mechanical advantage. For example, Serenity’s mainsheet has a 2 to 1 purchase, (also known as a “gun tackle”) to help manage trimming in her sail. Without that advantage, I doubt I’d be able to even keep her mainsheet in during a gust, or even steady winds for any length of time.

The more I look at sailboats, the more I appreciate the beautiful simplicity in what they achieve. Harnessing the wind with simple machines; pulleys, winches, and cleats (wedges). Amazing stuff, and I’m filled with respect with for the people who have been improving the design of these crafts since the first person decided to stick a mast and sail on their boat.

Sewing Projects on Study Breaks

All the sail making supplies have arrived from Amazon, and I’ve been completely swamped in homework for the last two weeks. Not that I mind so much, really. Physics this semester is WAY better than last, I even got a high B on my first exam. (As opposed to last semester, 30% was my average on the first two exams. Yuck.)

I’m still plugging away at schooling, as it comes first, so when there’s time for breaks, I try to sneak something productive in there. Tonight’s task: Figure out what to do with this HUGE spool of poly thread. After much research online, I had picked up some V69 Poly Thread for my sails. It’s high tensile strength, UV resistant, and I fully expect it will outlive the sail itself.

Also, the spool it came on is made for a much more robust machine than mine. As you can see here, there is NO was that was gonna work on my trusty Kenmore…

Large spool is large.

Large spool is large.

I had to Google “How do I use an ENORMOUS spool of thread with my sewing machine?”. As it turns out, there’s a device that is made to solve this problem. You can buy a “Cone Thread Holder” for less than $10.

That simply would not do. Since I needed a study break, I decided to scavenge my office for parts to make one of my own.

  1. Old CD Spindle
  2. Zip ties
  3. Steel wire (~12 gauge)
  4. Rubber feet

Construction was pretty simple. After bending the wire to fit around the inside of the base, I fed about 16″ through one of the holes in the spindle and twisted a loop into the top. Then, zip-tied the wire to the base, and added the feet to help keep it in place.

Mmm. Rubber feet.

Mmm. Rubber feet.

And the finished product sitting in my Buffalo Bill-esque sewing room:
IMG_0493

The smaller loop in the wire was intended to cut down on the thread swinging all over the place when running at higher speeds. Unfortunately, it was eyeballed, and thus about 2 inches too low, and the thread binds on it.

First tests runs winding bobbins went very well. I managed to get 4 of them threaded without a single snag. I’m still troubled by how much the thread “dances” on the wire. It seems to have a tendency to wind itself backwards over the loop in the wire. If there’s one major annoyance when running a sewing machine, it’s having the thread bind or break mid-stitch. Eventually, I’ll want to work out a solution there.

Here is winding the last bobbin, and the basic setup:
IMG_0495

Back to physics homework!

“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.

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?

IMG_0470

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.

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

Q: What is the best way to mount a PCB?  A: On some cardboard, son!

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

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:

IMAG0287

On asking for help

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:
IMG_0455

IMG_0460

And here’s one of the back:
IMG_0456

All powered up:
IMG_0458

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

    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.
  • Draw out a full design first. Even if you’ve already made it on the breadboard.
  • 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.

NAND_block

NAND.circuit

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

IMG_0454

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.

IMG_0453

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:

Ground Score!

When one is a tinkerer, one learns to keep their eyes open for potentially interesting “junk”. This is a finely honed habit of mine that I’m fairly certain will cause relationship strife over the years, as my lady is kind of a minimalist. Tonight as we headed out for a date, I noticed a neighbor had placed a small pile of items at their curb for free. I couldn’t resist slowing down and taking a closer look. As it turns out, most of it was junk. Terra cotta pots, some weird shelves, kids toys… But then, I noticed a plug that looked suspiciously like an OBDII plug coming from under the pile. Molly was giving me a sideways glance, but my inner scavenger had to investigate further.

Good this he did, because this is what we ended up finding:

Score! Maybe?

Score! Maybe?

It was exactly what I thought it might be! A small OBDII scanner, sweet! The question is: Does it work? It seemed possible likely that it might have ended up in that pile because it wasn’t working. Who would throw out a working one? They aren’t super inexpensive. What is the first thing one should do with newly scavenged items? TAKE IT APART!
The back. Thrilling.

Two screws later, the cover was off. No batteries were seen that would need to be replaced. So that’s a plus.
IMG_0447

Closeup of the back of the board. (I apologize for the less than ideal lighting.)
The back.

And the front… Boring! Also disappointing, because the LCD is soldered to the back. Probably sturdier, but it would have been nice if it was attached to headers and could easily be removed for other projects, working under the assumption that it doesn’t actually work. Those two large copper areas are the contact point for the buttons on the front of the case.
The front

With not much going on inside the case, it was quickly reassembled. After going to the internets to find a manual, I set about plugging it into my car for the moment of truth. And….. It works!
It works!

Surprise surprise, the ERG is throwing errors again…
Stupid EGR

And that’s the story for tonight. Never hurts to keep your eyes on the curbs for goodies. Every now and then, you come out with a nice ground score.