Jim Williams style Digital Clock

ClockWhile I was working on my clock project, I had the idea of creating a clock cube that would be encased in epoxy resin. Not only would it be functional, but it would look cool as you would be able to see the innards of the clock.

As I worked on the skeleton of the clock, I noticed that it looked similar to something that you would see in a Jim Williams datasheet! I decided to continue the project under that motif.


I have yet to encase the clock in epoxy resin, as I am afraid that it won’t go well. Putting the clock together took a day and a half of work, and I wouldn’t want that to go to waste. I will hopefully get a chance to test some resin casts on small items sometime soon.

Clock Side

A few notable bugs I had in my design (For those of you that like thinking about such things):

1) I was having issues with the microcontroller resetting when it displayed certain digits on the 7-segment displays. Ends up I had forgot to turn off brown out protection on the uC, and the current draw from the LED’s was pushing the main voltage below the default brown out level for the uC. This was easily remedied by adding some bulk capacitors and turning off brown out protection (not too important for this stripped down clock).

2) One of the last things I did whilst developing the hardware was adding in the stand alone power supply. I opted into using a simple LDO and a wall wart. I wired everything up on my breadboard, and it all seemed to be happy. Once I unplugged my scope probe though, trouble arrived. Whenever I pressed a button to change the time, the whole clock would reset. This issue arose since I had been lazy with my output capacitors on the LDO. I neglected the fact that there needs to be a certain ESR on the capacitors for the LDO to operate stably. What threw me for a loop was the fact that the clock worked perfectly, and the power rails looked great when I was probing it. I didn’t realize until after reading the datasheet on the LDO and asking some friends, that I had the LDO driving a nearly complete capacitive load, and it was becoming unstable whenever any meaningful current was drawn. Easily fixed by replacing the ceramic output capacitors with an electrolytic cap that had the required ESR for the LDO.

3) I was running into flash space issues with my code. I had created a interrupt that would run when the button was pressed, and the interrupt would update the time nicely as long as the button for it was held down. When I tried to compile this code, the XC16 compiler complained of too many nested if statements, and too little program memory; oops. I forgot about how compilers tend to unwrap while loops and if statements, which ended up taking most of my program space. I was able to circumvent this by simply having one complete button press as one increment of either the minutes or hours (depending on which button was pressed).

Display Module

I have a partial schematic of the clock, which I will try to finish up to add to this post. In the meantime, I have some images of the clock operating, which shows off the (partially) point to point design. I also have the code completely available on my .


Hopefully I have some time to continue some projects this school term!

Display Module 2

Clock Top

Clock Front


Long Time, No Update! (New Project)

So, I haven’t had the chance to work on a new project for a while. I’ve been very busy with school, then work, then school again…

So I’ll post a quick update on a Digital Clock project I’ve been working on.

I will be creating a PCB for this, I have plans with my girlfriend to make a cool enclosure for the clock.

As of right now, the project is just a mess of wire on a breadboard, but it currently works as intended. More project details will be added as I get more time. For now, I give a picture and a link to the GitHub page for the projects firmware.

What a mess.

What a mess.



APC BK500 Uninterruptible Power Supply Teardown

Hello all!

Sorry for the long delay, exams happened and now I am just getting settled in at my Co-op position at Dairy Cheq (Electronics R&D)!

I have some projects planned for the near future, stay tuned!

In the meantime, I acquired quite a chunky piece of office kit that is nearly functional, a APC brand UPS!

From what I can tell, everything in it works a treat, except the battery is shot (sitting at 7 mV of voltage right now). I will be looking for a used UPS battery, but I decided to take a look inside at all the heavy goodies!

Front of the unit. Unfortunately, it was way too easy to open to include more disassembly pictures (2 screws and a tug).

Here is the back end, with all the protected and backed up mains connections.

Here is how the inputs are laid out in the back, quite an interesting setup to distribute that power around. Also a side shot of the ethernet and phone line protection circuitry.

Look at all of those heavy duty connectors! And the heat sink with the high current transistors! That’s one big chunky relay for the battery pack (I think)!


Now that’s an inductor. This is definitely a quarter of the units weight, after the battery (probably half of the weight).

Warning! High voltage! Keep yer fingies out!

