Giter Site home page Giter Site logo

idrees95 / project-sensors Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2.24 MB

This web application is build for collecting data from BBC microbit sensors and displaying room temperature, light levels during day/night and store all incoming information from the sensors in the database overtime.

Home Page: http://localhost:1337/sensors/index

Python 10.51% JavaScript 30.31% CSS 10.13% HTML 49.05%

project-sensors's Introduction

MicroBit

image info

Description
This web application is build for collecting data from BBC microbit sensors and displaying room temperature, light levels during day/night and store all incoming information from the sensors in the database overtime.

Web application functionalities

  • A database to store the data
  • Possibility to watch the data collection in a terminal as it collects live.
  • Web Application with minimalistic design to make it as clear as possible for the eyes of the user.
  • Show the stored information with the help of a web application.
  • Measure temperature/light level during the day.
  • Show the highest and lowest value of the temperature/light during the day.
  • Possible to add as many number of micro bits and rooms as user likes.
  • Color coded values.
  • Login function to show the history of the measurements and only accessible through admin.
  • Only admin able to add sensor/s.

Guide for installation

Web browsers

You can use any common browser(not internet Explorer).

Terminal

A terminal is also needed. You can use e.g cygwin or powershell.

NodeJS

Node Js must be installed on your system, follow the link to install for desired operating system. Node

Npm

Project Microbit is built with npm, navigate to project to project folder in the terminal and type npm install to get all the used dependencies in this project.

Python and PIP

The script is in python so python must be installed on your system. Pip is also used and the dependencies choosen are Serial, pytz and MYSQL-connector.
pip install pyserial
pip install mysql-connector
pip install pytz

MySql

Database is created with Mysql and you must have MYSQL installed on your system. You can install MYSQL with the help of this link depending on your operating system MYSQL

Guide for running the program

Step1: Setup the database

Setup the database with setup.sql and after ddl.sql. First navigate to projectfolder/sql then run the following commands in the terminal.

  • First run this command to create database sensors.
    mysql -uroot -p < setup.sql
    and entering root password that you have chosen during MYSQL installation.
  • Run this command to create tables.
    mysql -uroot -p sensors < ddl.sql
Step2: Transfer code to sensors

The python script can be uploaded to the sensors by using an online pythoneditor e.g https://python.microbit.org/v/2.0 Transfer LoadReceiver.py to a sensor that you want it to be a reciever(R) to recieve data from other microbits. Transfer LoadSender.py to your other microbit/s. Give each microbit a unique id and specify number of seconds between each reading.

Step3: Connecting the microbits

Connect the reciever microbit with usb to pc and it should indicate/display "R" and don't forget to specify which port you are using in connect.py file on line 14 port = "/dev/ttyS8" if not sure which port then run check.py python3 check.py in the terminal. Connect the other microbits to a battery source provided with microbits and they should display their id's.

step4: Running the web application

In e.g cygwin or Powershell terminal navigate your way to where the project is located and run "node index.js" to start the server.

step5: Open the web application

Start the website by typing http://localhost:1337/sensors/index.

step6: log in to register number of microbits

user: admin
pass: admin
Navigate to "Add sensors" and add the desired number of sensors.
NOTE: in field sensors id be sure to enter the id that displays on the sensors otherwise the data will be lost and not saved in the database.

step7: Start collecting data

Open a terminal and navigate yourself to the project folder and to start collecting data, just run "python3 connect.py".

Step8: See the information

The information can be shown if clicked on sensors names.


Incase you get error "cannot open port", there is a python script which loops through all your ports and shows which port your reciever"R" is using. Navigate to project folder and run python3 check.py and it will show you the port that you are using.


You can read more about BBC Microbit here BBC microbit

project-sensors's People

Contributors

idrees95 avatar

Watchers

 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.