I'm working on an open source project to make an automation to open a garage door.
The project uses a SIM900 module to be able to receive calls. When a call is received, the phone number is compared against an authorized phonebook, and if the number is in the list, a relay is fired.
The project as it is now is functional, but I' stuck with two problems that don't let me finish the project.
The main problem is that when I receive data from the serial port connected to the SIM900, sometimes some characters are missing. It rarelly happens if the data is small, like when I send commands that only return OK or ERROR or when the RING message and the caller identification is given; but if I ask for a list of SMS or similar, the data sent will have several single characters "eaten".
I tried with two Arduinos (Mega and One), and even tried shielding the RX and TX cables that go to the SIM900 module, to no avail.
Also, I looked if there's a way to change the serial speed for communicating whith the SIM900, but I can't find anything; it defaults to 19200bps, I want to lower the speed to check if its something related to the cable's realiability.
The second problem is that I can't get the SIM900 module to power on by the Arduino. It works if I fisically press the module's power button, but when I put that project to work, I don't want to need to push a button every time after there is a power outgage.
Anyway, this problem does not bother me; if I can't power on the module via a pin, I'll use another relay connected to the power button.
Example of the "eaten characters" problem: (I added the asterisks to obscure the four central numbers of my phone number)
Sending command: AT+CMGL="ALL"
Sent. Waiting response
AT+CMGL="ALL"
Receiving data
+CMGL: 1,"REC READ","679****39","","15/05/30,12:09:53+08"
000200650060020003003004D0010079020006D069005006E07400720610730020073007002006D00F0076006006C02000600730040061
+CML: 2,REC RED","69****3","","5/05/0,12:9:53+0"
0060061020006F0630050070061006006F
+CMG: 3,"EC REA","+3479***39","""15/0530,1:19:3708"
Hla
OK
The first line received is correct, but the second message has 8 characters missing in the first line alone!
I put the full project on Github so if anyone wants to check the code or help, it will be really appreciated.
This is the repository: GitHub - Spyd77/GorDO: GSM Garage Door Opener for Arduino
What does currently work and what does not on my project?
WORKING:
- You can send commands via the Arduino's serial console
- There is a phonebook for 64 entries (stored in the EEPROM)
- Command to list the phonebook (result via Arduino's serial console)
- Command to add entries to the phonebook
- Command to delete entries from the phonebook
- SIM900 is initialized and set to give caller ID when someone's calling
- When there's a call, is compared to the phonebook; the relay is fired if the caller is on the list
- Calls are never picked up, they are automatically dropped after getting the caller ID, so no phone charges for using the automation
NOT WORKING:
- SIM900 module is not automatically powered on, you have to press the button manually
- Long text received from SIM900's is missing some characters.
- Commands via SMS are not implemented