A $10 ATA

In October 2006 I made my way to Dharamsala, northern India, where I visited the Tibetan Technology Center, and in particular a guy named Yahel Ben-David.

You see I am interested in developing low cost open hardware technology that can help people in the developing world. Yahel and the team at Tibtec are using commodity routers to build low cost community wireless networks. To date about 3000 computers have been connected to the Internet by the Tibtec team. As these computers are often shared it is fair to say that about 30,000 people now have Internet access thanks to the Tibtec team.

Now I have been working on some open hardware/software for building low cost embedded IP-PBXes. I had an idea that my work might be helpful to Yahel and the people at Tibtec.

As we got to talking, a few interesting economic points came up. Yahel can buy a WRT54G type router for $50 and an ATA for about the same price, due to the miracle of mass production. In small quantities, my open hardware designs couldn’t get close to this, even by removing all margins and selling them at cost. Also, for many applications, just one or two FXS ports are required, rather than a full blown PBX for 4-8 analog ports.

(Note: I have since reworked the IP-PBX design so that it can be built for less that $100 in quantity, however that is another story for another blog post).

So after leaving India, in the back of my mind was the need for a very low cost way to connect a telephone to a router.

A few months passed.

Recently, I became aware of Air-Stream – a community wireless network that extends over my home city, Adelaide, South Australia. Air-stream uses very similar technology to Tibtec – low cost commodity routers, high gain antennas, and hacking. It occurred to me that a “killer application” for Air-stream would be a way to carry phone calls for free over the Adelaide metropolitan area (in Australia we pay 25 cents for each local call).

However once again, if Airstream users can connect with a $50 commodity router, it would be nice to find a low cost way to hook up a telephone.

AVR Microcontrollers and DSP

At about the same time I came across a few articles that got me thinking. One was USBtiny – a way to implement USB in software on a low cost Atmel AVR ATtiny microcontroller. In this design the little $1.50 micro gets interrupted by each USB bit at a rate of up to 10MHz! And I thought the Zaptel 1ms interrupts were bad. For certain applications this allows very low cost USB interfaces to be built, cheaper than typical custom USB interface chips. Hmmmmmmm.

I then stumbled across a fantastic Circuit Cellar article by Marco Carnut on an AVR Phone Recorder and Telephony Platform. This project uses a $5 Atmel AVR ATMega microcontroller. As well as recording telephone signals and communicating with a host PC, the AVR also finds time for some real time DSP (DTMF decoding). What was news to me was that these little chips have some DSP capability built in – for example a relatively fast 2 cycle multiply. These AVR chips also have a bunch of other features, such as built in flash, RAM and A/D D/A converters that seem to work OK for speech signals. They are essentially little “systems on a chip” – just add crystal and stir (well, program). Hmmmmmmm (again).

So the big question is, can we use these chips to build a $10 ATA? Well, I think this might just be possible. To see why, lets first take a look at the design of a typical ATA.

ATA Design 101

The figure below shows the design of a typical ATA. Quite a lot going on. Typically the software components are implemented on some sort of fairly fast (200MHz, several MB of RAM and Flash) microcontroller that can run 1 or two channels of G729 and also support the SIP stack and perhaps a basic operating system.

The Analog FXS Interface is implemented with a chip set from companies like Silicon Labs. This chip set generates DC “battery” voltage to run the phone (e.g. 48VDC), 90Vrms ring signal, provides AC analog termination (e.g. 600 ohms impedance) and a hybrid – a gadget that separates and combines the transmit and receive voltages on the two phone wires. I have written an introduction to hybrids in an earlier post on echo cancellers.

Here is an equivalent electrical model of the Analog FXS Interface connected to a phone (click on the image for a larger version):

There are two paths – DC and AC. The DC path flows through Vbatt to Rdc and provides current to run the phone. Cblock prevents DC entering the AC path, and Ldc prevents and AC entering the DC path. This isolation allows the paths to have different impedances, for example a 200 ohm DC feed resistance Vbatt and a 600 ohm AC impedance (Zo an Zl) for audio signals.

The AC path flows from Vo through Zo and Zl (the audio signal the ATA send to the phone). In the other direction the audio from the phone is the AC path flowing from Vl through Zl and Zo. Zl and Zo are typically the “600 ohms” impedance you hear about when people talk about phone lines.

To ring the phone we switch in a low frequency (say 20Hz), high voltage ring signal Vring. When the phone answers, it closes the hook switch, which is detected by the Hook Detector.

The hybrid (not illustrated) separates Vo from Vl. It usually doesn’t get it quite right, which is where the echo canceller comes in to remove any transmit echo (residual Vo) from the received signal.

