println( "ATH") //hang up updateSerial() println( "ATD+ +ZZxxxxxxxxxx ") // change ZZ with country code and xxxxxxxxxxx with phone number to dial updateSerial() println( "AT") //Once the handshake test is successful, i t will back to OK updateSerial() Once you send SMS to the SIM800L GSM module, you will see the following output on the serial monitor. println( "AT+CNMI=1,2,0,0,0") // Decides how newly arrived SMS messages should be handled updateSerial() The screenshot below shows the SMS sent from the SIM800L GSM module. print( "Last Minute Engineers | ") //text content updateSerial() println( "AT+CMGS=\"+ZZxxxxxxxxxx\"") //change ZZ with country code and xxxxxxxxxxx with phone number to sms updateSerial() println( "AT+CMGF=1") // Configuring TEXT mode updateSerial() Any number other than these two indicates that you are not registered to any network. 1 indicates that you are registered to a home network and 5 indicates a roaming network. The second number in the output response should be 1 or 5. Note that this signal strength depends on your antenna and location!ĪT+CCID – It checks whether the SIM card is valid or not and sends the SIM card number.ĪT+CREG? – It checks whether you are registered to the network or not. The first number in the output response is the signal strength in dB. You can then send some commands to query the module and get information about it.ĪT+CSQ – It checks ‘Signal Strength’. If all is well, it sends the OK message, telling you that it is understanding you correctly. Now that we have established a basic connection, we will try to communicate with the SIM800L module by sending AT commands.ĪT – This is the most basic AT command. You should see the output below on the serial monitor. Once you have uploaded the sketch, open the serial monitor at baud rate 9600. read()) //Forward what Software Serial received to Serial Port read()) //Forward what Serial received to Software Serial Port println( "AT+CREG?") //Check whether it has registered in the network updateSerial() println( "AT+CCID") //Read SIM information to confirm whether the SIM is plugged updateSerial() println( "AT+CSQ") //Signal quality test, value range is 0-31, 31 is the best updateSerial() println( "AT") //Once the handshake test is successful, it will back to OK updateSerial() Begin serial communication with Arduino and SIM800L Begin serial communication with Arduino and Arduino IDE (Serial Monitor) SoftwareSerial mySerial( 3, 2) //SIM800L Tx & Rx is connected to Arduino #3 & #2 void setup() #include //Create software serial object to communicate with SIM800L In the first diagram, a 1200mAh Li-Po battery is connected. We’ve included two different wiring diagrams to show you how it’s done. The only thing left to do is connect the power supply to the module. A 10K resistor between SIM800L’s Rx and Arduino’s D2, and a 20K resistor between SIM800L’s Rx and GND, will work just fine. There are numerous ways to accomplish this, but the simplest is to use a resistor divider. Therefore, the Tx signal from the Arduino must be stepped down to 3.3V. Simply put, the SIM800L module’s Rx pin is not 5V tolerant. We cannot connect the module’s Rx pin directly to the Arduino’s digital pin because Arduino UNO has a 5V logic level and the SIM800L module has a 3.3V logic level. Next, connect the module’s Tx pin to the Arduino’s digital pin #3, as we will be communicating with the module via software UART. To begin, connect the antenna to the module and insert a micro SIM card into the socket. Now that you are familiar with the SIM800L module, it is time to connect it to Arduino! Wiring a SIM800L GSM Module to an Arduino You can connect a speaker to these two pins directly. SPK± is a differential speaker interface. You can connect an external electret microphone to these two pins directly. Pulling it LOW for approximately 50 ms will wake up the module. Pulling it HIGH causes the module to enter sleep mode, disabling serial communication. It is by default HIGH and can be configured to go LOW when a call or SMS is received.ĭTR pin controls the sleep mode. This is basically the ‘interrupt-out’ pin from the module. TxD (Transmitter) pin transmits data from the module to the microcontroller. This pin is auto-baud so the baud rate at which you send the “AT” command after reset is the baud rate used. RxD (Receiver) pin is used to send commands to the module. If you got the module in an absolutely bad space, pull this pin LOW for 100ms to perform a hard reset. It doesn’t even run on 3.3 V! Use a Li-Po battery or a DC-DC buck converter instead. Keep in mind that the SIM800L chip has an operating voltage range of 3.4 V to 4.4 V, so connecting this module to the Arduino’s 5V output is probably going to cause damage to the module. NET pin is where you can solder the helical antenna that comes with the module.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |