DIY Digital Clock: Take 2!

What time is it?

Time to make a new clock!

About a year ago, I designed and assembled my own custom made clock. You couldn’t say it was in an enclosure since its guts were spilled out on both sides of a piece of foam core. I felt like, a year later, it was time to redo it and put it into a proper enclosure.

So, what time is it? Time to build us a new clock!

The Guts

1

I tend to get carried away and too focused to take proper progress pictures. This is literally the first picture I have from the electronics part.

Soldering all of those LEDs and components took a full day. I used hot glue to try to keep multiple wires in place to solder as fast as I could but it didn’t do the best job to hold them in. At time, the glue would fall away from the PCB. Still, it’s better than fiddling with one wire at a time.

The only difference from the prototype build is a lower resistor value for the LED resistors.

Putting Together a Box

2

Foam core is a favorite in my “lab”. It’s all I use these days because all it takes is a knife to cut and it’s inexpensive and accessible (Dollarama rocks). I built a simple black box with a white cover place. I was hoping with a lower resistor value on the LEDs, they’d be able to shine through the white foam core.

3

With the soldered parts and the enclosure ready, it was time to put it all together.

4

I glued a piece of foam core behind the control board to isolate the connections on the back with the display connections. I ended up mounting the two display panels on it’s own piece of foam core anyway so I guess that wasn’t really necessary. The display foam core backing fits tight with no need for pin or glues to hold it in place.

5

The white foam core was still too think for the LEDs so I ended up going back to a plain white sheet of paper. It’s not noticeably brighter than the original prototype with the paper.  The piece of paper is held up by two strips of foam core on either side.

I didn’t like the look of it at this point but it was the end of the weekend so I left it for now.

6

I still like how sleek the black foam core looks, even with a few imperfections here and there from a not-so-sharp knife.

7

After a few days to think about it, I realized simply turning around my diffusing screen pulled the look together.

8

Time to pull the plug on the prototype and enjoy something new.

Thanks for reading!

Advertisements

DIY Clock Project – It’s finally alive!

After months of putting this project off, I finally focused for a weekend and put together a first prototype of my DIY real-time clock. To bring you back up to speed, the clock circuit is on a custom designed PCB which will control another set of custom PCBs that form four large 7-segment digits. It uses an Atmega328p microcontroller, a DS3231 RTC IC to keep the time, and some 74HC595 shift registers to control my custom 7-segment display PCBs.

20160325_200849

The boards were soldered without any issue. I’m quite pleased with the look of both of the boards, so much that I wanted the control board to be in plain view in this build.

20160326_141933

Once I got the boards ready, it was time to program. My first test would be to try upload something the microcontroller and to test out the display. It worked as well as I could have hoped.

One thing that I could have done better with the control board was to use an FTDI header instead of the USBtinyISP since you can’t print anything to the serial port to debug. Thankfully, I didn’t need that anyway.

20160326_165807

After setting the time on the DS3231 IC using example from the Sodaq_DS3231 library, I wrote some code to the form all possible digits for each 7-segment digit. Then, with some more code, I was able to print out the hour and minute on the display.

20160403_151213

I thought about putting it into a good enclosure but I’m considering rebuilding this project a second time with a cleaner look.

20160403_151244

I’m not so crazy about using the female-to-female jumper wires in the final build but it does kind of look neat.

20160403_192246

The display is very nice to look at in all lighting conditions. The not-so-bright LEDs and the simple blank white paper diffuser results in a display that is easy on the eyes.

Overall, I’m glad with how the project turned out. Unlike many of my other projects, this is one that I actually use on a daily basis.

Thanks for reading!

Clock Project Journal Entry #2: Get on with it

In the first journal entry for my clock project, I introduced the purpose and general idea of the project. It’s simple, but it’s been dragging on for weeks. The schematics and PCB designs have been tweaked many times since the first draft. I’ve been hesitant to call them complete because of my unfamiliarity with the DS3231 real-time clock, and because it’s my first time making my own component parts in Eagle. After some focused work today, I’ve sent the boards off to be made.

