The Project Pages


Preface

This is a list of some of the projects up my sleeve. They are mostly electronic in nature but will be fleshed out with new stuff as I get the time and get involved with a project again. A lot of them stand idle and wait for inspiration or time.

If you want more information on any of the projects send me mail.


Jump Vectors


Ongoing Projects

Serial Port Voice Sampler

This unit uses a PIC16C71 to sample voice data and feed it in the serial port of a PC at 115200 bits per second. This allows for the generation of 11 kSamples of 8 bits for use in a cheap Internet Voice platform that will then use the horrible PC speaker sound driver to talk to you. Strictly fast computer and half duplex batch mode.

I still need to put in an amplifier or VOGAD to allow for a direct connection of a microphone. The unit is serial port powered and fits inside a D25 connector shell. I also meant to allow changing the sample rate to 8 kSamples and possibly putting in a simple R-2R resistor DAC to play out to a crystal earphone from the same unit to avoid the horrible PC speaker driver software. Very early silicon for the 16C71 has some interrupt problems, beware.


Budget Frame Grabber

The plane here is to make a PC card that could be made for US$50 and would grab any type of monochrome video. One could then add CU-SeeMe capabilities to the Internet phone thing. Just waiting for some chips to arrive before I proceed further. This would give at least 320 x 240 x 6 pixel resolution which is ideal for remote surveillance and Internet Video.

CHEAP Infra Red Remote Receiver and Transmitter

This is more of a quick hack project but I have not got round to finishing the software for the devices so it here under ongoing. The transmitter uses just one resistor and 1 (or more) IR diode connected to a serial port. The receiver uses just one small cap and a SHARP IS1U60 modulated IR receiver (a tiny transistor sized moulded plastic (epoxy) device) connected to the GAME port of a PC. The IR receivers are available from RS Components, UK, not the same as Radio Shack, US.

The set-up will allow for any kind of protocol but I intend to make it talk 4800 BPS to interface with another project I'm working on. This is a perfectly OK protocol as there are enough transitions and the one bit pulses are not too narrow.

I would also like to record my box full of IR remotes just for interest and make it replay them from a console that has the picture of the original remote (grabbed with the Budget frame grabber) with buttons. Windoze will most likely not manage the speed.

There is other stuff available from the HP48 IR pages and the data by Anssi Ylätalo in Finland.


Budget IR communications system

This is a slightly improved spec device to the CHEAP unit and will transmit and receive in Windoze at 4800 but will not be suited to control of appliances. It will connect to the serial port only and use the TX and RX pins to work the data through the UART.

This is intended for my in room control project to monitor computers and modems without wires to avoid lightning problems. The prevalence of lightning induced damage here on the Gauteng highveld is the second highest in the world. Some cute middle US state gets the first prize.


Total Isolation computer-Modem Protection system

Paradyne or Intel made a Fibre connected modem a while ago, I wonder if they still do. I had a similar idea years ago but balked at all the TELKOM regulations here with attached devices. I have instead considered making a fibre isolated modem interface that will fully protect the computer and the modem interface due to a lack of conduction path through the connecting cable. This won't protect the modem from its power-supply but this may be replaced with a better isolated transformer to withstand much larger spikes.

Mature Projects

CCIR Pocket Pattern Generator

This is a classic PIC project. I found out later that there had been two other Video generator projects that used some other subtle timing methods.

Uses a PIC 16C54-04 but could be made to have an arbitrary graphical picture such as a company logo if use was made of a 16C58-HS. The available resolution would be about 9 x 16 with a pretty border.

Mine is a simple checker board full interlaced square aspect pattern. Ideal for those setting up closed circuit video systems. Currently only available in 625 line, 50Hz.


High speed Fibre optic Multiplexor

This is a PIC design that makes the poor chip really work hard. It uses just 2 PICs and 4 RS-232 transmitter IC's to achieve a 8 channel plus hardware handshake with data at 19k2 over fibre with a link speed of 1Mb/s. The sampling rate is kept as a multiple of 19200 to eliminate almost all of the jitter on the reconstructed signal. This is baud rate insensitive from 19k2 to DC on the data circuit and 2k4 to DC on the handshake circuit. The two PICs are 16C55-HS parts running at 20MHz.

Quick Projects

2 Line LCD tester

