I'm think this is the most appropriate category, however please feel free to move if needed so.
I'm busy with a project where my Uno will send a "command" over the serial port to an attached device that will in turn send out a SMS over the cellular network.
I've been battling quite a bit and after some help from the manufacturer of the GSM module I have discovered that the serial port is not communicating as expected.
The command that I'm needing to be send out is as follows *SMSTX:0831231234:This is the message#
The arduino is programmed to output the "command" when a specific pin is active high. Therefore when the button is pressed it will send the above command out over the serial port.
I've used the following code to "send" the "command" over the serial port.
Serial.print("*SMSTX:0831231234:This is the message#");
Now while monitoring it over the Arduino software Serial Monitor it works fine and I receive the *SMSTX:0831231234:This is the message# however if I plug the TX/RX pins of the arduino to a RS232 Lever Shifter and in turn plug the DB9 of the Lever Shifter to a serial port (usb to serial adapter) on my laptop and I run SuperTerm serial monitor I get only a couple letters, in random order, from the command line. EG SX, MSX, XT, or similar. Clearly this is why the GSM module it not sending out the SMS as expected. I have confirm that the GSM module is working correctly, as if I send SEND <*SMSTX:0821231234:This is the massage# from the SuperTerm terminal, the unit send out the SMS.
I've verified that all baudrates are correct and matching.
Can you give a link to that sms-module ?
Is it expecting ttl-level signals, or rs232 level (normal, or low voltage).
What is the baudrate ?
The TX of the Arduino should probably be connected to the RX of the sms-module.
Can you check everything once more: baud rate, no parity, 8 bits. No handshake (not hardware, and not software).
If you send something to the serial monitor, that should be the same as using the TX/RX pins, and via adapter to the computer. Can you try to make that work. Do you have an old PC with a serial port perhaps. Or try a different program.
If everything fails, you could try SoftwareSerial. That emulates a serial port on any pin. That way you can use the serial monitor of the Arduino (with normal RX/TX pins), and send messages to the sms device (with SoftwareSerial) at the same time.
The SoftwareSerial is a standard library. http://arduino.cc/hu/Reference/SoftwareSerial
The Rx and Tx lines are also connected to the USB chip on the Arduino, this sometimes causes problems but if you are just transmitting I think it should work. In fact you should see the same data on the IDE serial monitor as the terminal program. Try running both at once to verify that.
Otherwise try all the stuff Krodal said.
Also note that you will probably have to disconnect the level shifter to reprogram the Arduino.
According to the document at page 34 : "Signaling levels: RS232".
So it does need the higher levels of the original RS232.
So first make sure the level converter is working.
Can you upload a schematic of the level converter ? The RX of the Arduino is also influenced by its own serial-to-usb-converter. The level converter has to override that.
Well, that might be the problem.
The level shifter receives a the higher level correctly.
But it transmit only a 5V level, it does not create the higher levels for output.
You need a board with the MAX232, that's what everyone is using.
Wrong guys, since when was 0-5v anything like RS-232 levels. I know it often works and people have fudged it for years, but you can't make the above claim on a product.
They do have a clever trick with the diode and cap, but really, just use the right chip.
..based on the manual they talk about rs232 levels, and they describe the connection to the classic db9 rs232 socket. That indicates rs232 levels (log1=-3V and less, log0=3V and more). The sparkfun shifter shall work if that is true (I used that design with diode and cap 30y ago - in order to work properly it requires -3V or less on the GSM's TX pin in idle). If the sparkfun shifter does not work, the rs232 on the GSM module might have not got the logic levels as assumed. The best way to handle that is to measure the Tx level (against GND) on the GSM's module db9-socket with a voltmeter (do not send any data). You have to read -3V or less at the TX pin in idle.
PS: it happens the hw makers are talking about rs232, but using the ttl/cmos voltage levels.. as for them the rs232 means "the serial" only.. (ie. ~0Volt for rs232_log1 and +3 to +5V for rs232_log0, many notebooks accept(ed) that easily/happily)
Ok, so now I'm even more confused..... Tried the MAX232 and still nothing!
**** To recap my findings! ****
When the Arduino send on its Serial the IDE displays the correct info every time.
Voltage on TX wire from MAX232 = -7.5V (to GSM module)
Voltage on Pin2 (TX) of the DB9 from the GSM module -7V (to MAX232)
I've tried running off ext power source to remove possible problem from USB interface, doesn't help.
If I use my USB Serial Adaptor to monitor the output from the Arduino (after the Level Shifter or MAX232) depending on which program I'm running I get conflicting results. With SuperTerm terminal I get rubbish, but if I use Hyperterminal I get the correct data.
Both using the same USB Serial Adapter.
Both running the same Com (set on com1 where the adapter to)
Both running same settings, 38400, 8, N, 1.
If I use SuperTerm to send the command ( SEND <*SMSTX:0821231234:message#> to the GSM module, it works and the GSM module sends the message.
It appear the GSM module is "seeing" the same as SuperTerm?
..what does it mean (super term in red): COM1 is currently in use by another application? Running two terminals in parallel on the same COM is not good..
.. CR and LF handling?
.. hw/xon/xoff/none flow control?
.. transmit delays
..
And tonight the STUPID Person Award goes tooo.........LightSA.....me!!!
I'm really feeling so STUPID right now! you couldn't even imagine!
After being told to to confirm wiring and triple checking it I still made a school boy error! If I could, I would really kick myself now!
The error come in by making the cable for the GSM module, I used a male plug so I could plug it in directly to the level shifter, and elimating the serial connection cable, which means I had the TX to TX and RX to RX......
I would just like to thank everyone for their assistance and patience with helping me!