In a real world design, the actual parts Cblock, Ldc etc don’t really exist, these days electrical equivalents are all built into the chip set. For example Ldc is often implemented with transistors and a capacitor in a Gyrator circuit, as that is cheaper than using a large inductor. However this electrical model is still pretty accurate, and represents an equivalent circuit that is useful for analysis.

$10 ATA Design

So here is the proposed design of the $10 ATA:

The key points in the design are:

  1. Use a low cost ($3 in modest volume) AVR microcontroller to interface between the phone and the USB port of the router. Alternatively we can use RS232 which most routers support with slight modifications. Ethernet is also possible but costs more as we need an Ethernet chip. With RS232 it may even be possible to remove the RS232 line drivers (saving additional cost) if the line is short. Or perhaps use low cost analog circuit for the line driver alternative (given we have 12V available).
  2. Use the AVRs DSP capability to do DTMF detection.
  3. The built in RS232 UART can run at 115 kbit/s. We require approximately 64 kbit/s in either direction, so RS232 should be acceptable, even with the overhead for start and stop bits. A small amount of overhead is also required for signalling (hook status, DTMF), however this is just a few bytes per second.
  4. The AVR can also be used to implement the switch-mode power supply needed to generate a ring voltage in software (DC-DC converter). If this is not possible, we can connect a buzzer/beeper to the AVR. Instead of the phone ringing, we beep the (nearby) ATA. Usually ATAs are located close to the phone.
  5. We use the AVRs built in A/D and D/A to convert the analog signal.
  6. Use a DC “battery” voltage of 12VDC rather than 48VDC to run the phone – this is enough if the cable is only a few meters, phone only require about 6V, the 48VDC is there to overcome resistive losses on long cables.
  7. The router runs Asterisk (common on WRT54G-class routers). Asterisk talks to the ATA via USB/RS232 using a simple channel driver, for example something similar to chan_oss. The ATA is really not much more than a sound blaster – we push most of the processing to the router, which has a few more spare MIPS.
  8. Handle echo cancellation using echo training and fixed coefficients for the duration of the call. This is a low-MIPS approach that we can get away with due to the special nature of FXS lines. More on this below.
  9. Use a very simple hybrid (just an op-amp), and let the echo canceller do most of the work in separating the transmit and receive signals. We essentially move the hybrid from hardware into software, where it is free to implement.

Echo Cancellation

An FXS port is a special, rather well behaved case which fortunately is kind to echo cancellers. Cable runs are generally short (a few meters of cable) and the impedance match quite close to the ideal. This means only a short tail is required, perhaps only 8ms (64 taps).

Some other simplifications are possible. The echo path is unlikely to change during a call, so we can fix the echo canceller taps for the duration of the call. This removes about two thirds of the MIPS which are normally required to support continuous adaption.

Assuming fixed coefficients and a 64 tap FIR filter, the number of operations is 64 taps x 8000 samples/second x 5 ops/filter tap = 2.56 MIPS. This is acceptable on a 10-20 MIPS AVR. A specialised DSP chip would require just 1 operation per filter tap, however I am estimating 5 operations/filter tap for the AVR.

I have tested the fixed coefficient technique on FXS ports in the past and it works quite well when teamed with a simple echo suppressor to remove the small amount of residual echo. The filter taps can be calculated when the phone is taken off hook by sending an impulse down the line. This is the same algorithm as used by the Zaptel echo canceller when in “echotrain” mode.

Risks

There are several risks with the proposed $10 ATA design. Here is my current risk list:

  1. Speech quality through AVR A/D and D/A. What sort of anti-aliasing filters and reconstruction filter should we use (if any)? Should we over sample to reduce analog filtering requirements and possibly increase effective resolution e.g. via noise shaping in DSP? Will the A/D and D/A resolution deliver reasonable speech quality? Will we require some AGC to cope with the limited dynamic range of The A/D and D/A? Do we use companded (mulaw) over the RS232/USB link or linear?
  2. Will we run out of MIPS on the AVR or router?
  3. The AVR based DC-DC converter for ring generation. I am not familiar with DC-DC converters, however the plan is to use a similar topology to the Silicon Labs 3210, i.e. use the AVR to generate PWM that drives a switching transistor, with several safety cut outs. An alternative is to use a simple beeper, with tones generated by the AVR. This would be cheaper and faster to develop, but would only work when the ATA was close to the telephone.

An RS232 Phone

In many parts of the world analog phones are very cheap, for example in Vietnam they are about $2. This is one reason why a low cost ATA makes so much sense compared to even the cheapest SIP phone.

