Articles Hierarchy

Articles Home » Arduino Projects » ARDUINO PROJECT: SERIAL LINK MODEM

ARDUINO PROJECT: SERIAL LINK MODEM


following this idea using a modem to send ALARM SMS
using the NewSoftSerial.h




STEP 1:
i start testing the serial communication.
if you transmit data out of a Dout ( 3 ) how to check it works?
i was used to do it by a loop back cable to get a ECHO
but that does not work here.
Also a multimeter is not much use, ( AC volt see some jumping )
so i build a communication partner for testing: i loaded my DIY DUINO with a ECHO program.
and wired (D2) .. (D3) and (D3) to (D2).




the arduino terminal on the master ( UNO ) for type text,
the HTERM for check slave diagnostic
and the data come back to arduino terminal.



master
#include
NewSoftSerial m32_serial(2, 3); // Order is input pin, output pin

void setup() {
Serial.begin(9600);
Serial.println("Arduino has booted.");
m32_serial.begin(9600);
Serial.print("lib version: ");
Serial.println( NewSoftSerial::library_version() );
}

void loop() {
if ( m32_serial.available() ) { Serial.print((char)m32_serial.read()); }
if ( Serial.available() ) { m32_serial.print((char)Serial.read()); }
}


slave
#include
NewSoftSerial slave_serial(2, 3); // Order is input pin, output pin
char myChar = 'A';
//char myChar = 65; // both are equivalent

void setup() {
Serial.begin(9600);
Serial.println("Arduino slave has booted.");
slave_serial.begin(9600);
Serial.print("lib version: ");
Serial.println( NewSoftSerial::library_version() );
} // end setup

void loop() {

if ( slave_serial.available() ) {
myChar = (char)slave_serial.read();
Serial.print(myChar);
//slave_serial.print("RX: ");
slave_serial.print(myChar); // ECHO
}
} // end loop


STEP 2:
connecting the modem seems to be a problem,
on 2 webpages many comments but not one what states that it works.
the shown circuits are mentioned need to be changed, regarding a RX TX change.




when i got the modem the USB chip was already removed,
and internally already 2 cables soldered between PAD1, PAD5 of the removed chip
and the USB port.
and a USB cable ( one side for soldering) was provided, so no free wiring required.



__________USB (1) Red -> USB 5V
ARDUINO D2 USB (2) White -> Pad 5
ARDUINO D3 protection circuit, USB (3) Green -> Pad 1
__________USB (4) Black -> USB GND

so via that USB cable we now run the serial TTL signal between ARDUINO and MODEM CHIP.

first tests with hterm and arduino negativ.
some echo from modem have occurred ??
most time the terminal not show any reaction
on typing [ENTER] or AT[ENTER]
but with my new serial monitor equipment ( cable from D2 of DIY DUINO )
i found that UNO is sending on D3, i could read also same signal after resistor network
D3..10k..(10kto GND)..green usb cable..PAD1 ( only 2.4V level )
and i could see modem answering to D2 ???
means while the probe cable to D2 DIY DUINO works, D2 of UNO not work!
( note while all testing i used cable between the 2 arduinos for D2,D3,
no ground cable, both on USB of same computer ( what gives a common 5V and ground )
means the receiving signal must be just on the limit not to be seen, a voltmeter say 5V ?UPS?
we wanted to protect the modem and install a resistor network on D3 (sending)
but not on D2 where UNO sends 5V?? must be that the library installs the PULL UP??

NewSoftSerial

void NewSoftSerial::setRX(uint8_t rx)
{
pinMode(rx, INPUT);
if (!_inverse_logic)
digitalWrite(rx, HIGH); // pullup for normal logic!
_receivePin = rx;
_receiveBitMask = digitalPinToBitMask(rx);
uint8_t port = digitalPinToPort(rx);
_receivePortRegister = portInputRegister(port);
}



but a test with a modified version of the lib shows that without pullup and no active
RS232 partner connected get constantly garbage.

the hardware spec for RX TX :
M32 GSM / GPRS Wireless Module

17 TXD RS232: transmit data DIGOUT
(Voh) 2.24V
(Vol) 0.616V
Rated current 4 mA


18 RXD RS232: receive data DIGIN
(Vih) 1.96 3.3V
(Vil) -0.5 0.84V
Rated current 1 mA


but

with this setup a TTL serial link signals must be bad.


STEP 3:
TERMINAL
OK
AT+CGMR

SW ver: 1.80

HW ver: 1.00

FS ver: 1.00

Build Date: 2004/6/25

Build Time: 18:40:37



ok after that and making a better cable ( actually the resistors should be
near to modem ( or inside))
i looked for some code for send a
SMS
void send_SMS() {
m32_serial.print(0xD,BYTE); // CR
delay(500);
// here should check for the "OK"..or do again
m32_serial.print("AT+CMGF=1"); // set the SMS mode to text
m32_serial.print(0xD,BYTE); // CR
delay(1500);
m32_serial.print("AT+CMGS="); // send the SMS the number
m32_serial.print(34,BYTE); // send the " char
m32_serial.print("+66********"); // send to number
m32_serial.print(34,BYTE); // send the " char
m32_serial.print(0xD,BYTE); // CR
delay(1500);
m32_serial.print("ARDUINO ROCKS"); // the SMS body
delay(500);
m32_serial.print(0x1A,BYTE); // end of message command 1A (hex)
m32_serial.print(0xD,BYTE); // CR
} // end send_SMS


included only a few lines and started from setup of the serial test program.
and i got the SMS on the first try!

i am good or i am lucky, anyway its FUN!

now back with what we learned to the POWER MONITOR PROJECT
not used info
using for testing a true move sim
TRUE MOVE THAILAND message center number +66891009120