Link to home
Avatar of Rama Tito
Rama TitoFlag for Malaysia

asked on

AT command in Nodejs on raspberry pi zero using NB-IoT hat

Hi,

I am trying to establish network connection between raspberry pi zero and SIM7000E NB-IoT HAT using nodejs.

https://www.waveshare.com/wiki/SIM7000C_NB-IoT_HAT


Hardware connection is micro usb from raspberry pi to micro usb power supply in NB-IoT HAT. I didn't mount on pin header because i do need to use the serial to communicate with other sensors.


I did use minicom to test the software communication. 

$ minicom -D /dev/ttyUSB2

Open in new window

There was four tty's : ttyUSB0,ttyUSB1,ttyUSB2,ttyUSB3. After trying one by one, i do manage establish communication in ttyUSB2.



Welcome to minicom 2.7.1

OPTIONS: I18n
Compiled on Aug 13 2017, 15:25:34.
Port /dev/ttyUSB2, 12:10:51

Press CTRL-A Z for help on special keys

AT
OK

AT+COPS=?
+COPS: (1,"Digi","Digi 4G+","50216",0),(1,"MY MAXIS","MY MAXIS","50212",0),,(0,)

AT+COPS=4,2,"50216"
OK

Open in new window

I do need to write this code in nodejs and intergrade in my program. The AT+COPS? command takes about 10 sec to responds. Timeout need to be intergraded.

Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

IMO this is the wrong tool for the job.  WebApps are not supposed to integrate with the hardware and definitely will not work in a browser to access hardware on the client computer.
ASKER CERTIFIED SOLUTION
Avatar of David Favor
David Favor
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Rama Tito

ASKER

Hi,
"connect to /dev/ttyUSB2 seems unlikely, without the pin header connected", Yes this is the pain by using USB connectors. Every time when the system is reboot, the SIM 7000 jump to either ttyUSB2 or ttyUSB3.

Conclusion: I did use the hat and mount in the pin header of raspberry pi. This solve the ttyUSB issues. SIM 7000 permanently stay on ttyAMA0 and solve the conflict.

The coding, i did remove node js and use PPP protocol that gives TCP/IP over a serial line. Took some time to setup but do manage.