making a smoke sensor that sends a sms message to a user when it detects smoke.

I'm new to arduino coding and we are tasked with making a smoke sensor that sends a sms message to a user when it detects smoke. One problem that we've encountered is that our gsm module 900a can't seem to find a network (the status LED blinks every second rather than every 3 seconds). How can we fix this problem? I will provide the code below int buzzer = 8; int smokeA0 = A5; int sensorThres = 0; #include<SoftwareSerial.h> SoftwareSerial GSM (9, 10); void setup() { pinMode(buzzer, OUTPUT); pinMode(smokeA0, INPUT); Serial.begin(9600); GSM.begin (9600); delay(100); } void loop() { int analogSensor = analogRead(smokeA0);
if (analogSensor > sensorThres) { digitalWrite(buzzer, HIGH); delay (1000); Serial.println("AT+CMGF=1");
delay(1000);
Serial.println("AT+CMGS="+639053188487"\r"); Serial.println("smoke detected alert"); Serial.println((char)26); delay(100); } else { digitalWrite(buzzer,LOW); } delay(50); }
12 Replies
ZacckOsiemo
ZacckOsiemo3w ago
Been a while since I worked with a SIM module, if I recall you may need an antenna?
ZacckOsiemo
ZacckOsiemo3w ago
i remember something like going outside my office or to my window for signal
aymen ammari
aymen ammari3w ago
I'm using 3 cm one but still the same problem
Ben
Ben3w ago
Sim 900 has an antenna like thing
Ben
Ben3w ago
Try using the serial monitor to see if you are actually getting value from the module, also check your pin configuration
Ben
Ben3w ago
Test the sim module, #include <SoftwareSerial.h> //Create software serial object to communicate with SIM900 SoftwareSerial mySerial(7, 8); //SIM900 Tx & Rx is connected to Arduino #7 & #8 void setup() { //Begin serial communication with Arduino and Arduino IDE (Serial Monitor) Serial.begin(9600);
//Begin serial communication with Arduino and SIM900 mySerial.begin(9600); Serial.println("Initializing..."); delay(1000); mySerial.println("AT"); //Handshaking with SIM900 updateSerial(); mySerial.println("AT+CSQ"); //Signal quality test, value range is 0-31 , 31 is the best updateSerial(); mySerial.println("AT+CCID"); //Read SIM information to confirm whether the SIM is plugged updateSerial(); mySerial.println("AT+CREG?"); //Check whether it has registered in the network updateSerial(); } void loop() { updateSerial(); } void updateSerial() { delay(500); while (Serial.available()) { mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port } while(mySerial.available()) { Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port } } Once you have uploaded the sketch, open the serial monitor at baud rate 9600. You should see the output below on the serial monitor.
Ben
Ben3w ago
attachment 0
Ben
Ben3w ago
I saw something please check it out
attachment 0
wafa_ath
wafa_ath3w ago
hi aymen , The SIM900A seems to be limited to Asia, and only compatible with 2G. Have you check this limitations ?
aymen ammari
aymen ammari3w ago
I already tryed multiple codes like this and non of them workd + pin configuration is correct just tx and rx
aymen ammari
aymen ammari3w ago
Oohh I didn't know that, I'm situated in African, lemme check that maybe that's why
Ben
Ben3w ago
Check the sim module if it's actually working
Want results from more Discord servers?
Add your server
More Posts
Using Blender for electronic " design and visualization"Hey everyone! as a person who love to create 3D project i recently discovered that Blender can be usImplementing real-time communication with MQTTHey guys am Implementing a real-time communication between IoT devices using the MQTT protocol. I'm Encountering hardfaults in FreeRTOS v10.3.0 on a Microchip PIC32 while using vsnprintf or sprinHi guys, I'm encountering hardfaults in FreeRTOS `v10.3.0` on a `Microchip PIC32` while using `vConnect and stream sensor data from a Raspberry Pi running on Raspbian OS to an AWS IoT Core@Middleware & OS @IoT Cloud Hello guys, how can I connect and stream sensor (QMC5883) data from a RHow can I ensure my CAN ISR completes processing quickly enough to avoid the interrupt WDT panic?@Middleware & OS I'm using an MCP25625 CAN controller with an ESP32-S3 and esp-idf with RTOS. I'm encollect temperature data from a sensor connected to my mcu and store it every minute on SD card@Middleware & OS Hello guys can i implement a simple sensor data collection and storage system usinHow can I modify the state machine logic?I'm working on this RTOS-based application for a vending machine controller with `C` and a *state maCan someone decode what data in hex is being sent in the following image?hello everyone can someone decode what data in hex is being sent in the following image?What is the role of a bootloader in embedded systems programming?A bootloader is a crucial piece of software in embedded systems, responsible for preparing the devictesting honeypot for Matter over Thread and WifiHello, For my masters thesis, We've made a honeypot with a Matter over Thread and WiFi network using