There are a couple of aesthetic aspects to these PCBs that are new for me: Larger size and different color. Both the control board and display board are larger than the 5x5cm (or less) size that I was always aiming for before. The larger boards give me a lot more room to play with when I’m routing the connections. It also lets me breathe a little easier knowing that the text sizes should be large enough to read… I’ve have cases where I made text too small just because I didn’t have space for anything larger. The boards will have black soldermask because I think it will make the LEDs stand out more and will hide the control board a little better. I’ve always gone with blue before.

11979_top

As I mentioned earlier, this will be my first PCB with custom made parts designed in Eagle. The two parts that I made were for the power switch and the DS3231SN IC. The power switch is a tiny slide switch that I ordered a bunch of a while back. They’ve always been hard to use because of their somewhat odd form factor. The pins are tiny, it has two thick outer support pins, and has a 2mm pitch so it isn’t breadboard-able. I ordered digital calipers just to measure the switch’s pin thickness. Hopefully I got it right. If it turns out to be fine, I’ll probably make another PCB order for some breakouts for these switches.

The DS3231SN’s datasheet links to another document for its land pattern, which shows the spacing and sizes of the pads. The land pattern is clear so I’m confident that I made the part right in Eagle. Time will tell!
11980_top

Since Eagle limits board sizes and the price for anything larger than 10x10cm would probably be too expensive anyway, I could only fit two digits on a board for the clock’s display. Each segment is made up of two parallel branches with a resistor and two LEDs in series. The resistor I plan to use are 1K 0805 surface-mount resistors. I tested them out in this configuration on a breadboard, thanks to my own 0805 breakouts. I chose the relatively high value of 1K because the brightness seemed to be just right, although it could still feel too bright when the entire display is put together. Time will tell on that as well.

I’m still trying to decide how I will put the two panels together. I want to have the colon in the middle of them, whether it’s made of LEDs or not doesn’t matter to me. I also don’t have much of a plan for an AM/PM indicator so the project may start off as a 24-hour formatted clock and be changed to a 12-hour clock in the future.

As you can tell, I’m still trying to get things sorted out even after the project milestone of getting the boards made being surpassed. I ordered the components for this project a couple of weeks ago from China so I hope they arrive soon. There are also a few components I’ll purchase locally when the other things start to come in.

Thanks for reading!

The Box project, completed!

With the Box project, or temperature/humidity monitor (part 2, I guess), sitting on a breadboard for some time, I dedicated all of today of transferring it all into the final box. I’m very happy with it despite how simple it seems. I also have a new build material.

IMG_0942I started soldering things on using a plan I drew up. This is the first time I’ve actually planned out a PCB and it worked extremely well. I don’t have to think as much as I go along.
IMG_0943Base Atmega stuff in and some resistors for the LEDs and buttons… Because it was so organized this time, it seemed a lot neater.
IMG_0945Organization was really key to the success of this project. It’s probably bad, but I was kind of surprised. There were many connections that could go wrong, and one did but I caught it and it was smooth sailing on from there.

IMG_0946I love using hot glue now and I expect to use it a lot more. Most of this project is made up of thin jumper wires so I didn’t like the connection to the perfboard on its own. The hot glue added a better base.
IMG_0947It also helped a lot with soldering. I glued them into place before soldering so I didn’t have to position my helping hands to hold the wire as I solder.
IMG_0948The first test was just powering on the LCD. I was super happy! I slowly got the other parts online and it turned out to be all good.
IMG_0950The last part was getting it all into the box. I was getting worried it would end up like my Frank robot which was basically the same thing on wheels. In that project, I couldn’t get a lid on so there were just all of these wires flying out of the top. I was actually laughing trying to find a place for the RTC. I found humor in trying to shove it in for some reason. Maybe I was just really happy too.
IMG_0953That’s it! It’s powered with a backup battery I bought for my phone, but it also works with my USB wall warts and PC USB ports.

The following video shows what control I have over it now that everything’s enclosed. Enjoy!

The Box: Prototyping

So “The Box” project is back, taking on a less ambitious form this time. I’m not going to try and cram every part I have into a box. It’s just going to be a simple temperature and humidity monitor with a clock and some LEDs. It’s nothing fancy, but I’m hoping I end up with a polished final product.IMG_0826I’ve begun prototyping all of the elements of the project together and I think I have a solid base right now. Let me walk through how the prototype currently works.