Right around here I noticed the lack of board gunk for all of the tall components, the big filter cap had nearly wiggled off!

Otherwise, damn this is a nice looking board.

The culprit to the problem. The battery is shot, and I’ll have to snag a replacement somewhere. Checked its voltage, 7 mV! Hah! It is a 12 V, 7.2 Ah lead battery by CSB.

Pretty! Look at those mystery components! And a 10 mOhm trace resistor? I wonder what that is for.

The one (ST Micro) chip I could not read, but I assume it is some sort of main microcontroller because:

Tadaa! A Cypress Semi USB controller for the data aquisition/control! Quite nifty!

Everything else on board was kind of boring, lots of passives and voltage control circuitry. Would it ever be a blast to design this piece of kit though!

Here are some more pictures.

How cool was that? Tearing stuff apart always leads to a good time, look forward to more of it from me in the future!

Questions? Comments? The section is below!


New Project Ideas!

Hello all!

I have some good news, and some bad news.

As Rush eludes too: Bad news first.

I unfortunately did not get the job I had applied for in the first round of job postings through the university. I am quite bummed about it, as I wanted a hardware related job in Waterloo for the fall term. I will see what I can do during continuous jobmining during the next month though.

The good news!

Hell week is over, and my midterms are trickling in. Fortunately, they are… acceptable. This means I have time to do projects again!

The next thing I would like to make is a basic CMOY amp, which will springboard me into making an Objective2 headphone amp for my new pair of AKG K240s. I am quite excited, as I love the signal conditioning aspects of audio amplifiers!

I have also (unrelated) began to self-teach myself German, as I have been having ideas of possibly doing an exchange in Germany. We shall see!



555 Timer Business Cards


So I thought up this cool little project during my last few weeks during my co-op term at Echologics Engineering. I saw everyone had nice, professional looking business cards, and I needed something to springboard myself into PCB design and manufacture. One and one came together, and this idea came about.

There were quite a few idea revisions in my mind before I actually got around to spinning the PCB. Microcontroller? Basic LED’s? No circuitry at all? Finally I got the idea of using a 555 timer (after seeing something about worldwide 555 timer competitions on the EEVBlog) that would be outputting a clock to LED’s, which would flash depending on some external interaction to the timer.

First idea: a photoresistor of course! The external RC circuit worked perfectly in ambient light with a simple 10k photoresistor. I quickly ran into an issue though; if I wanted to use a photoresistor, I would have to make my PCB through hole. I was not able to find one surface mount photoresistor. Therefore, I had to “fabricate” my own! How does one do that?!

Current in parallel with a normal resistor, of course! A phototransistor could act in place of the photoresistor, limiting the current in the RC circuit control for the 555 timer. Some issues with this, of course, is that phototransistors are quite expensive, and I managed to purchase opaque top photoresisors (which Digikey first sent as Red LED’s… D’OH)! After some trial and error with a scope and a breadboard, a working 555 timer, LED blinking, opto-frequency controlled circuit formed.

Then came the digitization! Here is the PCB layout and electrical schematic for my project. I was going to use SEEEDStudio’s Fusion PCB service to create my PCB’s, so I made sure I was using 14-14 spacing for traces. I also increased tolerances for pads and such, just to keep everything safe. Another folly I will learn from this project; don’t use diode type pads for surface mount protection diodes. These special diodes (that are very expensive mind you) are in the mail for tomorrow, and will be exceedingly difficult to solder on, when I could have easily used a much larger SOD package.

The idea behind the circuit is that you lay a 9 volt battery on the terminals, and the circuit then operates as expected (see video). The only issue is with the phototransistor, as it only operates very well in high intensity light (direct sunlight, or a “low” powered laser). It does vary frequency from 0-5 Hz with a bright light source.

The card features my personal info, as well as one of my favourite Tesla quotes on the backside.

And there it is! Just in time for interviews too, one of which I have tomorrow. I hope these turn some heads!

Here’s the card in action!



8 Bit Adder Update

I finally got around to putting the hardware together for my 8 bit adder project, as well as the Verilog for the FPGA.

Here is the working hardware setup:

Here are the three displays, one (Right) with the output, and two (Left, split half way) with the input.

