Go Down

Topic: Modify GSM library to work with Hardware Serial (Read 4018 times) previous topic - next topic


Hello all, i have a custom PCB that connects quectel m10 to an ATmega2560 through Serial2 pin (RX2,TX2)

therefore i need to use the GSM library with hardware pins.

i searched the entire web but never saw a proper solution or a modified version of the library.

have anyone ever did this?

i encountered the SerialGSM library but it is too "thin" for my purposes.

before i am starting to write my own library using AT- command i would love to hear your thoughts.

this library does not use standard Software serial implementation (if this was the case i would just replace the object with a hardware one) rather than a new software serial making it too confusing for me to modify myself - if anyone can guide me what to do i will modify it myself and upload.

Thank you


I had to make my own solution using hardware serial and AT commands. It required quite a lot of work. It will be interesting and useful to see if GSM library is made to support HW serial.


I got a message where a forum user asked for a code about this. I don't know whether he got what he wanted, but here is a crude project to handle an old ITEAD GSM modem. AT commands are standardized but I have used the code only with the Itead PC board using Sim.com's Sim 5216e module. I had to solder some wires myself to get the thing working, and lower the baud rate to 38kBd (with AT commands).

The code is too long for a post, but I made zip file of it.

Names and comments are Finnish.

I hope this helps.


AM not sure about what you are looking for.. Check this link below to use an arduino to GSM without GSM sheild and using AT commands via serial library


All d best :)


Thank you all for trying but unfortunately it is not what i am looking for.

i am trying to understand what modifications needs to be done in the GSM library
so that it will work with hardware serial.


I hope you'll get an usefull answer. I could use that kind of library. If you get no answers here, how about some programming subforum here.


Dear all,
has anyone solved this issue on how to replace the software serial with the hardware one?

Because I've already designed a board that use the M10 GSM modem in order to communicate data on a IoT platform.

The problem is that the module is connected to the hardware serial pin instead of 2,3 as usual.

That was in order to save program space using HW pins since that I should not keep the hardware serial free.



I was searching for similar requirements... changing SIM900 library from softserial to Serial1 on MEGA..

The below SIM900 library hv support for MEGA Serial1


You can either use it directly or have an idea on how to modify the codes..

Look at files HWSerial.*

Go Up