

This circuit is designed to interface an Arduino UNO with a SIM900A GSM module and an I2C LCD 16x2 screen. The purpose of the circuit is to send an SMS message when a toggle switch is pressed and display a confirmation message on the LCD screen. The Arduino UNO serves as the central controller, managing the communication between the SIM900A module and the LCD screen. A resistor is used in conjunction with the toggle switch to form a simple input circuit for the Arduino. The DC Source provides a stable 5V supply to the components that require it.
GND connected to SIM900A GNDD4 connected to I2C LCD SCLD3 connected to I2C LCD SDAD2 connected to one end of the Resistor and Toggle Switch VccD1 (TX) connected to SIM900A DB9-3 (RXD)D0 (RX) connected to SIM900A DB9-2 (TXD)Vcc connected to one end of the Resistor and Arduino UNO D2Sig connected to I2C LCD GND and DC Source 5V GNDSCL connected to Arduino UNO D4SDA connected to Arduino UNO D3GND connected to Toggle Switch Sig and DC Source 5V GNDVCC (5V) connected to the other end of the Resistor and DC Source 5V VCCVcc and Arduino UNO D2VCC (5V) and DC Source 5V VCCVCC connected to I2C LCD VCC (5V) and one end of the ResistorGND connected to I2C LCD GND and Toggle Switch SigGND connected to Arduino UNO GNDDB9-3 (RXD) connected to Arduino UNO D1 (TX)DB9-2 (TXD) connected to Arduino UNO D0 (RX)/*
* This Arduino sketch interfaces with a SIM900A module and an I2C LCD screen.
* When the toggle switch is pressed, the Arduino sends a message via the SIM900A
* and displays a message on the I2C LCD screen.
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Pin definitions
const int switchPin = 2;
const int lcdSdaPin = 3;
const int lcdSclPin = 4;
const int sim900RxPin = 1;
const int sim900TxPin = 0;
// Initialize the LCD
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
// Initialize serial communication for SIM900A
Serial.begin(9600);
// Initialize the LCD
lcd.begin();
lcd.backlight();
// Set the switch pin as input
pinMode(switchPin, INPUT);
}
void loop() {
// Check if the switch is pressed
if (digitalRead(switchPin) == HIGH) {
// Send message via SIM900A
sendSMS();
// Display message on LCD
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Message Sent");
delay(2000); // Wait for 2 seconds
}
}
void sendSMS() {
Serial.println("AT+CMGF=1"); // Set SMS mode to text
delay(1000);
Serial.println("AT+CMGS=\"+1234567890\""); // Replace with recipient's number
delay(1000);
Serial.print("Hello, this is a test message."); // Message content
delay(1000);
Serial.write(26); // ASCII code for CTRL+Z to send the message
delay(1000);
}
This code is designed to run on the Arduino UNO and handles the logic for reading the toggle switch state, sending an SMS message through the SIM900A module, and displaying a confirmation message on the I2C LCD screen.