Hitachi Driver 2 line LCD parallel port test set-up. This makes use of the good old PC printer port (or any other 8 bit interface) in output only mode.

I have used this in 8 bit mode as well as the less wires 4 bit mode. The set-up can be made with very few parts. Requiring only a display, a 5 volt supply and a single pot.

My connections for the 4 bit version were as follows.

LPT-Bit    LPT-Pin     LCD-Pin    LCD-Bit

              GND        7           D0
              GND        8           D1
              GND        9           D2
              GND        10          D3
D0            2          11          D4
D1            3          12          D5
D2            4          13          D6
D3            5          14          D7
D4            6          4           RS  (0=control, 1=data)
D5            7          5           RW  (0=write, 1=read)       _
D6            8          6           E   (positive latch pulse _| v_ )
D7            9         
              +5V        2           VDD
GND           18         1           GND
              ~0.7V      3           Vo
The LCD pin numbering feels strange but the documents and displays I have seem to all work as follows, I have not connected up any of the single in-line type displays yet. The dual in line 14 way connections are (when looking at the display area with the contacts at left) pin one bottom right and pin 2 bottom left.

   +---------------------------------------------+
   |  14 13    +------------------------------+  |
   |  12 11    |                              |  |
   |  10 9     |     LINE 1                   |  |
   |   8 7     |                              |  |
   |   6 5     |     LINE 2                   |  |
   |   4 3     |                              |  |
   |   2 1     +------------------------------+  | 
   +---------------------------------------------+
The PASCAL test program was a quick 5 minute hack but worked fine. The control words are sent in 2 nibbles as I was too lazy to write a procedure that would send them out automatically to the control port. The 'Bite' procedure sets the 'data' bit for each nibble.

The RW bit is not required as the printer port will not read in on a regular PC but would work on a microcontroller.

The display has to be initialised in 8 bit mode and then only placed into the 4 bit mode. Sending the 8 bit mode command 3 times will always reset the display irrespective of what mode or nibble state it was in previously. Follow this by the various cursor and display enable commands. If the display is not correctly enabled you should see all the pixels of line 1 the same OFF grey, once you initialise the display for 2 line mode the pixels will become less distinct and the second line will appear, if you enabled a cursor this will also become visible. You loose some contrast when using the 2 line mode.

The contrast voltage is meaningful around 0-1 volt on most displays, grounding it will usually give a display of some sort. Some displays require a negative contrast voltage, notably extended temperature range and 4 line displays (16 contacts) of around -2.8V.

Don't forget to put delay loops between the writes to the display. Especially any clear 0x01 or home commands 0x02. A max. delay of 1.64 ms is required for these and 40 us for all other writes and reads (except the test busy bit which requires only 1 us). You cannot reliably use the busy polling system for the initialisation/mode commands unless you reliably reset the display into 8 bit mode as the phasing of the nibbles may be unknown if the display is still in 4 bit mode even though your controller has reset and assumes the display also to have reset.

Here is some more LCD information by Matthew Rowe.


Classic PIC 16C84 Programmer

This is an implementation of the classic Serial port C84 programmer. It should take about 4 hours to do the complete construction and get your first PIC programmed. You will need a junk box with connectors, sockets, regulators and other bits. The software is available officially from the Silicon Studio site or you can get the version I used from here (129kb) as a self extracting ZIP file containing the PIP-02 programmer software the RS-232 PinAPI driver and the original GIF file of the circuit diagram and a few other bits. I could not get reliable operation from the circuit as supplied and rather than try and fine tune anything I supplied a PP3 9V battery connector to supply power to the VCC regulator and only made use of the RS-232 pin for the control of the MCLR pin. This worked well and adds little to the complexity. The algorithm for programming is not compromised even though the VCC is permanently on.

Phone line busy indicator

Quick tech run-down

You can buy Data Access Arangements from Xecom which will allow you to connect all sorts of devices correctly to the phone network with type aproval in the USA and Europe (some models) but they will not tell you if the line has been seized, for this you need to read on, ring indication and a hook-switch relay is included in a DAA.

This is a self contained phone line in use indicator that can light up an LED or Opto isolator. See later for circuit details.