IMG_0831The system greets you when it’s first powered on. There is actually a reason for this which will be explained shortly.
IMG_0832This is the main screen. The clock can be toggled between 12 and 24 hour formats. The bottom line alternates between the temperature and humidity readings every three seconds.IMG_0835There’s the button to toggle the clock. The system is powered by a 9v power adapter into a 5v regulator. The brains is an Atmega328p microcontroller.IMG_0834Those two perfboards have the temperature/humidity sensor and the real time clock. Oh look, some LEDs!

The LEDs go back and forth signalling a complete second. It’s done using delays which provides a break for the LCD and sensor updating. While the LEDs are going back and forth, it isn’t actually using the RTC. It’s simply delayed so that a cycle back and forth takes a second.  This takes us to the reasoning for the power on screen with the “Hi”. What’s actually going on is there’s a delay so that you can always read the “Hi”, then it waits for the next second change by the RTC. This process syncs the start of the program with the start of a clock second. That way, every time the program loops back to the beginning, it starts at the top of a second since each loop of the program takes a second to complete.

Check out this video to see the prototype in action:

Animatronic Head project, now “The Box”

In my five project Project Lineup, I had an animatronic head project listed there. I want to move away from the usual roaming robots because I get tired with them too quickly. In the past, I’ve seen people make cool robot faces with LED matrix eyes and servos that moved it around to follow and interact with you. I wanted to try something like that.

The Shelf Lighting System project sort of drained me as I’m finding it hard to be creative. I ended up with this after 15 minutes:This is a crappy version of what I had in mind but still somewhat close, which made me even more unmotivated just looking at it. That’s why I made the change to “The Box”.

The main purpose of this project is to put to use all of the parts I currently have. The picture above shows them all: 2×16 blue LCD, RGB LED, 8-ohm speaker, photoresistor, sound sensor, temperature/humidity sensor, and a Real Time Clock. The animatronic head was going to have these parts anyway, but taking away the servos and unique form factor, compared to a box, will make things easier for me.

The kicker for this project is that it will have an accompanying Visual Basic Windows program, although it won’t be necessary to use it all the time. I’ll have info on that when I get around to starting it.

A quick note about the temperature/humidity sensor… I just found out that the prototyping PCB I used actually has a second layer that connects pads on the board. It’s hidden under the silkscreen so I didn’t know until now. It looks like there’s a shorted connection so I’m going to try and salvage the sensor and put it back on a board like the one used for the RTC.

I’ll begin testing each thing and then start combining it all together.

Light Timer Project: Beta testing

Yup, I’m calling it in beta now. After the work done today, I don’t have any other plans or expect any changes to be made. Testing will continue through the weekend, which should be enough time to confirm everything works completely.

1The biggest change was simplifying the logic for the alarms. Each hour and minute has it’s own variable and I originally was checking what hour it was, then look at the minutes, and react appropriately. It became complicated very quickly so I tried something else. Basically, the logic works with the total minutes of every time (the hour multiplied by 60, plus the minutes), instead of the hour and minute values separately. It made the logic a lot simpler to figure out. The code will be released once I’m satisfied it works fine so you’ll see what I did.

2Another change I made was the LCD brightness is now controlled by the code instead of the hardware potentiometer. I had to move the LCD digital inputs somewhere else to free up a PWM pin. Although I said I’m not planning on any other changes, I am willing to move around the button input pins to free up two more PWM pins if I come up with something else that would need it. Anyway, on the default screen with the time and date, the LCD dims five seconds after you press any button or return from the menu. In the menu, it stays on full brightness.

The last change I made was the menu now times out after 10 seconds after the last button press and returns to the default screen. As I mentioned in a previous post, the alarm processing is done when it’s on the default screen so it’s important that it’s not left idling in the menu. I still have to make sure it works on all of the menus but so far it’s been fine.

Now that the guts are nearing completion, I’m trying to figure out how I’m going to package it. I don’t want to use cardboard because I want it to look more presentable this time. The last resort is cardboard covered in coloured construction paper, but I’d really like to find another way.