Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Interfacing gsm module with pic via mikroc pro

Status
Not open for further replies.

ComputerAngel

Junior Member level 2
Joined
May 28, 2017
Messages
22
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
202
Hello, I have been trying to send sms via PIC but i have not been able to do just that. I simulated it in proteus to see if the PIC16F887 was actually transmitting and it worked out just fine. I used voltage divider circuit to step down the output voltage of the Tx of the PIC to the Rx of the module but still didn't work. I tried three diodes in series but did't work as well. Do i have to MAX232 or there is another alternative? p.pngScreenshot (278).png

There is nothing wrong with the codes right?
 

Hi,

The shown circuit is useless, because it doesn't show the problem/circuit you describe.

It should be no problem with your simulation tool to follow the signal step by step and verify the voltage levels.
And there will be a lot of correctly working code in the internet.

Klaus
 

I didn't show the circuit. The circuit you see was just to simulate the codes to see if the microcontroller was actually transmitting. I connected three diodes in a forward biased direction from the microcontroller Tx to the GSM's Rx so as to step down the voltage level
 

In all the AT commands sending function calls the terminating character '\r' is missing. You have to send commands like "AT\r\n".
 

There are many reasons why code will run in a simulator and not in real hardware (one of the reasons to not trust simulators in my opinion).
You need to show us the actual schematic you are using (including all of the required hardware components) and also the full code (including the config settings).
Also try using a scope and/or an interactive debugger to make sure that the code is running and actually sending out the signals you think it should.
If the MCU and GSM module use different voltages, then a resistor divider can be used for the step-down but if a response is required from the GSM module (i.e. a voltage step-up) then I wold recommend using a proper signal level shifter - the are very cheap and do the job every time (even in one-off test circuits).
Susan
 
proxy-1.png


Here is the connection I did. It still didn't work. I thought the gsm module was faulty so I tried it with Arduino and it worked fine. I initially powered the module a with 1A power supply, thought that was the problem since it drains up to almost 2.5A while transmitting so I powered it from the Arduino board since it had no problem with Arduino but still nothing. I took the Tx pin of the PIC16F887 am using and connecfed it to an LED to observe the tramission. The LED remain ON after blinking about three to four times. I have rewritten the codes in so many ways but still nothing. Could you help me please?

- - - Updated - - -

Help me out please. I have tried debugging it but failed. I also forgot to ask, is the Tx pin suppose to remain ON even when it's not transmitting anything?
 
Last edited:

Hi,

Review the UART wiring.
You marked one line: Rx -- Tx -- RX
And the other: Tx -- Rx--Tx

But it should be Tx -- Rx and Rx --Tx

If we should verify your power supply you need to show us.

Klaus
 

The connection is
From PIC16f887 ==> Tx -->Rx[input of max232]-->Tx[output of max232]-->Rx
From PIC16f887==>Rx-->Tx-->Rx-->Tx.
 

Do you have two MAX232 or just one ? You need one MAX232 on the PIC side and another MAX232 on the GSM module side.
 

Using MAX232 for PIC to SIM900 interface is just erroneous.

MAX232 is a TTL to +/-10V RS-232 level converter, but you need level conversion between PIC 5V and SIM900 3V logic. Even using two back-to-back MA232 can't solve the issue because MAX232 is a 5V device. As suggested by Aussie Susan, the minimal solution is a voltage divider for SIM900 RX and a 5V buffer IC with 3V compatible logic input, e.g. 74HCT series. PIC16F887 RX pin has ST input type and doesn't operate reliably with 3V logic signal.
 
Please do not use terms such as "but it failed". When you tried to debug the code, what did you use - which debugger and how was it connected? (I ask because the PGD and PGC lines would appear to also be connected to the LCD and the circuit on the \MCLR\ line may not be able to drag the pin down, depending on the debugger in use. Can you program the chip successfully with the same connection?)
I would doubt that putting a LED on the Tx line wold show you anything. According to the data sheet I've seen for the SIM900A, the serial interface runs between 1200 BAUD and 57600 BAUD. Even as 1200 BAUD, each bit would cause the LED to flash for about 1msec which is far to fast for the human eye to see (we can see individual flashes down to about 30msec). You need a scope on the line to see what is happening.
The standard 'idle' state is "mark" which is also the standard 'Stop" bit state. The 'Start ' bit is a "space" and it is the transition from the idle'previous stop bit to the start bit that is used to trigger off the beginning of a new character. Further, the standard for the TTL signals is for the "mark" to be a 1 or high voltage and the "space" to be a 0 or low voltage. (When "mark" and "space" are translated to the RS232 voltage levels then these voltages change which is why the MAX232 is of no use to you in this application.)
So yes, the Tx line will be high when nothing is being sent.
Susan
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top