Two 8 bit number inputs.

FPGA for logic.

Whole hardware setup.

Here is the Verilog that is running on the FPGA (Note, there are easier ways to implement this, I just wanted to do it “gatewise”):

//Cody Shaw, 1B EE, University of Waterloo, 2012
module EightBitAdder(

//////////// CLOCK //////////

//////////// GPIO_0, GPIO_0 connect to GPIO Default //////////

//////////// GPIO_1, GPIO_1 connect to GPIO Default //////////

//////////// CLOCK //////////
input CLOCK_50;

//////////// GPIO_0, GPIO_0 connect to GPIO Default //////////
inout [33:0] GPIO1;
input [1:0] GPIO1_IN;

//////////// GPIO_1, GPIO_1 connect to GPIO Default //////////
inout [33:0] GPIO2;
input [1:0] GPIO2_IN;

//GPIO1_024 = End Carry
//GPIO1_00 -> 07 = Output
//GPIO1_08 -> 15 = Input Number 1
//GPIO1_16 -> 23 = Input Number 2
wire CARRY[7:0];

onebitadder adder0 (GPIO1[08],GPIO1[16],0,GPIO1[0],CARRY[0]); //So many adds!
onebitadder adder1 (GPIO1[09],GPIO1[17],CARRY[0],GPIO1[1],CARRY[1]);
onebitadder adder2 (GPIO1[10],GPIO1[18],CARRY[1],GPIO1[2],CARRY[2]);
onebitadder adder3 (GPIO1[11],GPIO1[19],CARRY[2],GPIO1[3],CARRY[3]);
onebitadder adder4 (GPIO1[12],GPIO1[20],CARRY[3],GPIO1[4],CARRY[4]);
onebitadder adder5 (GPIO1[13],GPIO1[21],CARRY[4],GPIO1[5],CARRY[5]);
onebitadder adder6 (GPIO1[14],GPIO1[22],CARRY[5],GPIO1[6],CARRY[6]);
onebitadder adder7 (GPIO1[15],GPIO1[23],CARRY[6],GPIO1[7],CARRY[7]);

assign GPIO1[24] = CARRY[7]; //Assign the carry bit to the 9th output bit

module onebitadder (A, B, C, S, Co); //This module does the actual add functionality in terms of gates
input A;
input B;
input C;
output S;
output Co;

assign S = A^(B^C);
assign Co = (A&(B^C)) | (B&C);

And that is it! I really enjoyed this project, I’ll have to think something up that is more difficult and interesting with my FPGA!



8 Bit Adder + DE0 Nano Altera Development Board

I was planning on posting previous projects here first, but I am quite excited about this little project. I was asked to synthesize an 8 bit adder on my DE0-Nano Altera Cyclone 4 FPGA development board for the University of Waterloo ASIC team. It is to be used as a little “proof of concept” to newcomers, which will display the capabilities of FPGA’s as well as show off some working HDL code.

If you are not familiar with FPGA’s, or any of the acronyms brought up in this post, I would recommend checking Wikipedia for some basic knowledge in the area, just to get in the swing of things.

All I have done so far is throw together a basic schematic for a 1 bit adder with two input bits, a carry in and carry out bit, and a signal out bit.

First comes the truth table, then comes the logic, then comes the gates!

First comes the truth table, then comes the logic, then comes the gates!

I plan on simply chaining 8 of these together in HDL to provide an idea of how digital logic can be implemented on an  FPGA. I know it’s the scenic route (one can simply add the two binary bits together in the HDL and it will synthesize a adder, but that’s no fun)!

DE0-Nano FPGA Dev-Board, LED Display and inputs, and jumper wires.

I will post updates later on when I actually have more to show. I need to jump 25 leads from the devboard to the breadboard (I don’t feel like multiplexing), 16 for inputs and 9 for outputs. I hope to show this off at the UWASIC meeting next Tuesday, which should be tons of fun. I will hopefully have working HDL in Verilog and VHDL, for those who are interested in learning both (which is what the UWASIC team teaches).




Hello viewers!

This is my first post on my new website, which will be dedicated to my electronics projects. Look for new posts in the future, I have tons of ideas!


Cody Shaw