Giter Site home page Giter Site logo

lib-seat-manage's Introduction

图书馆座位智能管理系统

本项目硬件使用Arduino Uno开发板与PIR传感器,软件基于Vue.js (前端框架) + Node.js (后端) + Python (软硬件交互侦听)。主要功能是图书馆座位的预约、热度的统计和入/离座的检测。

Image

部署

硬件搭建

  • 使用Arduino Uno开发板(也可以换成其他类似的开发板),参考sketch.ino的管脚定义来接线。

  • 为方便接线,可以添加一块传感器扩展板(Shield)

  • 不要忘记给按钮接下拉电阻

const int Seat1PIRSensor 	= 12; // PIR传感器输入
const int Seat1RedLight 	= 10; // 红灯输出
const int Seat1YellowLight 	= 9;  // 黄灯输出
const int Seat1GreenLight 	= 8;  // 绿灯输出
const int Seat1CheckBtn 	= 7;  // 入座按钮输入
const int Seat1FreeBtn 		= 6;  // 座位释放按钮输入

网页端搭建

  • 如有需要,修改server/app.js中网页服务的端口

  • 修改server/web/js/my.js中的siteUrl为部署Node.js(Express)服务端的广域网地址

  • 运行Node.js服务器

    cd server
    node app.js

    也可以使用pm2来进行进程守护

    cd server
    pm2 start app.js

主机侦听器

  • 修改host/listener.py中的如下设置

    PORTX = "COM3" # 硬件连接的串口编号
    BPS = 9600 # 波特率,无特殊情况不修改
    TIMEX = 5 # 超时标准
    APIPATH = "http://localhost:8888/api/" # API地址,请修改到网页端对应地址
  • 运行侦听器

    cd host
    python listener.py

运行时介绍

一、项目简介

​ “图书馆座位管理系统”是一套基于物联网的软、硬件系统,其主要功能有:在网页上进行座位情况查看、座位预定并实时同步到硬件端;长时间未入座自动释放座位;人员暂离自动切换座位状态;座位热度统计,等等。

二、项目测试

​ 在宿主机打开用于监听硬件的脚本listener.py(起到网关的作用),连接硬件,在网页端进行座位预定操作:

img

​ 可以看到,当座位被预定后,电路状态转换,绿灯熄灭,黄灯亮起。

​ 此时,按下左侧的入座按钮(后期可以接入RFID刷卡模块),电路状态转换,绿灯熄灭,红灯亮起,代表有人入座。同时,网页端在Vue.js的帮助下无刷新自动更新座位状态。如果预定后长时间没有入座,该座位会被自动释放。

img

​ 当人员从座位上起身暂离后,PIR传感器检测不到人体,自动切换暂离状态,无需人手工操作。当人员离场时,按下右侧离开按钮,系统释放座位。每当座位有人预定时,该座位的热度值会加一。从而在一段时间的运行后,可以获得座位的热度图:

img

​ 后期,该图可以结合真实座位情况进行布局,从而直观地得知图书馆哪一个区域的座位比较受欢迎,就可以在那个区域多安排作为;某个座位一直没有人愿意坐,就可以检查是不是座位损坏了等等。这便是大数据的获得与使用。

三、附录

表1 – 串口指令体系
指令 含义
向Arduino写
1 设置座位1预定 / 暂离
2 设置座位1空闲
3 设置座位1忙
从Arduino读
R1A 座位1入座按钮被按下
R1B 座位1无人
R1C 座位1有人
R1D 座位1释放按钮被按下
表2 – 网页端接口
地址 类型 参数 作用
/api/status GET 获取当前座位 状态JSON
/api/book POST xh: 一卡通号 id: 座位号 预定座位
/api/set_leave POST id: 座位号 设置座位暂离
/api/set_busy POST id: 座位号 设置座位忙
/api/set_free POST id: 座位号 设置座位空闲
/api/release_all POST pw: 密码 释放所有座位

* 由于仅作demo使用,set系列接口均未添加安全认证

lib-seat-manage's People

Contributors

z0gsh1u avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

xinqing123

lib-seat-manage's Issues

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.