• AVR Freaks

Hot!UART Levels With SIM800L

Page: 12 > Showing page 1 of 2
Author
Designer
Super Member
  • Total Posts : 519
  • Reward points : 0
  • Joined: 2007/11/20 20:28:41
  • Location: 0
  • Status: offline
2020/05/31 11:19:43 (permalink)
0

UART Levels With SIM800L

Hi,
 
I'm interfacing SIM800L module with a PIC16F627A.All this time I was giving supply 4V to SIM800L module & 5V to PIC.It worked but there was a doubt that do I need a level shifting trasistor ot not.
 
But now I need to compact my design & re-design a new PCB & planned to power 4V to both SIM800L & PIC.I drawn the schematic.Is it ok?
post edited by Designer - 2020/05/31 11:21:22

Attached Image(s)

#1

28 Replies Related Threads

    ric
    Super Member
    • Total Posts : 28324
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: UART Levels With SIM800L 2020/05/31 13:05:06 (permalink)
    +1 (1)
    How did the old design handle the inverted data on the PIC's RX pin?
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    Designer
    Super Member
    • Total Posts : 519
    • Reward points : 0
    • Joined: 2007/11/20 20:28:41
    • Location: 0
    • Status: offline
    Re: UART Levels With SIM800L 2020/05/31 18:01:43 (permalink)
    0
    ric
    How did the old design handle the inverted data on the PIC's RX pin? 


    Its not inverting, I have used a PNP transistor.If the module sends logic 1, PIC recieves the same Logic 1.
    #3
    ric
    Super Member
    • Total Posts : 28324
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: UART Levels With SIM800L 2020/05/31 18:10:22 (permalink)
    0
    You're right. It is not acting as a transistor at all. You could have got exactly the same effect with a diode.
     
    If both are running from 4V, you can just connecte RX-TX and TX-RX directly.
    A 1k series resistor would be useful to limit current in case one loses power.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #4
    Designer
    Super Member
    • Total Posts : 519
    • Reward points : 0
    • Joined: 2007/11/20 20:28:41
    • Location: 0
    • Status: offline
    Re: UART Levels With SIM800L 2020/06/11 18:10:44 (permalink)
    0
    Hi,
     
    I'm about to print a PCB for my SIM800L project.As mentioned now the power is 4V for both (module & for the PIC).
    I noticed that in the PIC16F627A the UART RX pin acts like a schemitt trigger input pin & needs (0.8*Vdd).So I need to add a transistor level shifter.I have also attached the voltage levels of SIM800L UART.
     
    I noticed that 1K base resistor is too much & dropped down to 330R.
     
    Any modifications?
    post edited by Designer - 2020/06/11 18:17:32

    Attached Image(s)

    #5
    1and0
    Access is Denied
    • Total Posts : 11125
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: UART Levels With SIM800L 2020/06/11 18:35:53 (permalink)
    0
    Designer
    Any modifications?



    Yes, as Ric said TX-RX and RX-TX via a series resistor.
     
    #6
    ric
    Super Member
    • Total Posts : 28324
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: UART Levels With SIM800L 2020/06/11 18:40:33 (permalink)
    0
    Yes, as you see, the SIM800L is effectively running at 2.8V, so its output high voltage is not guaranteed to work with the PIC's RX input.
    As I already noted in post#4, that is NOT a transistor level shifter. It's just working as a diode, shifting the emitter pin to 0.65V higher than the base. You would get exactly the same effect if you left the collector floating, or replaced the transistor with a small signal diode.
    R1 isn't doing anything useful either. The circuit would work better if it was shorted.
     
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #7
    ric
    Super Member
    • Total Posts : 28324
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: UART Levels With SIM800L 2020/06/11 18:43:47 (permalink)
    0
    1and0
    Designer
    Any modifications?

    Yes, as Ric said TX-RX and RX-TX via a series resistor.

    I've changed my mind. I didn't realise the SIM800L was effectively running at a voltage much lower than 4V.
    The OP's circuit might just work, but a true level shifting circuit using two transistors would be better.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #8
    Designer
    Super Member
    • Total Posts : 519
    • Reward points : 0
    • Joined: 2007/11/20 20:28:41
    • Location: 0
    • Status: offline
    Re: UART Levels With SIM800L 2020/06/11 18:55:50 (permalink)
    0
    ok.At first I shorted the SIM800 TX & PIC RX.The circuit didn't work.Thats why I added a transistor.But I noticed with the transistor some SMS strings not getting properly.
     
    My only doubt is SIM800L max vout = 2.8V.But PIC RX pin expecting a voltage of 3.2V (VDD*0.8).How can this module send 3.2V to PIC? IF I use a diode it will drop another 0.6V...!!!
    #9
    ric
    Super Member
    • Total Posts : 28324
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: UART Levels With SIM800L 2020/06/11 19:06:44 (permalink)
    0
    Designer
     IF I use a diode it will drop another 0.6V...!!!

    No it won't.
    If you connect the diode exactly the same as the diode shown inside the transistor symbol, the anode will be 0.65V higher than the cathode, as current will flow from 4V through R2, through the diode, then into the SIM800L TX pin.

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #10
    Designer
    Super Member
    • Total Posts : 519
    • Reward points : 0
    • Joined: 2007/11/20 20:28:41
    • Location: 0
    • Status: offline
    Re: UART Levels With SIM800L 2020/06/11 19:27:36 (permalink)
    0
    OK Is this correct?
     
    1)In this case do I need to keep the 4.7K R2?
     
    2)Why it did not worked when I direct connect the SIM TX to PIC RX?

    Attached Image(s)

    #11
    ric
    Super Member
    • Total Posts : 28324
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: UART Levels With SIM800L 2020/06/11 19:41:28 (permalink)
    0
    Designer
    OK Is this correct?

     yes
     

    1)In this case do I need to keep the 4.7K R2?

    Yes. Read through my description of its operation in post#10 again.
    Imagine how it could work without R2.
     

    2)Why it did not worked when I direct connect the SIM TX to PIC RX?

    Without the 0.65V boost in the output high voltage, it never got high enough.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #12
    1and0
    Access is Denied
    • Total Posts : 11125
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: UART Levels With SIM800L 2020/06/11 20:10:48 (permalink)
    0
    ric
    1and0
    Yes, as Ric said TX-RX and RX-TX via a series resistor.

    I've changed my mind. I didn't realise the SIM800L was effectively running at a voltage much lower than 4V.
    The OP's circuit might just work, but a true level shifting circuit using two transistors would be better.

     
    Okay, I did not see the VOH of the SIM is only 2.7-2.8V. I thought it was closer to 4V. ;)
     
    #13
    1and0
    Access is Denied
    • Total Posts : 11125
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: UART Levels With SIM800L 2020/06/11 20:23:41 (permalink)
    0
    Page 32 of the SIM800L datasheet has recommended level translators: https://img.filipeflop.com/files/download/Datasheet_SIM800L.pdf
     
    #14
    ric
    Super Member
    • Total Posts : 28324
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: UART Levels With SIM800L 2020/06/11 20:29:23 (permalink)
    +1 (1)
    1and0
    Page 32 of the SIM800L datasheet has recommended level translators: https://img.filipeflop.com/files/download/Datasheet_SIM800L.pdf

    That's clever. Yes, those circuits would work.
    The voltage divider from PIC to SIM800L is probably ok without the transistor though.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #15
    Designer
    Super Member
    • Total Posts : 519
    • Reward points : 0
    • Joined: 2007/11/20 20:28:41
    • Location: 0
    • Status: offline
    Re: UART Levels With SIM800L 2020/06/11 20:53:56 (permalink)
    0
    Ok thank you I would like to stick with diode & resistor method as we discussed earlier.I hope it will give better results than my PNP method.
    #16
    1and0
    Access is Denied
    • Total Posts : 11125
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: UART Levels With SIM800L 2020/06/12 06:13:49 (permalink)
    +1 (1)
    Designer
    Ok thank you I would like to stick with diode & resistor method as we discussed earlier.I hope it will give better results than my PNP method.



    Those voltage levels look too close for comfort. Where is the 4V power supply comes come? What is its tolerance?What is the tolerance of the resistors? I suggest to you to do calculations including these tolerances.
     
    post edited by 1and0 - 2020/06/12 06:15:06
    #17
    Designer
    Super Member
    • Total Posts : 519
    • Reward points : 0
    • Joined: 2007/11/20 20:28:41
    • Location: 0
    • Status: offline
    Re: UART Levels With SIM800L 2020/06/12 10:54:51 (permalink)
    0
    Very good point.I make 4V from LM2596 module by turning its preset.The resistors are normal 4 band ones.

    When I send SMS to this module some SMS cant read by PIC.It misses out.Thats what I was finding and I cannot figure it out yet.I' m pretty sure that SIM800L TX + PIC RX line has the problem.
    post edited by Designer - 2020/06/12 11:03:54
    #18
    Designer
    Super Member
    • Total Posts : 519
    • Reward points : 0
    • Joined: 2007/11/20 20:28:41
    • Location: 0
    • Status: offline
    Re: UART Levels With SIM800L 2020/06/12 18:44:17 (permalink)
    0
    Ok I changed some parts after considering the tolerences, What will be best..!!

    Attached Image(s)

    #19
    ric
    Super Member
    • Total Posts : 28324
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: UART Levels With SIM800L 2020/06/12 19:05:13 (permalink)
    0
    Designer
    Ok I changed some parts after considering the tolerences, What will be best..!!

    The left hand version won't work.
    You have increased the "1" voltage, but now the "0" voltage is too high.
     
    The right hand version will work, but you could simplify it by removing the two 1N4007 diodes, and connecting to "VDDEXT" on the SIM800 instead, which is precisely what "Figure 22" in the SIM800L datasheet tells you to do.
     
     
    post edited by ric - 2020/06/12 19:08:18

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #20
    Page: 12 > Showing page 1 of 2
    Jump to:
    © 2020 APG vNext Commercial Version 4.5