Skip to content

Talk to GSM modem SIMCOM via Node

Notifications You must be signed in to change notification settings

davidlinner/simcom

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simcom

Talk to GSM modem from SIMCOM via serial port using Node

This module was written with Raspberry Pi aspect in mind, but it basically should work on all linux distros, it might work on Windows as well (not tested yet), you just need a serial port filesystem (/dev/ttyAMA0 for RPi).

It has been tested on SIM800L module.

About this fork: Dependency on deprecated package 'buffertools' was removed. Package was tested successfully with Windows 10 and SIM7000E module.

Installation

npm install simcom

Example

Openning the port

var modem = require('simcom').modem('/dev/ttyAMA0');

modem.on('open', function() {
  // do something with the modem
});

modem.error('error', function() {

});

modem.open(); // open the port

The modem function is a factory function, it creates an instance of Modem class for a device if neccessary.

Sending raw data

Talk directly to the modem using Modem.write() method.

modem.write('ATI\r');

Executing a command

Modem.execute() returns a promise which you can easily setup callbacks to process the response or error.

modem.execute('ATI').then(function(lines) {
  console.log('ATI Response', lines);
}, function(error) {
  console.error('ATI Command Error', error);
});

About

Talk to GSM modem SIMCOM via Node

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%