However there is another approach. We could use a $2 phone case, keypad and handset and put our own electronics inside. Sort of make our own “IP phone”. However it talks RS232 rather than SIP. The advantage of this approach is that we avoid most of the hassle in an ATA, i.e. dealing with the FXS interface (ring voltages, echo, 2 to four wire conversion). The microcontroller could be simpler, too.

So I thought I would mention the option of modifying a regular analog phone. It might just be cheaper and certainly less development effort. Perhaps both the $10 ATA and RS232 phone could be developed in parallel, as they share many subsystems.

Development Plan

I suggest that a staged approach to implementation be performed. We should attack the risky areas first to prove the feasibility. Here are the milestones:

  1. Milestone 1: Implement a RS232 sound blaster. Use the AVR A/D to sample speech from a phone handset, and play back speech to the handset. Connect to the router via RS232. Modify chan_oss to allow speech I/O from the RS232 port. Do not implement DTMF, echo can, or ringing power supply just yet. Control from the Asterisk CLI. The idea of this milestone is to confirm that the AVR can handle speech traffic via RS232 and that it sounds OK when teamed with Asterisk.
  2. Milestone 2: Add DTMF and echo cancellation, and implement the analog hybrid. Use a beeper for ringing, no DC-DC converter just yet. At this point we have a design that can be used in a $10 ATA of a RS232 phone.
  3. Milestone 3: Develop the ringing DC-DC converter and integrate.

Interested in Working on a $10 ATA?

I would really appreciate some help with this project, as I am kinda busy with a bunch of other stuff. People with experience or just plain interested in OpenWRT, Asterisk, channel drivers, AVR, and analog hardware development would be very welcome. In the mean time I will work on it on a part time basis.

The cool thing about this project is that the cost of entry is very low (by definition) and the hardware can be developed using plug-in bread board (no soldering required). This work also has the potential to help millions of people in the developing world get a telephone, so it is a very worthwhile project.

Please join our low cost ATA mailing list or contact David Rowe.

Ideas for Further Work

This work could be extended to multiple FXS ports with a more powerful DSP. For example if this design works, then a a $14 (Quantity 1 price) BF531 DSP chip could be used rather than a AVR. The Blackfin can run programs from internal memory requiring only a $1 SPI flash chip to boot. This DSP could handle multiple channels and possibly implement GSM or G729 compression as well. Perhaps a 8 channel FXS channel bank can be built this way for $30. This could serve a remote village, connected via the router using wireless Internet.

The $10 price point is for low volume. Imagine the possibilities given volume production. There are billions of people who need a telephone, and they have some of the cheapest labour on the planet. The circuit is simple and can be assembled by just about anyone. With a market this size, custom silicon is a possibility, which would allow us to further integrate functions into the chip.

So the possibilities for price reduction are endless. Ultimately the electronics is just sand, a little labour, and an open design.

Links

$10 ATA Part 2

sexxx africa picsamiture cupels teensale for porn 1980 1970 moviesinformation addiction cybersexporn amature gymnast xxxvideo sex titmus abiaba teenagers withamerican daydreams porn Mapactrices pornoamateaur pornsenior sex amateur videosa transexual am itgp teen winters abby naturalmotel sex amatureteen age reason models ofbusiness process analysis airline Maploan about debt consolidationloan site add car5 5 loan autoloan credit a badmortgage home loans accessbankruptcy loans 13 studentbusiness small 26 loanloan personal hours 24 MapOrgasmus Soundclip WeiblicheGalerie Mütter Fett hässlichtranny Video Fuck TS sexFrauen Behaarte nackt FotoSharing-Swapping Frau Hahnereiteens petite YouhngSex Interrassisch Geheimnis dunkles Hahnerei GeschichtenBrustwarzen Nippel Laktierenden laktierenden Folter, Map