It will also make the LED flash when there is an incoming ring. I am not sure as I was unable to reproduce it, but the circuit may have latched up after some torture testing with pulse dialling (which also makes it flash) and hook flash pulses. The circuit is sensitive to the LED component and 2 in series does not work, nor does a resistor in parallel. The circuit draws 50 uA with 48 V and it seems to go through the LED, the High bright LED that I used was actually illuminating sufficiently to be visible at dusk.

I replaced the 51Ohm resistor with a 56Ohm standard value and tried it out with 2 sets of transistors. For the NPNs I used a 2N3439 and for the PNP a 2N5416 with 350V Vcbo in a TO5 devices as an overkill and then also a 2N5551 and 2N5401 150V combination in a TO92. There is also a 300V TO92 pair that I did not try, the MPSA42 and MPSA92.

A variable power-supply is the best for testing the unit and you just need a 1KOhm series resistor to pretend to be the telephone exchange (make it at least 1W with lots of free air cooling) or use the current limit on the PSU to limit the max. current to 30mA, this is risky as you can toast your phone if you bump the current limit by accident. Just wire up your normal phone with the sensor in parallel. The residual 50uA was diverted from the LED to the PNP transistor at the switching voltage (around 25V) and the LED went out and then came on brightly as the voltage dropped further (from about 20V).

Phone line sensing

The requirement for detecting the status of a phone line has come up a few times. I have had various hobby and commercial needs for such a device. There are quite a few ways to detect the off-hook condition but they all have limitations.

One of the common ways to detect a down-stream phone going off-hook is to detect an addition or diversion of the loop current usually with an opto-isolator across a series shunt resistor in the output circuit. This type is most likely to be used in an answering machine where the machine must shut-up if you rush up to the phone and pick up when the machine has started its thing. Remember that the loop current could be either polarity so you have to rectify the signal with a bridge before or across your shunt or use a AC opto-isolator (CP Clare makes some real hot ones).

Another way is to detect AC activity on the loop or across the line. This will only indicate if there is some 'sound'. After the first digit has been dialled there is normally no 'sound' and this could be incorrectly detected as on-hook and would give a false status. This is a convenient method and is most useful when one already has an analogue connection to the line for other purposes. Some call progress monitoring ICs have a no-tone detection facility that will indicate that there is no intelligent activity (dial-tone, busy &c.) in the frequency band from 300 Hz to 2150 Hz. They might also false if there was modem activity from 2200 Hz to 3200 Hz which would be embarrassing.

The last method that could be used is to measure the line voltage that is available. This is a pretty reliable method but must be used with caution. It has a DC connection across the line and as such is more prone to interfering and damage. The telco details described here relate to South Africa but are similar elsewhere, PABX, party line and carrier multiplex systems often have VERY different characteristics and one has to be very careful to not upset the specs and also to get reliable indication. The on-hook condition of a phone line is nominally 48 V (DC) and the maximum specified load that you can place across it is 1 MOhm. This is just 52 uA. This is a conservative spec but the telco could potentially detect a larger drain and come and visit to 'repair' your installation. The line assert current is a minimum of 25 mA and usually will be achieved in an instrument by loading the loop with a Zenner diode and resistor type of load to about 5 to 12 V. However a worst case load with a short local lead (close to exchange) will supply a legitimate 45 mA loop current with still 35 V across the instrument. This means that for voltage type detection you have to work with a maximum of 35 V for off-hook and a minimum of 46 V on-hook. These limits will obviously not work on a PABX with 24 V supply or a carrier multiplex system with 12 V supply so one tries to compromise. To find a happy medium one uses a sense voltage closer to 20 V. This method also needs a bridge rectifier as the line voltage polarity is unknown and may change during routine maintenance.

This type of circuit is the classic low-battery monitor circuit and can be implemented in a number of way. One low voltage option is with a 7555 IC (cute design coming soon) but is unsuited to phone line voltages. Another is to use one of the application note circuits from the National semiconductor data-book for the LM10 IC and the third is the design described here.

The circuit described here is a simple solutions. It makes use of 3 transistors an LED (or opto isolator, or flashing LED with a 5V6 Zenner and 1uF capacitor in parallel), 4 resistors, a full wave diode bridge and optional surge protection components. It has a start voltage of about 25 V with the given component values but could be changed. It has built in current limiting to avoid the circuit holding the line in the off-hook condition after the instrument is placed on-hook. It is also robust in as much as it makes use of 'real' components that can withstand spikes better than CMOS ICs.

