Monday, December 6, 2010

Binary picture-frame clock

Hi altogether!
After seeing quite a few clock projects on, I decided to make my own.
And here it is: The binary picture-frame clock!

Now, how did it build it?
The first thing was to make an idea and a prototype.
I used an ATMEGA-8 as main part and layed out the rest around it.
I needed six LEDs for the minutes and the seconds (2^7 = 64 so just one factor under it to get up to 60)
and five LEDs for the hours.
Coming together with buttons, a light sensor for night dimming and the clock crystal,
filled nearly all the pins of the microcontroller.
Here is the schematic:

I did this in KiCad, its free and quite good.
Laying out a one sided PCB saved me a of of cost, and left the possibility to make it quite flat to fit in the frame. The frame is a cheap IKEA picture frame for like ten euro.

One of the advantages of KiCad is it provides a rendered 3D-image of a circuit board. Here it is:
Now, I ordered the PCB and the parts. Two long weeks of waiting followed, then the assembly part started!
Here is the PCB after soldering some resistors in:
The resistors, LEDs, caps and the crystal were pretty easy to solder. Use a good, branded soldering iron and 0.5 mm solder wire. For hobby use, lead is fully acceptable because it flows to the pads on its own.
The TQFP microcontroller was really hard to solder.
In my first atttempt, I didn't get the contacts on MOSI and SCK right,
but after microwaving the board for three seconds (no joke!), everything worked well!

Now the mechanical treatment of the of the picture frame followed.
I drilled holes and expanded them until the small switches fitted in.

After also drilling holes for the power supply,
I fitted the board into the frame. The three buttons for time setting flew just around.
With a lot of hot glue (a sacrifice for the science ;-) all was in place and ready!
The power supply is a 2W capacitor power supply with a european plug.
Now coding started. For AVRs, I recommend the AVR studio with the GCC plugin!
I use the 16-bit timer 1 to generate a secondary pulse out of the core frequency of 32.768 kHz.
The clock counters aren't any special, three registers for hours, minutes and seconds.
I used the ADC, and this is kind of special because it is claimed in the datasheet that the ADC just works in frequencies higher than 50 kHz. Due to the reason I only use the MSB for checking the brightness, it works really well!
I do software PWM to get one tenth of the brightness of the LEDs in dark surroundings.
The last part was to put all in place and then it was ready.
 Here are some pictures:
It is pretty hard to get it on camera. Either you get the bright flash or the LEDs disturbing the image.
The best image was captured when I got my fingers in front of the flash:
I hope you like it!
Here are the links:

Look in again!

Sunday, November 21, 2010

How to get schematics out of circuits

After my last blog, the hacked amp, I was asked by quite a few people how I got the schematics.
In this blog, I'll try to give a deeper look on reverse engineering circuit boards.

So if you have a old crappy electronic device and you take out the PCBs, what is first?
You look for the datasheeets for all the chips on there.
I didn't knew I was holding an amp in my hand when I was looking at the board.
I thought it was kind of an digital to analog converter with low output power.
But I googled for the datasheets and found the MS6038 datasheet.
After I found it was a small amplifier, I thought, hey this would be rather useful in my workshop.
By accident, there were no piezos on the mainboards but normal 8 ohm speakers.
 So I pulled out the the pin assignment table from the datasheet
Pin configuration out of the datasheet
Like you can see, it ain't very different to the pin assignment of a dual operational amplifier.
Now, you could look at the application unit in the datasheet, but it isn't necessary the same as on your PCB.
And what I did, was that I took a photo of the board and used a image manipulator like GIMP or Paint.NET
to assign pin names.

Pin configuration in the circuit

When I was done, I added names and descriptions for the rest of the PCB.

I found the places where I soldered the VCC and GND(Vss) cables by following the tracks, scraping off the solder-mask at a position where I had enough space to solder it and checking it with my multimeter in continuity test mode. The old socket for the headphone plug had three solder points. I metered them all to get the ground point.

I knew there were electrolytic capacitors in the signal way so I couldn't test it.
But if you have a two-channel amplifier, it is pretty sure you will have a two-channel output.

Now I looked on the trimmer circuitry. It has only two outgoing wires and they even had tinned test points on them. A little step under the yellow text you can see my first trial to get contact to the tracks, but I had problems with shorting them out to ground.

The last step was soldering cables to all the points I figured out and testing it.
I used a square wave generator built of three parts: a 555-timer, an one-kiloohm-resistor and a 100nF capacitor. It generates a signal around 700Hz and allowed me to test the amps functionality with my oscilliscope.
You needn't do that, I just wanted to see the level of volume raising.
The output volume is about 140 percent of the input.

Then I wondered why I didn't destroy the amp due to my eight-ohm-speakers
while my amp was designed for 32 ohms.
As I metered the resistance of the output, I found it being at  24 ohms. 8 + 24 = 32, so everything was okay!

So now you know my procedure of refactoring a PCB.
Whats next?
Try it out yourself.

And I have something coming up built with the cd-tray.


Thursday, November 18, 2010

How to get a really cheap stereo amplifier

I've been looking for a really cheap amplifier for my workshop,
so I can hear music over my MP3-player whilst building stuff.
I got my hands on some old computers and tried to use only them as part source,
and here it is: The zero-cost amplifier!

It is build of a CD-drive with headphone output.
The first thing I had to do was searching the amplifier circuit on the front panel board.

