arms22 / SoftModem

Audio Jack Modem Library for Arduino
BSD 3-Clause "New" or "Revised" License
184 stars 36 forks source link

SoftModem

SoftModem

SoftModem is a wired, low-cost and platform independent solution for communication between an Arduino and mobile phones. It uses the phone's audio jack and Bell 202 modem-like FSK encoding with up to 1225 bit/s. Check out this blog post.

Projects based on SoftModem:

Install via Arduino Library Manager

Open the Arduino Library Manager from the menu: Sketch → Include Library → Manage Libraries.... Then search for 'SoftModem' and click install.

Manual install

Create a folder 'SoftModem' inside your libraries folder and place these files there.

Supported Boards

Board TX pin RX pin AIN1 pin Timer Notes
Arduino Uno 3 6 7 2

Usage

This is an example sketch that forwards data to/from the serial port.

#include <SoftModem.h>

SoftModem modem = SoftModem();

void setup() {
  Serial.begin(115200);
  Serial.println("Booting");
  delay(100);
  modem.begin();
}

void loop() {  
  while(modem.available()){
    int c = modem.read();
    if(isprint(c)){
      Serial.print((char)c);
    }
    else{
      Serial.print("(");
      Serial.print(c,HEX);
      Serial.println(")");      
    }
  }
  if(Serial.available()){
    modem.write(0xff);
    while(Serial.available()){
      char c = Serial.read();
      modem.write(c);
    }
  }
}

Notes

SoftModem uses Timer2, therefore you can not make use of the analogWrite() function for pins 3 and 11 in your sketch.

Hardware

A shield is available here or here. You can also build your own. Here is the schematic:

Schematic

License

BSD 3