From 56e15f65e2ab7ad5aceae5c3526d799271153619 Mon Sep 17 00:00:00 2001 From: Civlo85 <70633987+Civlo85@users.noreply.github.com> Date: Wed, 2 Sep 2020 11:56:51 +0200 Subject: [PATCH 1/6] Create README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..3408203 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# gsmHat +Using the Waveshare GSM/GPRS/GNSS Hat for Raspberry Pi with Python From d3c33371054ff2f8f8ed074e14d9bc705e61694d Mon Sep 17 00:00:00 2001 From: Civlo85 <70633987+Civlo85@users.noreply.github.com> Date: Wed, 2 Sep 2020 11:58:35 +0200 Subject: [PATCH 2/6] Update README.md --- README.md | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 115 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3408203..ed4db18 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,115 @@ -# gsmHat -Using the Waveshare GSM/GPRS/GNSS Hat for Raspberry Pi with Python +# gsmHat - Waveshare GSM/GPRS/GNSS HAT for Raspberry Pi with Python + +With gsmHat, you can easily use the functionality of the Waveshare GSM/GPRS/GNSS HAT for Raspberry Pi ([Link to HAT](https://www.waveshare.com/gsm-gprs-gnss-hat.htm)). On this module a SIM868 Controller is doing the job too connect your Raspberry Pi with the world just by using a sim card. + +## Overview +gsmHat was written for Python 3. It provides the following features + + - Non-blocking receiving and sending SMS in background + +## Usage + +In the following paragraphs, I am going to describe how you can get and use gsmHat for your own projects. + +### Getting it + +To download scrapeasy, either fork this github repo or simply use Pypi via pip. +```sh +$ pip3 install gsmHat +``` + +### Using it + +1. Install your sim card in your module, connect the GSM antenna and mount the module on the pin headers of your Raspberry Pi + Make sure, that you **do not** need to enter Pin Code to use your card + +2. Enable the Uart Interface in your Raspberry Pi + + 1. Start raspi-config: `sudo raspi-config`. + 2. Select option 5 - interfacing options. + 3. Select option P6 - serial. + 4. At the prompt `Would you like a login shell to be accessible over serial?` answer 'No' + 5. At the prompt `Would you like the serial port hardware to be enabled?` answer 'Yes' + 6. Exit raspi-config and reboot the Pi for changes to take effect. + +3. Import gsmHat to your project + +```Python +from gsmHat import GSMHat, SMS +``` + +4. Init gsmHat + +```Python +gsm = GSMHat('/dev/ttyS0', 115200) +``` + +5. Check, if new SMS are available in your main loop + +```Python +# Check, if new SMS is available +if gsm.SMS_available() > 0: + # Get new SMS + newSMS = gsm.SMS_read() + # Do something with it +``` + +6. Do something with your newly received SMS + +```Python +# Get new SMS +newSMS = gsm.SMS_read() + +print('Got new SMS from number %s' % newSMS.Sender) +print('It was received at %s' % newSMS.Date) +print('The message is: %s' % newSMS.Message) +``` + +7. You can also write SMS + +```Python +Number = '+491601234567' +Message = 'Hello mobile world' + +# Send SMS +gsm.SMS_write(Number, Message) +``` +## On which platform was gsmHat developed and tested? + +### Hardware: +* [Raspberry Pi 4, Model B](https://www.raspberrypi.org/products/raspberry-pi-4-model-b/) +* [GSM/GPRS/GNSS/Bluetooth HAT for Raspberry Pi](https://www.waveshare.com/gsm-gprs-gnss-hat.htm), **later version that allows to power on/off the module by controlling GPIO 4** + +### Software: +* Raspbian (Codename: buster, Release: 10) +* Kernel: Linux 5.4.51-v7l+ +* Python: 3.7.3 + + +License +---- + +MIT License + +Copyright (c) 2020 Tarek Tounsi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +contact me: From 73bff8cf4082fc68c91b8fff7dba1f04b4b84c34 Mon Sep 17 00:00:00 2001 From: Civlo85 <70633987+Civlo85@users.noreply.github.com> Date: Wed, 2 Sep 2020 11:58:52 +0200 Subject: [PATCH 3/6] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ed4db18..d61c855 100644 --- a/README.md +++ b/README.md @@ -25,12 +25,12 @@ $ pip3 install gsmHat 2. Enable the Uart Interface in your Raspberry Pi - 1. Start raspi-config: `sudo raspi-config`. - 2. Select option 5 - interfacing options. - 3. Select option P6 - serial. - 4. At the prompt `Would you like a login shell to be accessible over serial?` answer 'No' - 5. At the prompt `Would you like the serial port hardware to be enabled?` answer 'Yes' - 6. Exit raspi-config and reboot the Pi for changes to take effect. + 1. Start raspi-config: `sudo raspi-config`. + 2. Select option 5 - interfacing options. + 3. Select option P6 - serial. + 4. At the prompt `Would you like a login shell to be accessible over serial?` answer 'No' + 5. At the prompt `Would you like the serial port hardware to be enabled?` answer 'Yes' + 6. Exit raspi-config and reboot the Pi for changes to take effect. 3. Import gsmHat to your project From 5129d64524e5c36e2ecddba945cc70acedaa717d Mon Sep 17 00:00:00 2001 From: Civlo85 <70633987+Civlo85@users.noreply.github.com> Date: Wed, 2 Sep 2020 11:59:03 +0200 Subject: [PATCH 4/6] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d61c855..ed4db18 100644 --- a/README.md +++ b/README.md @@ -25,12 +25,12 @@ $ pip3 install gsmHat 2. Enable the Uart Interface in your Raspberry Pi - 1. Start raspi-config: `sudo raspi-config`. - 2. Select option 5 - interfacing options. - 3. Select option P6 - serial. - 4. At the prompt `Would you like a login shell to be accessible over serial?` answer 'No' - 5. At the prompt `Would you like the serial port hardware to be enabled?` answer 'Yes' - 6. Exit raspi-config and reboot the Pi for changes to take effect. + 1. Start raspi-config: `sudo raspi-config`. + 2. Select option 5 - interfacing options. + 3. Select option P6 - serial. + 4. At the prompt `Would you like a login shell to be accessible over serial?` answer 'No' + 5. At the prompt `Would you like the serial port hardware to be enabled?` answer 'Yes' + 6. Exit raspi-config and reboot the Pi for changes to take effect. 3. Import gsmHat to your project From 23ac8b0bd6a8e53ad8316a97d272531198485939 Mon Sep 17 00:00:00 2001 From: Civlo85 <70633987+Civlo85@users.noreply.github.com> Date: Wed, 2 Sep 2020 12:00:13 +0200 Subject: [PATCH 5/6] Update README.md --- README.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ed4db18..980c5b5 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,12 @@ To download scrapeasy, either fork this github repo or simply use Pypi via pip. $ pip3 install gsmHat ``` -### Using it +### Prepare -1. Install your sim card in your module, connect the GSM antenna and mount the module on the pin headers of your Raspberry Pi - Make sure, that you **do not** need to enter Pin Code to use your card +* Install your sim card in your module, connect the GSM antenna and mount the module on the pin headers of your Raspberry Pi + Make sure, that you **do not** need to enter Pin Code to use your card -2. Enable the Uart Interface in your Raspberry Pi +* Enable the Uart Interface in your Raspberry Pi 1. Start raspi-config: `sudo raspi-config`. 2. Select option 5 - interfacing options. @@ -32,19 +32,21 @@ $ pip3 install gsmHat 5. At the prompt `Would you like the serial port hardware to be enabled?` answer 'Yes' 6. Exit raspi-config and reboot the Pi for changes to take effect. -3. Import gsmHat to your project +### Using it + +1. Import gsmHat to your project ```Python from gsmHat import GSMHat, SMS ``` -4. Init gsmHat +2. Init gsmHat ```Python gsm = GSMHat('/dev/ttyS0', 115200) ``` -5. Check, if new SMS are available in your main loop +3. Check, if new SMS are available in your main loop ```Python # Check, if new SMS is available @@ -54,7 +56,7 @@ if gsm.SMS_available() > 0: # Do something with it ``` -6. Do something with your newly received SMS +4. Do something with your newly received SMS ```Python # Get new SMS @@ -65,7 +67,7 @@ print('It was received at %s' % newSMS.Date) print('The message is: %s' % newSMS.Message) ``` -7. You can also write SMS +5. You can also write SMS ```Python Number = '+491601234567' From 7b3fb7a39436766ce3e2b7b1cd371db36eb34925 Mon Sep 17 00:00:00 2001 From: Civlo85 <70633987+Civlo85@users.noreply.github.com> Date: Wed, 2 Sep 2020 12:00:39 +0200 Subject: [PATCH 6/6] Delete REAMDE.md --- REAMDE.md | 115 ------------------------------------------------------ 1 file changed, 115 deletions(-) delete mode 100644 REAMDE.md diff --git a/REAMDE.md b/REAMDE.md deleted file mode 100644 index 985b573..0000000 --- a/REAMDE.md +++ /dev/null @@ -1,115 +0,0 @@ -# gsmHat - A non-blocking software to use the Waveshare GSM/GPRS/GNSS HAT for Raspberry Pi with Python - -With gsmHat, you can easily use the functionality of the Waveshare GSM/GPRS/GNSS HAT for Raspberry Pi ([Link to HAT](https://www.waveshare.com/gsm-gprs-gnss-hat.htm)). On this module a SIM868 Controller is doing the job too connect your Raspberry Pi with the world just by using a sim card. - -## Overview -gsmHat was written for Python 3. It provides the following features - - - Non-blocking receiving and sending SMS in background - -## Usage - -In the following paragraphs, I am going to describe how you can get and use gsmHat for your own projects. - -### Getting it - -To download scrapeasy, either fork this github repo or simply use Pypi via pip. -```sh -$ pip3 install gsmHat -``` - -### Using it - -1. Install your sim card in your module, connect the GSM antenna and mount the module on the pin headers of your Raspberry Pi - Make sure, that you **do not** need to enter Pin Code to use your card - -2. Enable the Uart Interface in your Raspberry Pi - -1. Start raspi-config: `sudo raspi-config`. -2. Select option 5 - interfacing options. -3. Select option P6 - serial. -4. At the prompt `Would you like a login shell to be accessible over serial?` answer 'No' -5. At the prompt `Would you like the serial port hardware to be enabled?` answer 'Yes' -6. Exit raspi-config and reboot the Pi for changes to take effect. - -3. Import gsmHat to your project - -```Python -from gsmHat import GSMHat, SMS -``` - -4. Init gsmHat - -```Python -gsm = GSMHat('/dev/ttyS0', 115200) -``` - -5. Check, if new SMS are available in your main loop - -```Python -# Check, if new SMS is available -if gsm.SMS_available() > 0: - # Get new SMS - newSMS = gsm.SMS_read() - # Do something with it -``` - -6. Do something with your newly received SMS - -```Python -# Get new SMS -newSMS = gsm.SMS_read() - -print('Got new SMS from number %s' % newSMS.Sender) -print('It was received at %s' % newSMS.Date) -print('The message is: %s' % newSMS.Message) -``` - -7. You can also write SMS - -```Python -Number = '+491601234567' -Message = 'Hello mobile world' - -# Send SMS -gsm.SMS_write(Number, Message) -``` -## On which platform was gsmHat built and tested? - -# Hardware: -* [Raspberry Pi 4, Model B](https://www.raspberrypi.org/products/raspberry-pi-4-model-b/) -* [GSM/GPRS/GNSS/Bluetooth HAT for Raspberry Pi](https://www.waveshare.com/gsm-gprs-gnss-hat.htm), **later version that allows to power on/off the module by controlling GPIO 4** - -# Software: -* Raspbian (Codename: buster, Release: 10) -* Kernel: Linux 5.4.51-v7l+ -* Python: 3.7.3 - - -License ----- - -MIT License - -Copyright (c) 2020 Tarek Tounsi - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - -contact me: