Mark Harrington

Engineer Audio, PC embedded technology


A brief overview of my experience to date

Born In Saudi Arabia 1964 Spent 13 years in South Africa then emigrated to Britain Interests began in electronics from...

EEWeb Stats

Mark's Projects :

Return to Projects

Rs 232 Relay Control Board

Project Summary

Computer Controlled, relay board designed to be either operated manually via switches on the board or nine way Type Connector via PC or laptop. Provision has been made for USB serial adaptor. The Project utilises PIC Micro technology with windows visual interface written C Sharp utilising Dot Net version 4. It can be interfaced to other adapters Keypad adapter (Optional) or RF receiver (Optional) or Via the Net (Optional) Can be adapted to operate other external attachments such as Automatic Security Gates, Slave Flash or multiple Strobe lights for both professional or amateur photographers

Project Description

Figure:1 Project

Figure 1  Project

Can be interfaced to other adapters Keypad adapter (Optional) or RF receiver (Optional) or Via the Net (Optional)
Can be adapted to operate other external attachments such as Automatic Security Gates, Slave Flash or multiple Strobe lights for both professional or amateur photographers

Main Features

Single pole Double throw relays contact rated at 10 amps 14 volts DC
Led Indication for each relay advising Off or On status
Independent manual switching for each relay
Full isolation between relays and CPU via Opto Couplers to eliminate noise, possible destruction of CPU
On Board mains Supply or alternative DC Jack for independent 12 – 14 volts Dc Supply
Mode switch controls manual or Pc control
Mode led advises user of what mode , state of the Board has entered
Can be interfaced to other adapters Keypad adapter (Optional) or RF receiver (Optional) or Via the Net (Optional)
Can be adapted to operate other external attachments such as Automatic Security Gates , Slave Flash or multiple Strobe lights for both professional or amateur photographers

Figure:2 Circuit Diagram

Figure 2  Circuit Diagram

The circuit comprises
A Level converter for conversion of Rs232 signals to TTL level this being U1 Max232

Five input switches , Four of which control the relays for manual operation , One of which is used to detect or switch the state of the Relay PCB to Serial control via the PC or Rs232 cable

A central cpu processing unit which performs the switch detection and subsequent relay triggering , more importantly determines the Rs232 signal input and extracts the commands sent to the board thus operating the relays individually or as a group

In other words the board has the ability to switch all four relays , 3 relays combination of in one single operation This is controlled via the Visual CSharp Interface

Four switching transistors to drive the relays with LED indication for each relay

Four Opto-couplers which in turn drive the relevant relay driver transistors isolating the CPU from the driver transistors This not only prevents possible damage to the CPU but also improves transient electrical noise which can, and does upset the PIC Micro registers due to the induced emf from the Relay coils

Two other led’s which indicate power to the Board , Mode selection in the following order
1: Manual operation
2: Automatic operation in other words serial receive
3: One wire bus to be implemented

Points one and two are again controlled via the Visual interface

Provision has also been made for either USB to serial conversion using FTDI chips . Additionally external DC input

As further thought I’ve provided provision via set of through holes one the PCB above all switches such that should you decided to to opt for manual control There is provision set aside so that you can trigger via other lines such as motion sensors , door sensors in the case of possible alarm systems

An Inbuilt mains power supply with suitable 5 volt regulation for the CPU and a 14 volt supply for the relays

SW1 provides 5 volt power supply to external IO devices such as an RF Receiver module or PIC keypad which is plugged into the 9 way D type connector such that the unit can also be controlled via Keypad or RF remote control unit , Infra red or the default which is the Visual PC Interface These are yet to be designed but are in progress
Power supply

Figure:3 Power supply diagram

Figure 3  Power supply diagram

The power supply is a simple stock standard series regulated power supply with series pass transistor and zenor diode, with capacitor decoupling to reduce any fluctuation of the 5 volt line

The 14 volt line is unregulated The transformer I manages to salvage from an old microwave but ideally the current should really be upped to around 800 ma for a far more stable operation although I haven’t really noticed anything overly major apart from now and again you get a slight glitch on switch sensing Serial wise its extremely stable with no apparent problems

