+ Post New Thread
Results 1 to 12 of 12
  1. #1
    Junior Member level 1
    Points: 212, Level: 2

    Join Date
    May 2017
    Posts
    15
    Helped
    0 / 0
    Points
    212
    Level
    2

    Interfacing gsm module with pic via mikroc pro

    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?Click image for larger version. 

Name:	p.png 
Views:	9 
Size:	39.9 KB 
ID:	144588Click image for larger version. 

Name:	Screenshot (278).png 
Views:	12 
Size:	141.9 KB 
ID:	144589

    There is nothing wrong with the codes right?

  2. #2
    Super Moderator
    Points: 60,546, Level: 60
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    12,360
    Helped
    2864 / 2864
    Points
    60,546
    Level
    60

    Re: Interfacing gsm module with pic via mikroc pro

    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
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



    •   Alt15th February 2018, 07:43

      advertising

        
       

  3. #3
    Junior Member level 1
    Points: 212, Level: 2

    Join Date
    May 2017
    Posts
    15
    Helped
    0 / 0
    Points
    212
    Level
    2

    Re: Interfacing gsm module with pic via mikroc pro

    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



  4. #4
    Full Member level 5
    Points: 1,344, Level: 8

    Join Date
    Aug 2017
    Posts
    267
    Helped
    23 / 23
    Points
    1,344
    Level
    8

    Re: Interfacing gsm module with pic via mikroc pro

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



  5. #5
    Super Moderator
    Points: 244,846, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    42,531
    Helped
    12960 / 12960
    Points
    244,846
    Level
    100

    Re: Interfacing gsm module with pic via mikroc pro

    In all the AT commands sending function calls the terminating character '\r' is missing.
    not missing, look sharp. Send as control character 0x0d.


    1 members found this post helpful.

    •   Alt21st February 2018, 23:06

      advertising

        
       

  6. #6
    Advanced Member level 3
    Points: 6,387, Level: 19

    Join Date
    Jan 2015
    Posts
    928
    Helped
    294 / 294
    Points
    6,387
    Level
    19

    Re: Interfacing gsm module with pic via mikroc pro

    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


    1 members found this post helpful.

  7. #7
    Junior Member level 1
    Points: 212, Level: 2

    Join Date
    May 2017
    Posts
    15
    Helped
    0 / 0
    Points
    212
    Level
    2

    Re: Interfacing gsm module with pic via mikroc pro

    Click image for larger version. 

Name:	proxy-1.png 
Views:	5 
Size:	62.4 KB 
ID:	144839


    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 by ComputerAngel; 23rd February 2018 at 23:35.



  8. #8
    Super Moderator
    Points: 60,546, Level: 60
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    12,360
    Helped
    2864 / 2864
    Points
    60,546
    Level
    60

    Re: Interfacing gsm module with pic via mikroc pro

    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
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  9. #9
    Junior Member level 1
    Points: 212, Level: 2

    Join Date
    May 2017
    Posts
    15
    Helped
    0 / 0
    Points
    212
    Level
    2

    Re: Interfacing gsm module with pic via mikroc pro

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



  10. #10
    Full Member level 5
    Points: 1,344, Level: 8

    Join Date
    Aug 2017
    Posts
    267
    Helped
    23 / 23
    Points
    1,344
    Level
    8

    Re: Interfacing gsm module with pic via mikroc pro

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



    •   Alt24th February 2018, 09:18

      advertising

        
       

  11. #11
    Super Moderator
    Points: 244,846, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    42,531
    Helped
    12960 / 12960
    Points
    244,846
    Level
    100

    Re: Interfacing gsm module with pic via mikroc pro

    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.


    1 members found this post helpful.

  12. #12
    Advanced Member level 3
    Points: 6,387, Level: 19

    Join Date
    Jan 2015
    Posts
    928
    Helped
    294 / 294
    Points
    6,387
    Level
    19

    Re: Interfacing gsm module with pic via mikroc pro

    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



--[[ ]]--