The circuit was made available to me after asking about a posting to the sci.electronics (now sci.electronics.misc) Usenet newsgroup. I am including the comments made by the poster where he also attributes the source of the original design.

Kindly supplied by Colin Edwards [cedwards@pavilion.co.uk]

> Attached is the circuit for the telephone busy line indicator.
> The only thing of note is that the transistors (Tr1 & Tr3) should have a
> Vcbo of 120V to avoid breakdown on the ringing voltage. I also put a
> resistor and Zenner between the output of the bridge and the circuit.
>
> Adapted from a circuit by Ron Weinstein. There is no copyright on this
> circuit.
There are two GIF files that were supplied and they print out OK. The first is a Circuit Diagram and the second is a slightly cryptic simulation Graph of the circuit that shows the current drawn by the circuit on the vertical axis with a peak of about 5 mA vs the voltage across the line on the horizontal axis with useful values of about 3 V and 24 V when the LED will be illuminated. The graph axis labels need to be flipped about the X=Y line for it to make any sense. The current is measured as a voltage across a resistor R5 probably in series with the supplied circuit.

(There is also a site with other various ASCII artwork of phone circuits that has become available while I was writing this. I have not tested any of them but most look OK with a few that may supply undue loads to the phone line.)

The above link seems to have gone away. I have located a copy of the file with AltaVista at Stefans site in Holland which has LOADS of electronics information also with pointers to some very useful sites. The phone circuits file is attributed to filipg@paranoia.com who has a good electronics FAQ on the web but I could not find the phone line stuff so I have made a local copy so that I don't loose the info again.

The contents were listed by Kevin Rhoades [krhoades@QUALCOMM.COM] as the following

Telephone in use light
Detecting a telephone RING
(manual) Phone In-Use Light
Phone to audio interface (SSI202 input)
Phone Off-Hook Indicator
'phone rang' indicator light
Phone Line to Audio
Phone in-use
Telephone Line Monitor (Plans)
Use old phones as an intercom
Phone-In-Use indicator
Telephone Power?
Hold function for Telephone
Digital/Standard Phone Line Tester

The HEAT Parallax Basic STAMP II Temperature sensor

A 4 hour development cycle. (3 hours spent cleaning the work bench and doing an emergency fan swap in a server). Ideal for measuring computer temperatures.

This is a simple code implementation in Parallax BASIC for the STAMP II to measure the temperature using an Analogue Devices integrated temperature sensor.

The sensor is a 3 terminal temperature sensor with a built in slope/delta A/D converter and reference. The output is supplied as a duty cycle at nominally 45 Hz. Any counter with 1 to 10 us resolution can sense the temperature in about 25 to 50 ms. You don't need to send any commands (I2C, Dallas 1 Wire) to the device and it is always ready when you want the data. The STAMP is not optimised for fast execution so it takes me max. 4 cycles to read the temp. with more effort you could cut it down to max. 1.5 cycles. Only one pin is required on the STAMP and no other external hardware for the TMP04 (TMP03 is open collector output so will require a pull-up resistor). Calculation of the temperature from the duty-cycle is a simple multiply, divide, subtract but you loose a lot of resolution if you use 16 bit integer math. Sensor is typically accurate to 1.5°C and can be calibrated in software to about 0.5°C accuracy with a resolution of 0.3°C easily achieved.

I wrote a short BASIC program to read and calculate the temperature but was too lazy to wire up the slick HP HEX displays to the STAMP so instead used the DEBUG feature to get the temp. Calculating the temp from the count values agrees with the BASIC result to 1 or 2°C. I also heated the sensor up to 100°C by holding it over a soldering iron, the plastic on my connector shell was starting to curl a bit. The sensor is rated -40 to 150°C. Low current consumption (1.5 mA) insensitive to clock variations, unlike V-F converters. There is a local copy of the TMP03 data sheet in pdf format exactly as found on the Analogue Devices Web site.

