Wednesday, September 12, 2007

Prototyping down memory lane

It is also a story of what can go wrong went wrong.

Remember I needed some basic electronics for a useful purpose. So I went ahead to design and build a circuit. I want it to be battery or DC adapter operated, it's also a battery backup and charger. The backup and charger part turns out to be rather complicated, which explains my chargers are so bad. I can use lithium batteries and make use of a single chip to do all I wanted, but the chip is used for cell phones, surface mount with no leads, only tiny pads under the chip. No way I can deal with that by hand. So I give that up for the moment and the circuit is strictly Either battery OR DC adapter.

I actually never build much circuits. The kits on sale are rather tame. If they are any good they would design consumer products. Also, you just learn soldering if you build those. I did build something important once with a lot of chips with wrapping tools. With low power you need low noise, together with surface mount components, wire wrapping are way out of fashion. I hate using solderless prototyping boards. I don't need to test everything first. And it's too expensive to use the boards as the final product.

However, once upon a time copper becomes previous metal. So the prototyping boards with lots of copper strips disappeared. The best I can find is some rather expensive boards with just holes on it and a solder tag around it. (But somehow the PCBs plated with coppers are still around, but I have no patient for the slow turn around of making PCBs). I made the mistake of trying it assuming the lack of rails is no big deal.

Firstly, the real time clock and alarm I ripped off from a timer switch is too good, it worked on 1V instead of 3V on my circuit. I knew about it but I thought CMOS would work with wide voltages but not for that clock. So I added another battery to supply the clock and added a transistor to pull up the alarm signal up to 3V.

I chose components to minimize chip and connection count. But the choice of components off the shelf is limited. More importantly, I misread an unimportant part of my own circuit, the gates are to be repeated on all signals in the bus, but I allocated components and space just for one signal. So I have no chips or no space for all the signals. But I can live with that for a prototype.

Without ground and supply rails, the soldering is a nightmare. Every connection is by a wire, and I didn't have the magnet wires, insulated wires with coating that melts when soldered. So I have to strip every wire before soldering using a blunt, large soldering iron. When I brought the iron, I wanted one that is powerful enough to for thick electrical repairs, and also doubles for electronic work if I ever needed. So the tip always touch two chip leads when soldering. It's a nightmare. But I soldered on hoping to get out of hell as soon as possible.

At the end it was spaghettis over and under a plate in 3-D. It was hell. Worse, nothing works that surprised me. The IO drivers all don't work so I don't know what's going on. And I have only a hand held multimeter to trouble shoot. Funny that the main fault was laughable. I used CMOS design for the first time as my real circuit needed to be low powered. The basic quad NAND gates have different pin outs with the TTL versions!!! Just 1 in the 4 gates have different pin outs, but just enough to make everything not working. I vaguely remember that it was to differentiate that it is CMOS rather than TTL. But nowadays you will use the same pinouts, even if it cost you more to manufacturer. But now the CMOS pinout is history and you have to remain compatible.

And since the circuit was a hopeless mess of spaghettis, I had to find another fresh circuit board to start over. Luckily I found an ancient copper stripped board in my garage just enough to fit the chips that I have. It now looks better but still a lot of spaghettis, but less painful to build.

The circuit at least work as expected but a lot of strange happenings, like on and off of motors and LED's when not expected. The power on reset doesn't work as the microprocessor in the real time clock takes a few seconds to reset, while my own circuit resets for a much shorter time. Now it's a random start, but since I cut down the number of states due to insufficient space and chips, it's only head and tails.

The manual reset doesn't work either. I suppose the pull-up resistor is too large to save current. But I can always reset by touching the contact with a wire connected to ground or supply.

The unexpected on and off is due to a long alarm signal. I have a timer circuit to control the width of the pulse, and to isolated the alarm signal once activated. But I got it wrong assuming it's trivial. So I have to indulge into some Boolean math to arrive at an asynchronous finite state circuit with minimum gates, which have to be a modern classic. But I needed 3 NAND gates. So instead of blinking LED's to save current, some are not blinking to save some gates for the modern classic.

It's working now for weeks on two AA batteries. But very recently I found out that the sparks of a small motor nearby will cause the circuit to change state for certain. It's no big deal as I have to redesign the whole thing anyway.

No comments: