|PIC Microcontrollers and Communications
Welcome to the Rat Ring
|A new discussion group and website devoted to PIC communications technology , via public telephone network and Internet, plus a simple, expandable Remote Application Terminal (RAT) for anyone to build.|
|Introduction to RAT Technology.
Using very simple hardware it is possible to get two PIC devices to communicate with one another reliably at 1200 baud over the public switched telephone network or PSTN.
The aim of this website and the accompanying discussion group (hosted by Yahoo Groups) is to give practical advice and assistance so that other enthusiasts may benefit from some of these simple techniques.
Starting with a simple tone generation routine driving an R-2R resistor ladder network, the tutorial shows how DTMF dialling can be achieved and how the signals can be presented to the telephone line using a simple gyrator circuit and hook switch..
The detection of incoming rings, dialtone, Caller ID, SMS messages and local phones being lifted are all addressed using simple transistor circuits, using cheap general purpose transistors.
From these simple designs, a fully modular system is achieved in 3 logical stages. Starting with a one chip design and then expanding through a series of progressions to a fully functioning stand-alone system using several inexpensive chips. An excellent way to learn microcontroller interfacing techniques and telecoms in a step by step manner.
The Remote Access Terminal (RAT) is a simple PIC based design, with a telephone line interface attached. The RAT can answer incoming calls, dial up numbers using DTMF tones, decode Caller ID signals, generate and decode V23 modem tones and drive a serial interface to a PC or other hardware.
The 3 versions of the Remote Access Terminal, are designed to address a wide range of projects from the simple autodialler to the most advanced standalone project with real time datalogging and V22bis modem communications. A series of tutorials describing the hardware techniques being used lead the newcomer through the various interfaces and firmware routines.
RAT1 - Beginner's Start Here
RAT 1 is the minimalist hardware solution allowing safe interconnection to the telephone line using just 3 transisors, 4 diodes and a few resistors and capacitors.
RAT1 has the ability to do DTMF dialling, V23 modem tone generation and V23 Caller ID and SMS messaging detection in firmware, hosted on a PIC16F84A leaving approximately 500 instructions for the users application.
RAT1 introduces the interfacing techniques, tone generation and decoding firmware routines and general telephone line interworking practices.
Rat2 - Intermediate Design
Rat2 utilises a low cost DTMF and Caller ID decoder chip and provides many new features over RAT1. These include a real time clock for time of day dial-out and additional data collection routines.
In addition, RAT2 also adds a proprietry relay/gyrator based telephone muting circuit which allows a standard telephone to control the device operation.
RAT2 uses the newly available PIC16F628 to provide more than 1500 instructions of codespace for the user's application.
The RAT1 hardware can easily be enhanced to the level of RAT2.
| News Flash
The PIC16F84 can now decode Caller ID and V23 SMS messages from the line without any additional hardware support - just 75 bytes of clever firmware ;-)
Now a complete modem on a PIC16F84!
Just a PIC 16F84, 4 diodes in a bridge, an NPN transistor, a couple of zener diodes and no more than 10 resistors and capacitors. Join the Rat_Ring for full details of this exciting new application. 10th December 2001.
|A User Group and Discussion Forum
It is my intention to offer the RAT reference designs and Ratcore firmware free of charge, but updates and user licences for commercial purposes will carry a nominal charge per unit.
In order to maintain some form of document control and user group feedback, a new discussion forum has been started on Yahoo Groups.
The Rat_Ring Discussion Group can be found here, and all subscribers has unrestricted access to the information outlined on this page.
| RatCore Firmware
The simple RatCore code allows the user application to be built onto the RAT platform.
Starting with the basic telecommunications routines for the F84 based RAT1, additional routines are added for RAT2 and RAT3 to take advantage of the additional microcontroller features available on the 16F628 and 16F877.
Other devices such as keypads and displays, serial communications to a PC, speech recording and playback, short range wireless communications etc may be added to the device.
|A new open design for the Remote Application Terminal RAT has been released.. Enthusiasts are invited to build the design from the published schematics and utilise the source code provided. A pcb will be released later.
|Starting with a small user base initially, it is hoped that some of these PIC interfacing techniques will gather additional momentum amongst enthusiasts. Ultimately, a network of RAT technology allowing applications based on low cost PICs such as dataloggers, home automation, short messaging systems, security devices, appliances, hand-held games (GameBoy for example) to intercommunicate, for data sharing and remote data collection. A dedicated server for code updates is planned.|
|Here are some of the routines incorporated into the RatCore kernel
Low level line interface management
Caller ID decoder
Real Time Clock
Real Time operating system
I2C support for 256k x 8 EEPROM
More routines will be added as they are required
|It is hoped that Schools, colleges and universities will assess the potential of this technology as a suitable project for students of electronics and communications engineering. Firmware will be made availble to the user group on a shareware basis. Users are encouraged to make their development freely available to the group. Only commercial applications willl carry a modest user licence equivalent to a small percentage increase in the cost of the processor used.|
|If you would like to subscribe to the new discussion forum just click on the second link below to send an email to the subscription system. Include the word subscribe in the top line of your message or visit:
The Rat_Ring Site
|A simple reference design allowing the RAT to safely interconnect between a PC serial port and the telephone network will be released over the next few weeks.
Accompanying this willl be the RATCore
firmware kernel, allowing basic communicatios including DTMF generation and reception, V23 modem generation and reception. RATCore takes approximately 2K of rom space leaving plenty of space for user application code.
|Here is a RAT3 prototype showing the telephone line interface (left), PIC16F877 microcontroller and commercially available 2400 baud power line modem fitted as a daughter card in the applications area. The 74HCT574 D type latch provides another 8 bit parallel output port to allow an 8 bit R-2R ladder network to be driven from Port D as wells a scanning a keyboard and controlling an alphanumeric LCD.|
|The RAT3 unit, in Master device mode, can automatically dial a telephone number to contact a server or other Slave RAT based device. It can be made to call in regularly to a server in order to receive software updates. These are automatically downloaded into the Flash memory of the PIC using V23 modem modulation. This operation takes at most a minute, and can be scheduled to happen only once per month. Program and data storage is by means of E2 memory allowing great flexibility for applications.|
|The RAT3 takes advantage of the additional I/O resources of the PIC16F877 and uses a 128K x8 static RAM for data and audio sample storage. A V22bis modem device allows full-duplex 2400 baud communications.
Applications such as voice prompted remote control systems, answering machines, micro-web-servers, remote dataloggers or utility meter readers are possible based on the RAT3 hardware.
|RAT3 Stand-Alone System for High End Remote Telecommunications Projects
The RAT3 hardware is based on the popular and inexpensive PIC16F877 and should cost no more than US$25 to implement. Building on the experiences of RAT1 & RAT2, the RAT3 allows interfacing to keypads and LCD displays for user interface flexability. An inexpensive V22bis modem chip allows higher speed communications and releases the microcontroller overhead allowing sophisticated firmware applications.
|Some Communications Applications based on RAT Technology|
|HAMSTER - Home AutoMation System TERminnal
Another Application based on RAT3 technology.
An early prototype based on the RAT3 communications firmware. This application straps a 128k x 8 SRAM to a PIC16F877 and allows recording and playback of voice samples to the telephone line. The 3 D type latches allow the big RAM to be connected to the PIC using the minimum of I/O pins.
The telephone line interface is on the far right of the photo, making up the hook switch, gyrator and shunt circuits. This unit is powered entirely from the telephone line and a simple switching supply trickle charges the 4.8V rechargeable NiMH from the telephone line.
This device sits on your phone line until you call in - what happens next is limited only by your imagination and programming skills!
|Latest New, July 2001: A new web site devoted to RAT technology is currently under construction and will be linked into this page when launched. Please await further announcements. Meanwhile why not join the RAT_Ring?|
|PIC Applications for all Seasons
It is now possible to do simple analogue signal processing in real time in firmware - tasks such as generating and decoding DTMF tones for telephony, producing V23 modem tones and decoding the V23 signal back into a serial bitstream. Speech recording and playback and a whole host of simple frequency and tone detection applications are also possible.
A PIC can quite easily dial a telephone number, send a short message at 120 characters per second and hang up again, all on a board (The RAT1 shown above) costing less than $10. PICs can communicate to each other or to a server from any phoneline in the World. Update all the software on your remote datalogger in about a minute.
Combining this technology with the internet, you can now have a micro web server running on a $2 PIC which you can access from all over the world. Or how about one which only answers your phone when it recognises the incoming number - great for security applications - HAMSTER was designed for just this purpose. The end task is really only limited by your imagination and programming skills.
|Introducing the BAT - Bootloader Application Target Module - You just plug it in and squirt in your Code!
Schematics for this available via the Bootloader Link below courtesy of Shane Tolmie at Working Technologies - Thanx Shane!
Pictured below is a BAT module from above before plugging in the 16F877 processor.
|The BAT Bootloader
Microchip has recently introduced a series of devices which use Flash memory to store the application programme. This means that the device can be programmed over and over again, and programme development and testing can be very rapid, as a result of not having to wait for the old style eproms to programme or erase. You can literally squirt a whole 8K of programme into a PIC in a couple of seconds and you are ready to go. The BAT module was designed as a Bootloader and Target Module. It can be plugged into your prototype hardware and looks just like a normal PIC16F877. It connects to a PC via a 9 pin serial lead and will accept an 8K download in a few seconds running at 19200Bd. It even gets its power from the PC serial port. Once programmed up, it runs your application code. The full schematics for this module are available via the "Bootloader" link, above.
In order to make use of this technology you need a PC with a serial port, a very simple circuit built on stripboard costing about $10 and a fertile imagination.
I have been programming PICs on and off for only a year and I find that they are the automatic choice for simple projects built with a "let's try it and see" approach.
|If you would like to become part of this new group, or you wish more information, please do not hesitate to contact Ken by email or join the new Rat_Ring discussion forum, just started on Yahoo Groups.|
|Bootloader for PIC16F87X click here|
|To discuss any of the applications outlined on this page email Ken by clicking here.|
|GERBIL: Gas & Electricity Remote Billing Interface & Logger.
This really is a fat little rodent of a board containing V23 modem, 433MHz radio receiver, line power supply and NiMH battery, microcontroller, meter pulse and IEC1107 opto interfaces, 128k of battery backed SRAM holding up to 16 months of half-hourly gas or electricity readings, NV EERAM for parameter storage, 1200 baud serial interface to hand held terminal, telephone line interface and automatic radio link synchronisation firmware.
|A Web server Running on a PIC16F84|
|Here is an application to allow a minimal Webserver WWWPIC2 to run on any of the Flash based PICs. The original code was devised by Denis Petrov, but taken up by Vincent Sanders to make it work with a more familiar assembler. I have subsequently updated the code so that it is 100% buildable using the MPLAB tools available from Microchip.
Email me if you require the source code.
By coupling this micro webserver to a telephone line using the PIC to act as a 1200/75 Bd modem you now have low cost net connectivity. $10 should cover component costs.
|Simple Ideas should be breadboarded first - here a PIC16F84A is grafted onto an NPC 8223A Caller ID chip from NPC and a 433MHz wireless link. The large empty area on the bottom left is where the BAT can be plugged in to get the system up and running. Get the biggest breadboard you can afford - this one has seen numerous projects developed over the last 3 years.|
|Some Background Information on PIC Microcontrollers for Telecommunications|
|Of PICS and Phonelines.
The incoming phoneline can be an interesting but hostile environment for the humble PIC. Most countries have regulations to what you can and cannot connect to the line. These regulations are designed primarily to protect the network from damage, then to protect you from doing anything stupid.
Two golden rules:
Never connect any mains powered equipment directly to the line. If you need a source of dc power always use a mains adaptor with an internal transformer.
It is inadvisable to connect either of the incoming phone lines to earth - the system will not be happy, and you might get a visit from your local Telco engineer.
Suitable interface circuits and schematics are available from a variety of IC manufacturers on how to connect correctly to the phone line.
Here is a comprehensive primer on telephone line interface circuitry. If you are new to this I suggest you read first ;-)
|The 16F84A The Beginner's Choice
The second device is the hobbyist's favourite and it is the 16F84A. This comes in an 18 pin DIL so it is smaller and easy to use on stripboard projects. This is available very cheaply and is used in a lot of set top boxes, and smart cards for security coding.
The F84A has been around a while and rapidly achieved popularity with enthusiasts because of its useful 1K codespace, 8 level stack, E2 and 68 bytes of RAM. The wake up on change on the B port was also a useful feature for key scanning as is the External Interrupt on pin B0. The F84A was used extensively in set top boxes and has been hacked by all and sundry. A multitude of simple programmers have been devised to program this part.
|The 16F877 " A Real WorkHorse"
There are 2 PIC chips which I can really recommend.
The first is the all singing, all dancing PIC16F877 which comes in a 40 pin DIL - and is thus really good for building circuits up on a prototyping breadboard.
It has 8K of Flash memory for program storage, 256 bytes of EE RAM, 368 bytes of RAM, an 8 channel 10-bit A to D converter, a USART for direct serial communications with a PC and 33 lines of I/O. Best of all it can be connected almost directly to the serial port of a PC and a Bootloader program (to get your programs into the PIC) is freely available on the Internet. See link above.
Best of all, it costs just $6.50.
The '877 is ideal for any project requiring sensing of analogue signals, like pressure, temperature, and timing functions like rpm, frequency, counting, generation of DTMF (telephone) tones, V23 modem signals etc, etc. I even have a demonstration of a speech recorder and playback system using an '877.
|The 16F628 "Small but Powerful"
The F84A has now been superceded by the even better, even cheaper PIC 16F628 which is pin compatible with the '84 and has a host of new and improved features.
Better still it's only $3.63 in 1 off quantity! That's almost half price but more than twice the features of a F84A.
It has 2K of flash space - twice the original, 224 bytes of RAM and 128 bytes of EERAM. It has 18 pins - 13 of which are I/O and it can be clocked at up to 20MHz.
It has a couple of comparators and a programmable voltage source so you can implement a "Poorman's ADC". It also has the facility to run a real time clock from a 32768Hz watch crystal - so you can give your project a time of day capability - what more can I say?
Oh yes - you can easily hang an LCD on this device or any other PIC and have a simple basis for some low lost, intelligent, battery powered instrumentation.
|Salvaging Old Telephones
If you want to start developing phone ideas, perhaps one way would be to salvage the line interface from an existing telephone.
Click Here for my Phone Page
Almost all phones are now made in the Far East, sometimes for as little as $2. These then sell in the high street for $8. The basic phones usually contain a dialler chip and an audio line interface chip. Very often the dialler chip can be replaced with a PIC which scans the keyboard and generates the DTMF tones for the audio chip.
See the Microchip Application note on the Microchip Website
The phone contains all the line interface components, which convert the line current down to a regulated 3V or so which can be used to power the PIC. The keyboard makes a useful data entry device, and it is possible to hang a LCD display onto the PIC and scan the keypad using the same port. So you have a memory phone with a alphanumerical display.
The more complicated "Feature Phones" with LCD included generally have a 80pin or 100pin LCD controller, rather than a separate 20pin dialler chip and the circuitry is somewhat inpenetrable. NPC and Holtek and Philips are some of the main manufacturers of telephone and Caller ID chips and have comprehensive data available on their websites. Holtek, in particular, specialises in chips for fairly specialised consumer product orientated devices, but the data is generally available.
Hello this is an nice site to see, i am looking for a gsm module who can drive an pic controller, mabey you have an idea about this.James Newton of Massmind replies: Questions should be posted to the Yahoo group at http://tech.groups.yahoo.com/group/rat_ring/+
I want to use an gsm module , and with the dtmf tones i wil controle a pic controller. Mabey has someone an idea.
|file: /Techref/member/rat_ring/index.htm, 43KB, , updated: 2012/11/13 12:13, local time: 2017/11/25 03:42,
|©2017 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://www.piclist.com/techref/member/rat_ring/index.htm"> rat_ring</A>
|Did you find what you needed?|