- KEYWORDS: Internet,GSM,GPRS,2G,3G,Mobile,HTTP,SIM900,SIM900A,SIM800,SIM800L,SIMcom
- USES: AT
The SIM900 is a GSM/GPRS module that can provide internet access via an AT command set.
Support is provided in Espruino by the [[SIM900.js]] module.
Both SIM900 and SIM900A use the same command set and so are compatible with this Espruino driver, however SIM900A is dual band (often locked to Asia), while SIM900 is quad band.
Note: Many SIM900A modules only work in Asia - see this site for details on how to modify them
If you want more information, or need to send your own commands to the SIM900 module, check out the SIM900 AT Command Manual
Pin | Espruino | Pico | Notes |
---|---|---|---|
VCC5 | Bat | 5V/VCC | 5V input |
VCCMCU | 3.3v | 3.3v | 3.3v input |
GND | GND | GND | |
RST | B4 | B4 | Reset Pin |
SIMR | B6 | B6 | Serial data Espruino -> SIM900 |
SIMT | B7 | B7 | Serial data SIM900 -> Espruino |
Once wired up, power is applied, and the PWR
button is held down for 2 seconds a 'Network Connection' LED should flash every second to show that the SIM900 is trying to connect. Once connected, the light will slow down to flashing every 3 seconds and the SIM900 is ready to use.
Note: If the SIM800/SIM900 powers down after a few seconds of flashing, check your battery/power supply. These modules draw a lot of peak power, and will shut themselves down if your battery is unable to provide enough.
Just use something like the following for the Espruino Pico:
Serial1.setup(115200, { rx: B7, tx : B6 });
console.log("Connecting to SIM900 module");
var gprs = require('SIM900').connect(Serial1, B4 /*reset*/, function(err) {
if(!err) {
gprs.connect('APN', 'USERNAME', 'PASSWORD', function(err) {
console.log(err);
gprs.getIP(function(err, ip) {
console.log('IP:' + ip);
require("http").get("http://www.pur3.co.uk/hello.txt", function(res) {
console.log("Response: ",res);
res.on('data', function(d) {
console.log("--->"+d);
});
});
});
});
} else {
console.log(err);
}
});
gprs.at
The AT command handler - use this to send your own AT commands to the SIM900
You can also call gprs.at.debug()
to return debugging information and to turn
on debug messages.
gprs.debug()
Return information on open sockets and received data.
gprs.init(function(err) { ... })
Initialise WiFi settings - you shouldn't ever need to call this. The callback is called with err==null
on success.
gprs.reset(function(err) { ... });
Reset the SIM900 by pulsing the RST wire.
gprs.getVersion(function(err, version) { ... });
Call the callback with the version number reported back from the AT+GMR
command. The callback is called with err==null
on success.
gprs.connect(access_point_name, username, password, function(err) { ... });
Connect to the given access point - you'll have to find out which details to use from your mobile operator. The callback is called with err==null
on success.
wifi.getIP(function(err, ip) { ... });
Call the callback with the current IP address, as a String. The callback is called with err==null
on success.
- APPEND_USES: SIM900,SIM900A