There is also a copy of a PASCAL program that I wrote (undocumented) that uses a devious method to read the temperature with a PC. The TMP03 sensor must be connected to a D15 Male connector and plugged into your joystick port. The power from pin 8, ground on pin 5 and duty-cycle signal on pin 7. This program just sits and polls the joystick pin and counts up 40000 counts on the one state and then divides it by the number of counts on the other state giving a very bad approximation of the duty-cycle. If you smooth the signal over enough samples (about 30 count intervals, moving average works well) and then write the results to disk every minute you get neat plots of the temperature when you are not using the computer, my program will not run under windows properly as the task switching adds too much jitter even when you force the program into permanent foreground operation (put a weight onto the alt key when you leave the office). In raw DOS with a 386 DX2-80 you get fair results. You will have to rip out my time routines that are from the UTIL unit or make your own. They are just for the time stamping of the data file.


Sames Energy Metering ICs and Modules

The local South African Semiconductor Fab has a limited range of products but does try and make them as useful as possible. They Second source and develop a handful of popular telecoms IC's for Phones and exchange trunking. They also have a range of Energy measurement ICs that I will describe here.

The company is called South African Micro-Electronic Systems or SAMES. They can be contacted locally at +27 (12) 333-6021 (fax:333-8071) or their US representative Mr Jerry Mills is at +1 (408) 356-0216 (fax:356-0207). As a small favour to me if you do call Jerry Mills could you please tell him where you got his number and ask him to send a memo to his South African counterpart a Mr Dennis Walden about how you got hold of him. This is a small experiment on my part on International Internet marketing potential.

They make prototype modules for a few of the metering ICs. The ICs have various options. Either integrating pulse output that supply one pulse for each energy unit, or ICs that have internal counters and an asynchronous serial port. They have single phase and 3 phase units though engineers at SAMES say most customers make use of 3 single phase modules in 3 phase applications. They also do one with a built in 7 segment Display driver circuit to display the average power over every 2 second period, this IC will not integrate energy.

Here is a list of the devices, development modules and some capabilities.

Single Phase
SA9102C
Module PMM101B2, Pulse Output
SA9103A
Module PMM102C4, Serial Interface
SA9103B
Serial Interface (Like SA9103A but requires 4 less capacitors)
SA9106A
Module PMM103A1, 5 Digit LED display driver
SA9109
7 Digit LCD display driver, 4 multi tariff registers
Three Phase
SA9104
Serial Interface
SA9105A
Module PMM104A1, Pulse Output
The Modules have opto isolators on the pulse and serial outputs and serial inputs. The protocol to drive the serial ICs is a simple single byte protocol and you get 2 bytes back with the top 16 bits of the counter at the time. You can place the device into various test and pulse modes (some undocumented) as well as clearing the 22 bit counter. Unfortunately it is not possible to directly read the low 6 bits of the counter but one can ignore them if one lets the counter use up most of the 16 more significant bits. One may also poll fast and check that bit 6 changed and then reset the counter when the low 6 bits had not counted far to minimise the error.

These devices are rated to Class 1 and they take Power factor into account. They require +- 2.5V supplies which are derived from the mains in the development modules. They use a resistor divider to measure voltage and either a shunt resistor or current transformer to measure line current. Usually the module will float at the line voltage and have opto isolators to connect it to the micro controller or PC. The LED display module has a mains transformer and display to let you get a reading without the use of any other equipment (you still need the shunt). These modules have been made for 230 V use but all you need to do is change some resistors and the transformer in the LED Display module.

The module I purchased months ago, the PMM102C4 cost about ZAR 250 which is about US$ 60. The price of the ICs was in the ZAR 20, US$ 5 range but could have changed. After having had the module and a suitable shunt in a box for a while and having offered to make some more information available on the STAMP list I decided that I had to give it a try-out. I made a very simple jig with a 100W lamp and a mains receptacle and wired the module, shunt and bits together. It worked fist time with the supplied PC test software and I was able to graph the consumption of the lamp and various hand tools without any problems.

These ICs and modules are used in great quantities in household prepayment metering systems as well as substation monitoring and probably many other places I don't know of. I purchased the module on spec for a Generator Leasing Company that was going to tender on temporary township electrification but the project got bogged down with politics and I never got around to doing the testing on the metering part of the project.

I can recommend these modules if you have a design that is not too cost sensitive and can take the 70 x 80 mm modules, saves a lot of development and the readings are accurate enough for charging people.

UPDATE

