Can't communicate with SIM900a from PC via TTL - gsm

I've connected my SIM900a module with PC by using a TTL converter. I've tried two or three terminal (including putty and TMFT) to communicate with this module. But none of them are working. I can't even write anything on these terminal! What am I doing wrong here?

Connect your PC's TX pin to RX pin of SIM900A and PC's RX pin to TX pin of SIM900A.
You also need to connect your TTL converter's power supply to VMCU pin. This is generally the voltage level of your UART TX & RX pins.
You may also needs to ground the PWRKEY for a second or two to turn the module on.
Serial Port Settings :
Baud Rate : 9600
No. of Bits : 8
No. of Stop Bits : 1
Soft-Flow Control : None
Hard-Flow Control : None
If baud rate of 9600 doesn't work you cal also try a baud rate of 115200.
Don't forget to include carriage return character at end of each command.
e.g.
const char *at_test = "AT\r"

Related

Why Arduino reset when I check for serial port using serial.tools.list_ports in python?

Arduino will reset when DTR signal go Low usually happen when we connect to Serial port.
But when I write code in python using module serial.tools.list_ports. Arduino alway reset when I check for available port except I use Arduino port in other program.
Here my code.
def serial_ports():
return [p.device for p in serial.tools.list_ports.comports(include_links=True)]
Why I happen and how to stop it?
As you have correctly mentioned that
Arduino will reset when the DTR signal goes Low, usually happens when we connect to Serial port.
You might try connecting a 100 Ohm resistor between the 5V pin and the reset pin to stop reset signal going low with the DTR signal.

Arduino Nano no serial communication SIM800C

I am trying to get my SIM800C to talk with my Arduino. There is no communication happening, though.
#include <SoftwareSerial.h>
SoftwareSerial at(2, 3);
void setup() {
Serial.begin(9600);
at.begin(9600);
}
void loop() {
// try every 2 seconds
delay(2000);
Serial.println("sending AT ... ");
at.println("AT");
while (at.available() > 0) {
Serial.write(at.read());
}
}
I am not able to get an OK back. SIM800C is supposed to detect the baud rate by itself.
I am sure there has to be a simple stupid mistake. I just don't know what to do at this point. I obviously already checked for cable break. Out of desperation I already tried to switch RX and TX. I also tried different baud rates (whatever is within the usual limitations of SoftwareSerial) but it should automatically detect it once a couple of AT commands got in anyway.
Weird enough, the pin PWX on the SIM800C needs to be hooked up to a GND to work. It started blinking every second now and is responding to AT commands.
Also it turned out that this specific module does not ship with autobauding enabled, as stated by the SIM800C documentation. The correct baud rate is 115200.
There are some problems you need to consider:
Use below sample code which transfers data between PC and SIM. Sometimes SIM module would go into power down state and won't respond on any AT command but would print some results in the serial monitor.
As already mentioned in comments it seems that your wiring is wrong and as you declared Software Serial as SoftwareSerial at(2, 3); which means pin 2 is Rx on Arduino and should connect to Tx pin of SIM and pin 3 is Tx on Arduino and should connect to Rx pin of SIM. Please don't mess with the pins and connect the pins like below correctly.
Arduino SIM
Rx 2 ----> Tx
Tx 3 ----> Rx
I'm not sure if you can power on SIM800 with a 500mA USB connector, make sure that use an external 1/2 A power supply for VCC of SIM module.
Look at the blink speed of SIM module if it connected and powered on it would blinky with 3 seconds delay and if it blinks fast, it means that it is being restarted. Also if SIM powered on correctly it would print some info like SIM READY, CALL READY, etc.
Try other baud rates like 115200 and see if you get anything on power on.
I put some macro definition to make pin mappings more clear.
#include <SoftwareSerial.h>
//SIM800 TX is connected to Arduino D2
#define SIM800_TX_PIN 2
//SIM800 RX is connected to Arduino D3
#define SIM800_RX_PIN 3
//Create software serial object to communicate with SIM800
SoftwareSerial serialSIM800(SIM800_TX_PIN,SIM800_RX_PIN);
void setup() {
//Begin serial comunication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);
while(!Serial);
//Being serial communication witj Arduino and SIM800
serialSIM800.begin(9600);
delay(1000);
Serial.println("Setup Complete!");
}
void loop() {
//Read SIM800 output (if available) and print it in Arduino IDE Serial Monitor
if(serialSIM800.available()){
Serial.write(serialSIM800.read());
}
//Read Arduino IDE Serial Monitor inputs (if available) and send them to SIM800
if(Serial.available()){
serialSIM800.write(Serial.read());
}
}
Yes this module will not work in this configuration. There is a pin of V_TTL With 5V pin.. This pin enables the TTL logic converter of your GSM.. You have to connect this pin to 5V in case of arduino and to 3V in case of ESP8266.See the pin configuration here

Uart to RS-232 convension

