Comments (12)
Hello there @7aman! Thanks for trying out serialport-gsm
!
Since the close
event is fired, it means the serialport
's close method
was fired successfully. I too think there is probably an issue with serialport
. I'll look into it and notify you if ever I happen to stumble with some workaround.
Nice thing your working out there with RPi 3 B and sim800L!
from serialport-gsm.
@7aman , I was using your sample code above and ran it. It works fine.
On close was called when I pulled out the wavecom fastrack
.
Also looked into @serialport/stream.js
, disconnecting a port will cause it to close the connection.
And this one using python.
Immediately thrown an error upon disconnecting the device from the usb.
from serialport-gsm.
No problem @7aman.
from serialport-gsm.
It's worth mentioning that only a turned off modem will cause this CPU usage. Disconnecting Rx and Tx have no effects on CPU. It's probably an issue of serialport
itself and not your module. This happens to data received by ttyS0
when I turn off modem. It goes on and on.
pi@monitor:~/gsm-v2 $ python3 -m serial.tools.miniterm /dev/ttyS0 115200
--- Miniterm on /dev/ttyS0 115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
at
OK
␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀
from serialport-gsm.
Thanks. I appreciate your consideration, and look forward to hearing from you.
I'm not sure if close
event is fired.
Text below, shows console's logs of my code (server.js
I shared above). When I was executing node server.js
Sim800L was running. After printing these messages I turned it off for 30 seconds. Then I turned it back on.
Since my simple console.log
callbacks on close
and error
events printed out nothing, it seems close
and error
events were not fired.
Also during these power-off and power-on actions, my code never exited and It kept running and functioning as nothing unusual happened.
pi@monitor:~/gsm-v2 $ node server.js
open msg: null
initialize msg: { status: 'success',
request: 'modemInitialized',
data: 'Modem Successfully Initialized' }
set pdu msg: { status: 'success', request: 'modemMode', data: 'PDU_Mode' }
from serialport-gsm.
@7aman any device disconnected while open or calling the close
method should fire the close
event. So turning off the Sim800L should fire close
event.
May I ask how you toggle power of your Sim800L?
from serialport-gsm.
@zabsalahid I do it by disconnecting VCC and GND.
from serialport-gsm.
Hi @7aman !
I have updated the module to 2.1.3
. Can you please update your module.
And see if it is still the same.
By disconnecting VCC and GND, you mean the Sim800L will have no power?
Can you also test if manually calling modem.close
would still have the same CPU usage and temp.
from serialport-gsm.
I tested v2.1.5. CPU usage is still going up.
I found a hardware solution but later I will try to fix this issue in my code.
Hardware Solution:
When sim800L is turned off, RPi3 is still listening and translating receiving bits. I have not any equipment (e.g. an oscilloscope) right now to check receiving bit. But if you open a serial console like I shared its results before, you will see some weird characters appear on serial console that shows RPi3 thinks it is receiving data.
After "OK" response, I turned off SIM800L.
pi@monitor:~/gsm-v2 $ python3 -m serial.tools.miniterm /dev/ttyS0 115200
--- Miniterm on /dev/ttyS0 115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
at
OK
␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀
After powering off, "␀" character will appear and it will fill rows and rows of terminal very fast. It is interesting that if you disconnect Rx from RPi3, terminal will stop showing "␀" character.
I temporarily fixed this issue by adding a middle hardware, a Bi-Directional Logic Level Converter. Its main application is to convert logic level between different devices such as Arduino that uses 5V and RPi3 which uses 3.3V. In this case because both SIM800L and RPi3 are using 3.3V it is not required. But by using this middle-man and applying 3.3V to both LV and HV sides, it will stop RPi3 to receive such wired bits at its serial port.
I will try later to remove logic converter and fix this issue in the code and let you know the result.
Thanks for your time.
from serialport-gsm.
By disconnecting VCC and GND, you mean the Sim800L will have no power?
Yes.
Story behind: I launched my little project over night to see if it is stable in long term. I launched a s-tui
in separate window and went to sleep. In the morning I found CPU usage was very high and temperature was up to 70 C degree. And SIM800L was not responding to abnormal sensors. I found power supply of SIM800L was disconnected at some point. I repeated disconnecting SIM800L power a few more times and found this issue.
Can you also test if manually calling
modem.close
would still have the same CPU usage and temp.
No. If I call modem.close()
manually in my code, it fires modem.on('close')
callback function and then closes and exits the process. So it will not use CPU anymore.
It is not helpful for me. I need an .on('disconnect')
event and a modem.reconnect()
to serve my purpose 24/7. I will try to implement such functionality later.
from serialport-gsm.
So it is an issue with RPi3 serial port (gpio 14, 15) or SIM800L.
Because you have not my set of hardware I will try to fix it and I will share the result with you.
Thanks for your time.
from serialport-gsm.
Hello @7aman , How did you manage to implement .on('disconnect')
and also modem.reconnect()
? I also need those functionality. Because when I try to plug out my usb modem from my pc it calls the function modem.close()
and exits the process.
from serialport-gsm.
Related Issues (20)
- Error on modem.close(): Cannot read property 'close' of undefined HOT 4
- ReferenceError: message is not defined HOT 7
- Can we use web serial port on browser instead running nodejs HOT 7
- Receive SMS error HOT 3
- enableConcatenation not working as expected HOT 2
- How to check if modem is open or not HOT 1
- Handle multiple ports HOT 5
- Incoming USSD and message errors HOT 3
- sendSMS stuck in 1st callback when no load? HOT 14
- Failure to retrieve phone number. HOT 4
- No results found on list command HOT 9
- USB modem shows up several times when listing HOT 2
- Not receiving messages in inbox HOT 7
- USSD response HOT 4
- Compatible / Recommended USB modems HOT 1
- Wrong phone number when using sendSMS function HOT 4
- Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client HOT 7
- Port closes when sending ussd commands HOT 1
- code : "ENOENT" errno : -2 path : "udevadm" spawnargs : (2) ['info', '-e'] syscall : "spawn udevadm" [[Prototype]] : Object
- Missing Characters in a message (PDU) when sending over 160 characters HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serialport-gsm.