The company LEM U.S.A. Inc have a series of hall effect current transducers that are suitable for some power measurement systems.

They have at least 2 ranges of products :

The LEM HY series (which were advertised in a Pacific Rim trade journal in December 1995) which have 500 MOhm isolation at 500VDC, include devices in the 5A to 20A ranges, require +-15 V, can measure AC, DC and pulse currents and an output of +-4V with 10mA source current for full scale at a power consumption of 25mA. Accuracy is rated at +-1% over an operating range of -10 to 75 degC and wheighing in at 8g with easy fitting to PCB with single inline pins (4 small and 2 heavy current).

The other type is described on a NASA page for use in the spacestation (I guess) and is in the LA series.
The following extracted from the NASA page.

The LA25-NP has the following salient characteristics: 

     Measures bidirectional currents up to 25 A rms from DC to 150kHz. 
     Closed loop Hall effect design (proportional current) 
     Circuit board mountable, selectable current ranges. 
     Supply voltage of +/- 15 Vdc, 35mA (max). 
     Galvanic isolation to 2500 V, 50Hz, 1 min. 
     Dimensions 26mm x 29mm x 16mm, 22 grams. 

The closed loop design of the LEM LA25-NP provides excellent signal level and 
consumes very little power.
Their US number is 1-800-236-5366 and they are in Milwaukee, WI.

Some of the LEM parts are available via the UK based RS Components mail order-house which will be the easiest way of prototyping. Look under Sensors/Transducers - Hall Effect Devices - Current Transducers.


Hewlett Packard Thermal Paper IR link printer evaluation.

Last year I had occasion to try out the capabilities of the HP 82240B portable printer.

Nice things about it are it has an IR interface, uses no ribbon, runs on internal batteries and has graphical capabilities.

Problems with it include the cryptic IR protocol the thermal paper and the limited running time with batteries.

I decided to try out the printer using a software generated IR signal that would drive just one output pin on the parallel printer port of a PC (could be a serial port pin just as easily) to see what the timing and protocol overheads were. As it happens the protocol is not too hard in a high level language with brute force but the timing of a 32 kHz carrier for the IR link is a bit beyond the speed that my PC (i486DX2/80) could cope with reliably. Running the program in a DOS box under windows was no option. If the critical carrier burst generation were to be done in assembler with proper use of the PC timer the program would most likely work perfectly but that was not the way I was planning to go. Trick was to find out how the protocol worked and then code it into a PIC to allow for driving the printer with a serial port that would interface power a PIC and the IR LED. Basically a smart cable.

The protocol is nothing like ASYNC NRZ data that one sees on a normal RS-232 interface for a few reasons. This is not suited for IR links as the on times may get too long and start to saturate the receiver which then causes dropouts. This is why almost all IR signals are pulsed carrier bursts. The carrier was 32 kHz according to the two info sources I used (one had used the other from what I could tell) which is at the low end of the consumer IR range. The characters are made up of a start sentinel and then some error correction bits and the byte itself. The error correction bits actually allow the printer to repair single bit errors and detect all 2 bit and most 3 bit errors. Errors are printed as a Solid Block so the quality of the signal is obvious when you look at the output.

I wrote the program to print text and graphics to the HP printer in Turbo PASCAL and this program can be found here. and the one net info reference can be found here. With these two references you can make it work but the third point of view from the CCI article is useful for understanding what is going on with some of the protocol stuff. You will also need to consult your printers manual if you want to understand the graphics control codes.

Recently Victor posted a protocol specification that I have archived here. This document cannot be official HP as there is a serious ommision error in the generation of the pulses. The LRC bit generation may very well be correct but I have not tried to check.

I am writing this up now because there is talk on the PICList again about this topic and it has been 3 months since I stopped playing with this project.

Thanks Gary Norman Dion who supplied me with the pointer to the Circuit Cellar Inc. article.


Other peoples project pages


How to reach me

Use any of the following means.

Comments, suggestions and submissions welcome.

Internet electronic mail
kalle@ip.co.za

CCITT Group 3 facsimile
+27 (11) 402-7751

Regular post
P O Box 15775
DOORNFONTEIN
2028 South Africa

Produced by me. Last changed on 12 January 1997.
http://www.ip.co.za/people/kalle/project.htm Project Pages kalle@ip.co.za