The front panel board without the end position switch
It was very clear to me that the amplifier is where the potentiometer sits.
It's on the left half.

The next thing was finding the chips datasheet.
The amplifier circuit with the MS6038
The MS6038 datasheet says its a Class AB Headphone amplifier.
It looks like an opamp and it's also that easy to use.
Now I cut it from the rest of the front panel board and desoldered the 3.5 mm terminal.
After this I pulled wires from the circuit to this terminal and to two external speakers I got from old PCs.
I used a mobile phone charger with 230V input and 5V output as voltage source,
but you can also use any other kind of power supply from 2.7 to 5.5 volts.
Finally, I built a small free air circuit to make use of the busy LED.
It contains of a capacitor with 3.3µF and some resistors to make it glim when the amp is in "standby" and light when music plays. 
I got all this parts out of my toolbox, so they were "free" to.

I found out that this kind of circuit is very likely to be in all kind of cd players.
Here is a photo of an portable CD-player.
Alternative circuit out of a portable CD-player  


If you once need such an amplifier, you know how you get one for zero cost! 
If I have updates, I'll post them in this blog, so keep looking.

Tuesday, November 16, 2010

How to rescue AVRs with wrong fuse bits

It can really be hard to rescue AVRs with wrong fuse settings without a HV-programmer.
But there are a few ways to do it.
In todays blog, I'll show a few of them to you.

The first thing to try out is providing an external clock at the XTAL1-pin.
The clock frequency has to be higher than one kilohertz and lower than something about 16 Megahertz.
This is a rather big frequency spectrum, so there are many possibilities getting such.
Anything from the simply NE555 oscillator with only two external parts over the calibration clock of a oscilloscope to a crystal oscillator will do the job.
Try to implement a pin-like place to apply it on your board if you design a PCB.
It helps.

Still not running?
So try out the second option: Get out your old parallel programmer and connect VCC, GND, RESET, MISO, MOSI, SCK and XTAL1.
The programmer will deliver a clock perfect optimized on the programming speed.
Try also slow-ISP or slightly higher voltages.

If nothing has worked yet, solder wires to all pins and build up a high-voltage programmer (if you don't already have one) like the AVRdoper (

Hope your controller works now!

Monday, November 15, 2010

Starting with electronics

Starting with electronics

Even having minor knowledge in electronics is really cool.
You can fix way more things than before and if your car won't start,
you can even figure out why.
You can build your own gadgets and this is really nerdy.

So how to start?

The first thing you have to have is interest.
Without real interest, you can't learn well.
But I think, if you read this tutorial, you have interest.

The second thing is knowledge.
Where do you get knowledge?
Right here on blogspot:

Or on another good site:

If this is not enough, ask Wikipedia or ask questions in forums like or .

Then, get on to ask people.
Read what other people built and try to copy it if you like it.
Read the hackaday feed (look at the right side of my site).
Listen to blogs like or The Amp Hour

Then the third thing.
It's parts.
So where do you get parts from?
 You get them from old stuff and component suppliers like digikey, mouser or element 14 or any others. I haven't been payed by them telling you this, these were the first that came into my mind.
Since most of the electronic garbage still contains usable parts,
it's an ingenious source for cheap parts.
What do you need else?
 Well, you need a power supply and batteries aren't very good because they
will get empty and their voltage will drop down while discharging them.
 So use a net bound power supply, please!
If you are careful and attentive, nothing bad will happen.
So keep your eyes open and look you use a power supply that will give you
 around 6 volts and approximate 500 milliamps.
 Then, get some resistors, small lamps (like 3 Volts, 100 milliamps in most bikes),
switches and a breadboard.
A breadboard is a thing where you can plug your components in and you doesn't have to
solder them.
If you go further, you will need some transistors, capacitors, integrated circuits, and so on.
 In case you want to use micro-controllers, check out the arduino.
 This is a small board with an ATMEL micro-controller on it and a USB-Port to program it with a computer.
You needn't use this one, there are enough other sets like the picaxe or the TI launchpad,
but I think the ATMEL micros are the best for beginners due to them being simple and powerful.
There is no need to use Assembler for them because there is C.
Many people argument that C is not on the hardware layer, but since you can acces single
registers, C is the language of choice. It is almost easy to learn if you can program in
other languages like Java or Visual Basic.

So, simply try out and tell me if I forgot to mention something.
Get on hacking!

Saturday, November 13, 2010

What is a nerd?

I've been asked by many people on what is a nerd.
So, I'll try to give an answer:

A nerd is someone who is specially interested in a science, 
mostly informatics or electronics.
He doesn't accept a fact, he wants to prove it.
Many people think nerds a kinda uncivilized, but this isn't true.
In fact our whole culture is based on people who devote their life solving the questions, they are surrounded with.
Not every scientist is nerd, and not every nerd is a scientist,
but they both have some things in common.

You don't have to call yourself a nerd.
If you want to know how things work around you,
your what I would call nerdy.

So keep your eyes open.


Friday, November 12, 2010

Why am I doing this?

Welcome to the apexys blog "Thoughts of a nerd".
So why do I bother getting other people read what I write?
Maybe, it's because I want to share my ideas with them.
Another point could be I want to give them a deeper view on
what is a nerd and what I think.
I'm pretty sure there will be some good tutorials coming out,
especially electronic tutorials.
I want to help people get nerdy by theaching them the basis of electronics and informatics.
Did you follow me until here?