Tuesday, 23 August 2011

I learned a new way of wiring; way of the wiring pen

Making circuits with perforated board is simple, but it may also be really slow. All my connections so far were done with PCB insulated and uninsulated tinned wires. I got quite fed up with that process and searched for faster ways of working. Dear Google gave some better ways to carry current from place A to B. Please look this excellent tutorial by R.Clarke, one article at Instructables and the thing draw into extreme, really into a art by sir Elm Chan.
After web learning session I had purchased some 0.25mm and 0.1mm enamelled wires. The thicker of wires seemed to have too good insulation for its spec sheet (220C melting point, my ass), as I was unable to solder it even with burning, too hot 450C iron. The thinner wire instead could be soldered by a measly 430C and 3-10 seconds of time. After some sweat, trial, retries and burned fingers I found a suitable work flow;
  1. Press the other end of wire by finger against the pcb
  2. Use the wiring pen (or a just tip of a mechanical pencil, where the thin and soft wire is easy to insert) to make 5-10, tight turns around the leg of component. The turns need to be tight enough, so the wire will not get loose before soldering
  3. Draw wire to the destination. It is easier to work, if there are some extra length in wire, so one can lift and move them even after soldering.
  4. Again, press the wire with a finger against pcb while making 5-10 rounds around the destination component leg.
  5. It is ok to leave +1cm of wire before cutting it by pliers. If one tries to cut it too close the wire, the wire may get loose and re-inserting it with tweezers takes quite some time. If the wire gets loose, it may be easier and faster to just replace it with a new one. Of course, if there are multiple, unsoldered wires on multiple layers, the replacement may be tricky too.
  6. Goto 1 until some amount of wires are drawn. At the beginning, it may be easier to draw and solder wire by wire, but after some experience they can be done in batches.
  7. It is solder time. Adjust the iron to the proper wire insulation melting point. On my wire and soldering station the best temperature is 430C. The melting insulation is said to produce toxic (!!!) fumes, so some kind of extra fan is good to have.
  8. Put the tip of iron against the wire and component leg, insert solder to improve heat transmission and let the insulation burn. It is funny to see, that while the insulation vaporises, the solder blob bubbles and eventually it just sucks itself into the solder pad. After some trial and error one learns the technique.
  9. The melting insulation seems to be quite hostile against the solder iron tip, so one needs to clean the tip in sponge after each joint or few. The tip may also require re-tinning quite often too.
  10. After soldering, cut off the excess wires by a sharp knife, I used a simple Stanley blade knife. The connections need to be tested, as the hot solder or flux (?) may make some unwanted connections to fellow neighbour pads.
After learning to use, the enamelled wire is extremely handy while working with the perforated board. One does not need to peel the insulation off, no need to measure the wire length before wiring or cutting and due to it being insulated, they can be drawn on top of each other. All this means that it takes a fraction of time to make a prototype than before, when using a typical un-stranded PCB insulated wire. Of course, there are drawbacks; the wire I used is a bit thin, one may need a magnifying glass to verify or trace the contacts. The energy carrying capacity is also low, so it is better to use it only for logic level connections, not for grounding or power supply lines. Also on higher frequencies this layout may not be a option, but who needs over few megahertz anyway?-)

One wired and soldered board. Note the thin as hair wires, ignore the fixes and awful blobs;)

Example of the work in progress, some wires drawn but not yet soldered.
The reel of wire and its holder, also the "tool" used as a ad-hoc substitute of a wiring pen.

Experiments with PS2 controller, HD44780 and nRF24L01+

Once in a while my robot project gets into surface. This time I decided to get back into bottom(s) up design, and build a remote to it. I took the parts which were already in my drawers;
  • Atmel Atmega8 for CPU
  • HD44780-compatible LCD, 8x2 chars of GUI
  • PlayStation 2's Dualshock controller as input device
  • Connector from PS2 extension cable for interfacing the controller and board
  • nRF24L01+ module to transfer the command and conquer data wirelessly