C1 forms the smoothing bank D1 to D4 form the full wave bridge rectifier R2 is incorporated to fully discharge the capacitor I’ve noticed in the past that micro’s can be quite strange about reset times and not incorporating this can cause the malfunction with CPU reset times plus of course although voltages are not high enough to cause electrical shock on the secondary, Its always good practice to put this into place I’m sure there are many of you who have in the past accidentally placed your palm across a 60 to 80 volt dc circuit across the smoothing capacitor with some rather nasty experiences

PCB Design

Figure:4 PCB after etching etc

Figure 4  PCB after etching etc

The printed circuit board was designed using Proteus 7 Professional although I have to admit I had to reconstruct this twice and still managed to make mistakes

However all well , said and done , I have now fully assembled the unit and the results are exceptional , which is one of the main reasons I prefer to the initial prototyping myself

Very simply put this is the only way to learn no matter what the textbooks tell you the best experience and the best methods of learning are always practically, in other words ,getting hands dirty and physically doing this yourselves

Perhaps that’s how I’ve learnt as much as I know rather than just simply take it for granted that we should simply adopt a truly academic stance and not get involved in any of the ground floor work that builds solid engineering foundations

Also I might add provides an appreciation of what it actually means to design, sit for weeks , days , months years not to mention the level of expertise that you have to have in order to produce goods that are viable , good quality products These days for which their seems to be little appreciation for other than “Chuck it in the bin attitude” , a symbolic emphasis of how wasteful and cheap society has become

The Final artwork appears as such see below for details

Figure:5 Raw PCB Art Work

Figure 5  Raw PCB Art Work

This is now complete after coding, debugging, fault finding and consistent testing to see if there are any better methods of laying out tracks, and is to the best of my own knowledge as complete as I can provide to current date

I don’t have all the professional advice that you might expect from someone who sits and does this themselves but I do know once I finished I have a perfect working design from which you can run off one PCB after another and know they are going to work

However the only tips I will give you are if you are wanting to do this which I hope some of you will and become better at this than I am are the following

Make sure the board is clean before you start no finger prints, no oil stains, grease or anything else

Polish the copper with brass then cleanse this with acetone , wash in soapy water and rinse well ,

DRY thoroughly covering with a lint free cloth

Use press and peel to achieve your track layout onto the PCB There are plenty of tutorials on the net re how to do this

When using press and peel start with a small PCB first then work your way up to larger designs

Have a magnifying glass ready so that you can carefully check the transfer after you’ve placed this onto the copper clad board You will always find slight errors use a touch up pen to fill in when such errors occur

Lots of patience, handwork and be prepared to do this sometimes 2,3,4 ,5 times and more to get the results you want

Finally don’t get angry with yourself this is a technique that can only be mastered with time its a not a one day wonder that you miraculously achieve over night It takes months and months

Look on the bright side Despite all your efforts, at the end of your turmoil a

All you have to do is submit a final design to a PCB agent and then its cheap Far better to make mistakes now than cost a company and its customers a small fortune for failure

Below please find a list of PCB drill plots Gerber plots etc below

Over the next week or so I will post instructions on how to’s with the front end but it should be self explanatory Ive also included an edx file file for checking flow chart operations but again I will post more on this later

Project Files

File NameFile Size
Parts Lists20.63 KB
Relay Contol schematic121.34 KB
Relay Power supply schematic20.76 KB
Proteus Design files for PCB95.89 KB
Hex file for the PIC16F84A4.54 KB
The front end control board application173.96 KB
Tags: PIC Microcontrollers, PCB, RS232,

Comments on this Project:

Amin Khan
By Amin Khan (0) 0Score: 

5 months ago:  My Question to Mr. Mark Harrington, is about project (Rs 232 Relay Control Board). Is it possible to to edit time control. means select my time delay control according to my choice, in the software. Thanks.

Login or Register to post comments.
Click Here