37 thoughts on “A $10 ATA”

  1. Very interesting thoughts!, but you only mention FXS interfaces.
    Would it also be possible to build such cheap FXO ata’s?

  2. excellent. rural community is also our target in Indonesia.
    for ATA, maybe you should consider TJ560C VoIP processor with USB interface. it’s about $15 each in 10 qty, but will reduce

  3. Good point Steve – a USB phone is a great approach to the same goal, if you can buy one for $10 (I can’t BTW). A similar approach is to use a USB sound blaster and a headset, although u still need to add a keypad/ringer.

    Compared to USB: RS232, Ethernet and an analog phone/ATA can be located far away from the router. This is significant in some developing world applications, for example where the router is 20-100M away up a tower, which is often neccesary to get a low loss coax connection between the router and the high gain antenna. With USB the “phone” must be quite close to the router.

    Also many low cost routers don’t have USB.

  4. You might not get very fancy USB VoIP phones for US$10, but there are plenty of simple ones which retail for less than that. Its true a lot of routers don’t have a USB socket, but I never met a single one with a usable RS232C port. Lots of ATAs have RS232C ports, but it seems routers don’t. Ethernet would require pretty much a full ATA, and you would be looking at something higher than US$10 – may US$20 – to build one of those.

    Your RS232C interface would have to run at a fairly high speed, since you won’t be putting a high compute load codec in your cheap adaptor. That won’t perform well over a long cable run. I guess what you would really do is put your gadget up the pole, and run a longer loop to the phone. You’ve got to power an RS232C gadget, adding a couple of dollars to its cost. Its will also require an extra power socket, which makes this messier and less reliable. A USB device avoids that extra power supply.
    Most routers do actually have a USB interface inside, though only a few of them provide an external socket.

  5. Thanks Steve.

    Actually with a USB hub it may be possible to run multiple USB phones on a single router.

    Re RS232, routers like the WRT54G have 3V3 RS232 signals, this would need line drivers to make it useful as u suggest, and yes we would need to carefully check if the 115 kbps can make it over 100m of cable. For short runs, we could just use unbuffered 3V3 logic. Another risk (pointed out by a friend) is the quality of the UARTs on the routers – the UART/driver needs to be low latency and interrupt driven.

    A short USB link to the ATA, then FXS two wire for the long run is a possible solution.

    On another topic a friend of mine has also suggested a DSPIC chip as a possiblity – these are < $5 in Qty 1 from Digikey and have significantly more DSP capability than an AVR, for example a version of Speex has been ported to them.

  6. Yahel,

    In your blog you say your routers all have RS232C, but don’t have USB. I really doubt that is true. You seem to be refering to UARTs available inside the box, rather than real RS232C connectors on the outside. In the same, way pretty much every router has USB somewhere inside. Only a few, like the ASUS ones, actually bring this out to a socket. You might need to add a few cheap components with the USB socket, but not many. Then you have the benefit is not needing to build anything else. and having simple plug and play operation.

    So, what you seem to need is an FXO USB box, that can plug into a connector added to your router. Then you have a simple setup with a single power supply. Want another port? Add a USB hub. and you can probably have several FXS ports before you need a separate power supply.

    FXS USB boxes retail for

  7. Hi all,

    David, this sounds like a great project. I’d love to help out, although I don’t have any experience with telephony projects to date.

    With regards to the USB-vs-RS232 points, Steve, I know a lot of newer routers are starting to come out with USB ports, either stock or hackable, but I haven’t been able to find a documented hack for my WRT54G v2.2 that I bought a year or two ago (though I’ll be pulling it apart and checking myself now, just to make sure!). Regardless, if the USB cables are going to cost $100 to get down the mast (from Yahel’s blog) then it’s a moot point anyway.

    Is there are reason you’re not thinking of using the USB phone plugged into the computer itself? It adds another level of inconvenience, in that the computer must always be on to use the phone, but would make it easier to allow multiple phone calls from more advanced handsets, as per Yahel’s post. Two possible problems of course are the computer hardware itself (what is the typical machine like?) and the cost, I’m not sure of the final price of the handsets (even US$10 handsets) after delivery.

  8. Hi Matt,

    Pls contact me directly david_at_rowetel_dot_com and lets see if we can work out a way you can help. The lack of telephony experience is not a problem – this is a great way to learn :-) If you like, start with installing Asterisk on your x86 or via OpenWRT on your WRT54G.

    Plugging directly into the PC is a good idea, I will forward your comment to Yahel to field – his team installs these routers in the field. Perhaps in some cases it’s a power issue – many of these remote sites can’t run a PC all day long.

    I guess an analog phone plugged into an ATA is probably a nicer, more reliable user experience than say depending on certain software always running on a Windows PC.

  9. Great Matt..

    I would also suggest you begin by diving into Asterisk – but I would not start with it on the WRT unit – a Linux PC is a good place to start and learn…

    Sure – we can use USB-phones, they fall under my definition of a software phone – and we do use many… The problem, like you have pointed out is the PC – some places don’t have them and others don’t have power for running it long time… and other just don’t like them… Telephony should be a simple things, not to mention urgent, and ready for emergencies… should work for days without power (very common here) etc..

    Hence, USB phones (even if there are for $10 – which I’m yet to find) are not a replacement for the real thing….

    Thanks !

    Yahel.
    Dharamsala.

  10. Hi Stan,

    Nice to hear from you again since Dharamsala! I checked out those links, the grynx site also has some interesting transformerless designs. Its an OK 2-4 wire interface for the audio I/O but leaves a few issues open, such as the echo canceller required by the 2-4 wire converter and ringing the phone. Thanks for the links.

    Cheers,

    David

  11. Hi David,

    Its quite interesting topic, its a challenging idea but from the business point of view I think Steve is right, these chinese USB phones are great choices for organizations like tibtec.

    Regards.

  12. Why not to use ethernet?
    PHY chip (i.e. RTL8201BL) costs about $1 and require 2.5M iterrupts/s in 10Mbps MII mode. Good chance for 20Mhz AVR ho handle this directly. For sure it will not handle full SIP/RTP, but but maybe it can do some extremely simple L2 fixed-frame-size protocol, that will be processed to SIP/RTP in asterisk@WRT.

  13. That is an interesting suggestion. A PHY chip would lower the interrupt rate. We have looked at Ethernet, one problem is a large amount of RAM (well large for a AVR) is required for a packet buffer, unless we can guarantee the packets are very short.

    Another approach for Ethernet is to use an Ethernet-PIC, I have ordered some samples.

    There is some discussion of Ethernet on the $10 ATA google group.

  14. If distance is a consideration, why not consider RS485? Its very popular in industrial automation, cheap, interference-tolerant and can span 1.2km(4000ft)

  15. Dear David!
    I am from Viet Nam. I want to make my own ATA but I have’t enough experience. Please help me ? if you sell your ATA design, what its cost?

  16. Dear David!
    I am from Viet Nam. I want to make my own ATA but I have’t enough experience. Please help me ? if you sell your ATA design, what its cost?
    my mail address: dra_tuan@yahoo.com
    please answer me as soon as possible.

  17. Hi Pham,

    Well we are working on designing an ATA with this project. I am not sure exactly what the cost will be. Subscribe to the Google group mentioned above if you would like to keep track of this project.

    Cheers,

    David

  18. Dear Sir ,

    we are keen on to set up with you telecommunication contracting opportunities company at Ivory Coast with The tremendous growth of today’s communications infrastructure has created an increase demand on Telecom Operators to construct new facilities to house their critical systems. Getting facilities constructed on-line quickly is the key to success.
    provide the best and fastest infra-structural solutions for sophisticated equipments.
    add also if we can set up a relationship with
    you it will be very profitable for Africa .

    The Future of open sources hardware is at Africa
    we need it and we can work on it as you worte :

    remote village to “get connected” .

    We are ready to meet you with our Company CEO .
    We are ready to work with in any business spots .

    Best Regards ,

    Kone

    Tel : 0022501542607

  19. Great ideas !

    I too am really interested in making cheaper calls available to rural Nepal. Could you tell us about the status of product i.e? ATA

  20. Hi Gajendra,

    The $10 ATA has progressed OK over the past year, I have various parts of the hardware and software working. The Google group details progress. I haven’t done much work on the project since January (when I blew up my AVR chip).

    I plan to get the project to a viable state later this year.

    – David

  21. Hi guys,

    I am planning to set-up a (openmrs) Medical Record System for a small clinic in a Kenyan village. I am thinking of hosting the actual system here in US and providing cheap computers (prob refurbished) over the net to work as terminals. This way i can do the maintenance of the system from here.
    Can you guys suggest a cheap way to get on the net? especially considering lack of electricity in the village.

    -praveen

  22. hi David,

    i m quite interested in your project , basically i m a asterisk and channel driver developer since 2 years, but i dont have any idea about hardware. so can you plz tell me how i can help u in this project, which part u can give me to develop.

    Thax

    vbvb

  23. Hello vbvb,

    Not sure if it matches your skill set, but the best area to work in right now is the microcontroller software.

    – David

  24. In Perth we have something similar, called Freenet. It’s basically the same, using wireless routers or cards with high gain antennas, and custom firmware (to deal with the latency issues, iirc). Unfortunately there isn’t much particpiation, as it’s all wifi enthusiasts who bother to set up such a thing, and there’s no real central steering.

    But they’ve done pretty good work. One thing that comes to mind is a (temporary) link from the perth hills to Rottnest island, which is some 50km! With only off the shelf wifi cards and home made high gain antennas.

  25. Very interesting project !

    But how is it going, any progress ?
    I would be very interested in low cost ATA boxes to bring out low cost VoiP services to poor people.

Comments are closed.