项目作者: OrBin

项目描述 :
Smart bottle project for IoT course
高级语言: Python
项目地址: git://github.com/OrBin/Smart_Bottle.git
创建时间: 2018-06-04T14:53:02Z
项目社区:https://github.com/OrBin/Smart_Bottle

开源协议:MIT License

下载


Smart Bottle

This repository contains the code and fritzing scheme for a smart bottle project I’ve made for an IoT course in college.

The prototype uses a paper cup instead of an actual bottle due to issues in distance measurement.

Functionality

  • Water level measurement and display
  • Audible drinking reminders
  • Night light (Helps finding the bottle in the dark)
  • Temperature measurement and indication
  • Cloud connectivity and dashboard (Ubidots)

Hardware Requirements

  • 2 NodeMCU ESP8266 boards - one for the inputs and one for the outputs
  • A DHT11 temperature sensor (for temperature measurement outside the bottle)
  • A DS18B20 temperature sensor (for temperature measurement inside the bottle)
  • A photoresistor (for light measurement)
  • An HC-SR04 ultrasonic distance sensor (for water level measurement)
  • A piezo speaker (for drinking reminders)
  • An RGB LED (for temperature indication - red is too hot, green is fine and blue is too cold)
  • A 7-Segment display with TM1637 driver (for numerical water level display, in ml)
  • A yellow LED (for night light)

Software Requirements

  • NodeJS
  • Python 3.6 or above
  • The NodeMCU boards should have the latest version of MicroPython flashed
  • (Recommended) PyCharm with MicroPython plugin

Getting Started

Cloning the repository

git clone https://github.com/OrBin/Smart_Bottle.git --recursive

Installing the dependencies

  1. npm install
  2. pip install -r requirements.txt

Creating a configuration file

A configuration file config.json should be placed in directory src/common/.

Here is an example of how the configuration file should look:

  1. {
  2. "wifi": {
  3. "ssid": "MY_SSID",
  4. "password": "MY_PASSWORD",
  5. "connection_timeout_sec": 20
  6. },
  7. "ubidots": {
  8. "api_token": "MY_UBIDOTS_API_TOKEN",
  9. "device": "MY_UBIDOTS_DEVICE_NAME",
  10. "device_id": "MY_UBIDOTS_DEVICE_ID"
  11. },
  12. "behavior": {
  13. "measurements_interval_sec": 1,
  14. "temperature_range": {
  15. "min": 20,
  16. "max": 30
  17. },
  18. "external_temperature_allowed_offset": 5,
  19. "night_light_threshold": 40,
  20. "required_drinking_frequency_minutes": 1
  21. },
  22. "bottle": {
  23. "bottle_capacity_ml": 200,
  24. "ml_per_cm": 36.36,
  25. "bottle_height_cm": 10
  26. }
  27. }

Flashing

Connect the inputs board and run:

gulp inputs

Connect the outputs board and run:

gulp outputs

External Modules

This project uses some external modules for controlling components that the basic MicroPython libraries don’t include:

License

This project is licensed under the MIT License - see the LICENSE file for details