I am working on a project and I use several PIC18F26K83's for this project. For communication between PIC's I use UART. Now I also need to send data with RS232 to the user. As I have understood the main difference between UART and RS-232 is voltage levels. And with PIC I cannot supply proper voltage level that is required for RS232. Because of that UART to RS232 converter's look like a must. (i.e. MAX232) I have two questions.
1) Using UART to RS232 chips is the only option in this case? Are there any alternative ways?
2) I am planning to send UART data directly to the Uart to RS232 converter chip. I do not know how they work, codewise do I need to change anything? Can I directly put UART tx data to the receive pin of these chips? Thanks beforehand.
Using UART to RS232 chips is the only option in this case? Are there
any alternative ways?
For converting from UART to RS-232, using RS-232 level-converter IC like MAX232 is the most economical, reliable and convenient approach. You can build the respective RS-232 line drivers and line receivers using discrete parts but that's not recommended for above mentioned reasons (economical, reliable and convenience).
I am planning to send UART data directly to the Uart to RS232
converter chip. I do not know how they work, codewise do I need to
change anything?
Coding wise nothing will change. Just verify taht the baud rate of your UART is supported by RS-232. Most MAX232 will operates up to 120 kbit/s and MAX3232 operates up to 250 kbit/s.
For typical connection where baud rate is generally 9600 either of IC will suffice.
Can I directly put UART tx data to the receive pin of these chips?
Your UART TX needs to connect to Logic Data Input pin of MAX232 (T1IN (Pin Number - 11) or T2IN (Pin Number - 10)).
Your UART RX needs to connect to Logic Data Output pin of MAX232 (R1OUT (Pin Number - 12) or R2OUT (Pin Number - 9)).
If you connect you UART TX to T1IN (Pin Number - 11) then you will get your RS-232 TX signal on T1OUT (Pin Number - 14) else if you connect you UART TX to T2IN (Pin Number - 10) then you will get your RS-232 TX signal on T2OUT (Pin Number - 7).
Similarly,
If you connect you UART RX to R1OUT (Pin Number - 12) then you have incoming RS-232 data/signal line should be connected to R1IN (Pin Number - 13) RS232 line data input(from remote RS232 system) or if you connect you UART RX to R2OUT (Pin Number - 9) then you have incoming RS-232 data/signal line should be connected to R2IN (Pin Number - 8) RS232 line data input(from remote RS232 system).

Sending fixed voltage to serial port

I need to monitor if a door is opened. I have a sensor that continues to generate +5V DC as long as the door is shut but drops down to 0V once the door is opened.
I now need to connect the sensor's output wire to PC's serial port and write a program that continuously polls the port.
My thought is that various serial-io parameters such as baud rate, etc., does not matter in my case. For each byte that I read, I expect the value to be 255 (logical 1s) when the door is closed. Otherwise, I will assume that the door has been opened. Is there any flaw in this logic?
I went through Sending a voltage to RS232. It appears I just need to connect the wire to pin 2 (RX). However, for the serial port to receive a logical 1, it seems the voltage needs to be between -3V and -12V. As the voltage my sensor generates is positive, I am thinking I will connect the sensor wire to pin 5 (GND) instead and connect pin 2 to ground. In effect, I inverted the voltage. Will this work?
If this logic is flawed, I may have to buy a voltage inverter.
Finally, I was told that one should not connect anything to pin 5 on a motherboard's serial port. Apparently, it is hardwired to get grounded to the chassis. Is this true? Regards.
Like mentioned in the comments, constant high would not produce 255 bytes.
I would implement this by connecting the GND to GND and connecting the +5 Vdc to the CTS pin, which can be queried for his HIGH / LOW state.
But this is only a hack, you really should use some microcontroller.

max232n with beaglebone serial

I have USB 2.0 to Serial Adapter LogiLink, which gives rs232 voltage, so I use max232n chip to get 5v, then I connected it to beagleboard J1 header and set up minicom correctly but during booting I get strange characters (like http://pastebin.com/KtCQG6jK) What can be the problem? for max232n I use power source from beaglebone, its supposed to be 5v but its 0.4v, can it be the problem? is it necessary to have DC power source to make it work
The hardware documentation for the BeagleBone Black states that
UART0 access via 6 pin 3.3V TTL Header.
and
Expansion Header Usage
There are several precautions that need to me [sic] taken when working with the expansion headers to prevent damage to the board.
ALL VOLTAGE LEVELS ARE 3.3V MAX.
"3.3V TTL" means that the UART's TxD and RxD signals are logic levels of 0 to 3.3 Volts (and not the proper RS-232 levels).
You have and are trying to connect a MAX232N converter, which is for 5V TTL.
Instead you need to be using a 3.3V converter, such as a MAX3232, to match the logic levels used on the BeagleBone Black.
Also double check that you have the baud rate, char size, parity and stop bits correct on the PC side. 115200 8N1 is typical on these embedded devices.
Note that the MAX3232 (and similar chips) should be supplied with 3.3V for Vcc when using 3.3V logic (i.e. it can work with either TTL or CMOS). Supplying 5V to a MAX3232 would be the same as using a MAX232.

Resources