Giter Site home page Giter Site logo

linecode / nbiot-cloud-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pangpangshui/nbiot-cloud-server

0.0 2.0 0.0 36.96 MB

NB-Iot project including a cloud platform and Embedded for stm32

License: GNU General Public License v3.0

JavaScript 0.29% HTML 0.41% Vue 0.33% CSS 0.03% C 95.47% Assembly 2.59% C++ 0.68% Makefile 0.21%

nbiot-cloud-server's Introduction

NBIot-Cloud-Server

NB-Iot project including a cloud server

该项目分为两部分,第一部分是云平台,第二部分是硬件部分。

目前硬件部分只支持Stm32f10x系列,如果适配其他的STM32系列只需要一直对应的NB驱动库即可,此驱动库借鉴了谷雨物联网的例子,如果需要移植到其他的系列,请参考textNB的子项目或者前往谷雨物联网参考他们家的例子。

第一部分由前端后台和数据库构成,前端对应的是NBIot子项目,后台对应的是NBIotServer子项目。前端采用Vue.js开发,后端采用Node.js开发。具体技术可参考pdf文档。数据库采用MongoDB,具体的集合设计也可参考pdf文档。

目前已实现UDP和CoAP协议的通信,本项目将保持更新,后续会支持MQTT、TCP等协议,并支持Adruino、树莓派、ARM9以上等硬件。

 前端后台部署需要先运行cnpm i安装所有依赖的模块。

目前测试硬件为stm32f103c8t6+bc95-b8(移动sim卡)。由于电信限制sim卡的对个人服务器的访问,电信的暂时不支持,如果您的服务器已经加入了电信白名单,那应该也是可以正常通信的。


关于如何部署该云平台

后端程序部署

后端采用node开发,有两种办法可以运行服务端程序。 首先,需要在服务端安装node环境,关于如何安装,请根据不同的操作系统自己寻找教程,之后进行下一步。

  1. 第一种,进入NBIotServer文件夹,运行cnpm i --save命令,安装好依赖包。之后运行node bin/www命令即可,此时服务端已运行。
  2. 第二种,使用pm2进行运维。首先安装pm2工具,之后运行pm2 start 路径/NBIotServer/bin/www,此时服务端已运行。
注意
  1. 服务端目前只能实现一次CoAP的通信流程,之后需要重新运行才可以重新通信,主要是端口变了没改回来,需要后续优化代码才可以。
  2. 服务端需要用到MongoDB,所以需要自己安装MongoDB,并根据需要更改后端关于MongoDB的设置,即数据库,document和账号密码。
  3. 服务端必须架构在公网上,因为NB网络只能访问到公网。

前端部署

前端采用vue开发,同样需要运行cnpm i --save命令安装所需的模块,前端可在本地部署或者服务器部署,已采用跨域处理。之后使用cnpm run dev命令即可运行前端。打开浏览器,输入http://ip 即可访问网站。

注意

前端需要修改跨域部分的代码,ip需要做相应的修改。

嵌入式代码烧录说明

可随意使用stm32(arm m3内核)系列的硬件烧写该项目代码,由于需要发AT指令,所以需要stm32开发板需要有串口功能(一般会有)。由于本项目stm32发送何种指令受PC端控制,而PC端也是通过串口发送自定义命令(目前是采用发送1到9的数字)给stm32,stm32辨别后根据代码再发送相应的指令给bc95模块,因此stm32开发板还需要另外一个串口,一共两个串口。 本项目采用PA9、PA10做串口1用于发送AT指令给bc95,其中PA9为USART1 TX,PA10为USART1 RX;而PA2、PA3做串口2用于发送收发PC端指令,其中PA2为USART2 TX,PA3为USART2 RX。

请根据实际硬件来修改IO口的定义。

另,可能还有细节需要修改,并且后端代码需要进一步完善。

nbiot-cloud-server's People

Contributors

pangpangshui avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.