The idea in nutshell is to be able to read the PS2 controller by Atmega8, display the control data by LCD and transfer it to the mr Robot by nRF24L01+. After drawing the draft of schematics, I tried a new wiring technique for me; making connections with a thin enamelled copper wire by a pencil, and soldering it directly through the insulation. More of that on next post.
I rewrote my HD44780 driver code using a original Hitachi data sheet and after debugging and rewiring the mixed D6 and D7 lines it had a visible output. The PSX controller code was also a nice learning experience in firmware and hardware debugging, but it finally worked very well. Luckily the protocol and interface are well documented, so I could blame for troubles only myself. Perhaps next time I will first double check the port assignments, as it is much better to use PINC port for reading pins in port C, instead of PIND, which was used in my original code:-)
The nRF24L01+ driver part is still in progress and actually completely untested, which can be witnessed from the board too, as there is no <3.3V power supply even wired for it. The power source needs some re-evaluation as a whole. I planned to use a 9V battery and a simple pair of L7805 and 78L33 for 5 and 3.3V rails. But this might also be a nice test bench for BL8530 step up converters I have waiting for a inspirational SMD SOT-89 soldering session. Well, currently the whole system is powered by the USBASP-compatible programmer.

Underside, logic level connections done mostly by the 0.1mm enamelled copper wire. The connections may look a bit scary, but they work.

Sunday, 21 August 2011

LED matrix clock

Clock in action.
For some time I have been planning on making a digital clock. The main reason for building one is of course just a hobby; building one nowadays just does not pay back money wise. What I wanted was a fully programmable LED matrix, not just dull 7 segment modules. After some eBay searching, I found cheap 8x8 modules and ordered them. After that was the time for final design.
One interesting dilemma was that how to light 128 LEDs with a CPU, that has only 16 GPIO pins. The problem is somewhat reduced by the matrix modules themselves, which provide only 16 pins: 8 anode and 8 cathodes. The modules can even share the cathode pins, so one only needs 16+8 pins, which may be driven by couple of 74595 shift registers and 8 AVR IO pins. The '595 drive the LED anodes and the AVR IO port sinks the cathodes via current limiting resistor.
In this design, the '595 are driven perhaps too close to their limits, but in practice they work fine for this first version. I did order some real LED driver chips (MAX7219) for some other project, perhaps I'll try to use them in the next revision of the clock.
The mechanical building was a bit harder than I thought, as the LED matrixes had a slightly incompatible spacing as the normal perforated 0.1" board I use and the sheer amount of pins (2*16+24=56) which each needed a short wire on the daughter board.
After the CPU board was ready, it was time to do the easy part, i.e. the software. The code is structured as a state machine, which is ran from a timer interrupt 12500 times a second. On each step the code shuts down one, and lights one led, from left to right. After one row is shown, the next anode line is grounded and others set to high-z state. The rest of the time the CPU sleeps in the idle mode to save some power.
The time keeping itself is the easiest part, as it is handled mostly by a DS1302 chip. The chips is easy to use via three wire serial interface, and it even has its own circuit to handle the backup power source. For backup, I chose a super capacitor, but have not yet actually written code for charging it. The cap is rated for 5.5V, which should drive the clock chip for quite a many days, but perhaps I'll try to play safe and make the DS1302 to drive only 3.3...4 volts into it.
Anyway, the clock works now and is waiting for a enclosure and place to keep it.

Here are the basic components:
  • CPU: Atmel Attiny26L-8PU (Obsolete part, but nice to use as the port pins are close to eahc other)
  • RTC: DS1302
  • Output: 2*LED matrix (8x8)
  • IO multiplexing: 2*74HC595
  • 1.0F (!!) super capacitor
  • resistors, capacitors and switches, 32768Hz crystal

Schematics drawn with Eagle. The pin headers SV1, SV2 and SV3 connect to the daughter board and ISP to the programmer. R9-10 are there to protect CPU from ESD, just in case.
Undersides of both boards.

Top side, which shows also the huge capacitor. The cap seemed slightly smaller on the ad, so it did not fit well into board;)