Skip to content

Commit

Permalink
Merge pull request #11 from spothings/dev-doc
Browse files Browse the repository at this point in the history
update documentation
  • Loading branch information
bukanspot authored May 31, 2023
2 parents 1353057 + 92c2f05 commit ec4439c
Show file tree
Hide file tree
Showing 10 changed files with 173 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.obsidian/*
.vscode/*
.idea/*
19 changes: 17 additions & 2 deletions doc/readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
## Requetment
- [ESP8266](http://www.nodemcu.com/index_en.html)
<img src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fjoy-it.net%2Ffiles%2Ffiles%2FProdukte%2FSBC-NodeMCU-ESP32%2FSBC-NodeMCU-ESP32-01.png" width="20%" />
### Hardware
| Name | Image | Url |
|--------| -------| ----|
| NodeMCU ESP8266 | <img src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fjoy-it.net%2Ffiles%2Ffiles%2FProdukte%2FSBC-NodeMCU-ESP32%2FSBC-NodeMCU-ESP32-01.png" width="20%" /> | http://www.nodemcu.com/index_en.html |
| Relay 1 Channel 5v | <img src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fcdn-reichelt.de%2Fbilder%2Fweb%2Fxxl_ws%2FA300%2FKY-019.png&f=1&nofb=1&ipt=b196d3b1547f34c2e0ffed3746d0f691eaa8c0acf7aaf456cf8fe0f44c9796d8&ipo=images" width="20%" /> |
| DLR Sensor | <img src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fwire.lk%2Fwp-content%2Fuploads%2F2021%2F07%2FLDR.png&f=1&nofb=1&ipt=6ac5883ca65b18f85aaf1e30fb41dd4b9dd3f42b69ffe4c3a88abbec724bac6a&ipo=images" width="20%" /> |
| Lamp | <img src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fi.pinimg.com%2Foriginals%2F5a%2Fa5%2F0f%2F5aa50fd522de3b341ef3d9ab86fb04db.png&f=1&nofb=1&ipt=59d21a893f9107a73794be569144a9a6c0e6d0683580917087e4cb72b938626e&ipo=images" width="10%" /> |

### Library
- Arduino.h
- ESP8266WiFi.h
- [NTPClient.h](https://github.com/arduino-libraries/NTPClient)
- WiFiUdp.h

#### Additional board manager
- http://arduino.esp8266.com/stable/package_esp8266com_index.json
- https://dl.espressif.com/dl/package_esp32_index.json

## Reference
- [Get Started](https://randomnerdtutorials.com/getting-started-with-esp8266-wifi-transceiver-review/) : Getting Started with ESP8266 NodeMCU Development Board
Expand Down
80 changes: 80 additions & 0 deletions flow/algorith-flow.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<mxfile host="app.diagrams.net" modified="2023-05-31T12:51:05.532Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.57" etag="lKbIGArKh4BCBcr4kupM" version="21.3.6" type="device">
<diagram name="Page-1" id="zaD-GI3mffgObWOHan0p">
<mxGraphModel dx="1095" dy="788" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="zB2rAmLrpXZOc29l35ww-3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="zB2rAmLrpXZOc29l35ww-1" target="zB2rAmLrpXZOc29l35ww-2">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="425" y="200" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="zB2rAmLrpXZOc29l35ww-1" value="start" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.terminator;whiteSpace=wrap;" vertex="1" parent="1">
<mxGeometry x="375" y="80" width="100" height="60" as="geometry" />
</mxCell>
<mxCell id="zB2rAmLrpXZOc29l35ww-21" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="zB2rAmLrpXZOc29l35ww-2" target="zB2rAmLrpXZOc29l35ww-4">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="zB2rAmLrpXZOc29l35ww-2" value="&lt;br&gt;NTP time" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.database;whiteSpace=wrap;" vertex="1" parent="1">
<mxGeometry x="395" y="190" width="60" height="60" as="geometry" />
</mxCell>
<mxCell id="zB2rAmLrpXZOc29l35ww-8" value="true" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="zB2rAmLrpXZOc29l35ww-4" target="zB2rAmLrpXZOc29l35ww-7">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="zB2rAmLrpXZOc29l35ww-22" value="false" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="zB2rAmLrpXZOc29l35ww-4" target="zB2rAmLrpXZOc29l35ww-2">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="320" y="345" />
<mxPoint x="320" y="220" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="zB2rAmLrpXZOc29l35ww-4" value="night" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.decision;whiteSpace=wrap;" vertex="1" parent="1">
<mxGeometry x="375" y="295" width="100" height="100" as="geometry" />
</mxCell>
<mxCell id="zB2rAmLrpXZOc29l35ww-15" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="zB2rAmLrpXZOc29l35ww-7" target="zB2rAmLrpXZOc29l35ww-11">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="zB2rAmLrpXZOc29l35ww-7" value="LDR sensor" style="whiteSpace=wrap;html=1;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="365" y="455" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="zB2rAmLrpXZOc29l35ww-14" value="true" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="zB2rAmLrpXZOc29l35ww-11" target="zB2rAmLrpXZOc29l35ww-13">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="zB2rAmLrpXZOc29l35ww-17" value="false" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="zB2rAmLrpXZOc29l35ww-11" target="zB2rAmLrpXZOc29l35ww-16">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="zB2rAmLrpXZOc29l35ww-11" value="bright" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.decision;whiteSpace=wrap;" vertex="1" parent="1">
<mxGeometry x="375" y="565" width="100" height="100" as="geometry" />
</mxCell>
<mxCell id="zB2rAmLrpXZOc29l35ww-19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="zB2rAmLrpXZOc29l35ww-13" target="zB2rAmLrpXZOc29l35ww-18">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="230" y="705" />
<mxPoint x="425" y="705" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="zB2rAmLrpXZOc29l35ww-13" value="turn on lamp" style="whiteSpace=wrap;html=1;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="170" y="585" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="zB2rAmLrpXZOc29l35ww-20" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="zB2rAmLrpXZOc29l35ww-16" target="zB2rAmLrpXZOc29l35ww-18">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="610" y="705" />
<mxPoint x="425" y="705" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="zB2rAmLrpXZOc29l35ww-16" value="turn off lamp" style="whiteSpace=wrap;html=1;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="545" y="585" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="zB2rAmLrpXZOc29l35ww-18" value="end" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.terminator;whiteSpace=wrap;" vertex="1" parent="1">
<mxGeometry x="375" y="745" width="100" height="60" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
46 changes: 46 additions & 0 deletions flow/overview-schema.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<mxfile host="app.diagrams.net" modified="2023-05-31T12:29:35.914Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.57" etag="sH5lZpPmcbuI2eviV0qd" version="21.3.6" type="device">
<diagram name="Page-1" id="qtdBskX85ttaHC62LSLy">
<mxGraphModel dx="1095" dy="788" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="vOM8OKsdxTkJchFtbWwN-12" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="vOM8OKsdxTkJchFtbWwN-8" target="vOM8OKsdxTkJchFtbWwN-11">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="vOM8OKsdxTkJchFtbWwN-8" value="NodeMCU (ESP8266)" style="shape=image;verticalLabelPosition=bottom;verticalAlign=top;imageAspect=0;image=https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fcdn-reichelt.de%2Fbilder%2Fweb%2Fxxl_ws%2FA300%2FDEBO_JT_ESP8266_01.png&amp;f=1&amp;nofb=1&amp;ipt=7db2daa70805bfaf9051a659c9f795a703a42ba0506b9bf50ebe9ba3f4f206ed&amp;ipo=images" vertex="1" parent="1">
<mxGeometry x="358" y="340" width="135" height="100" as="geometry" />
</mxCell>
<mxCell id="vOM8OKsdxTkJchFtbWwN-10" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="vOM8OKsdxTkJchFtbWwN-9" target="vOM8OKsdxTkJchFtbWwN-8">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="vOM8OKsdxTkJchFtbWwN-9" value="LDR Sensor" style="shape=image;verticalLabelPosition=bottom;verticalAlign=top;imageAspect=0;image=https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fwire.lk%2Fwp-content%2Fuploads%2F2021%2F07%2FLDR.png&amp;f=1&amp;nofb=1&amp;ipt=6ac5883ca65b18f85aaf1e30fb41dd4b9dd3f42b69ffe4c3a88abbec724bac6a&amp;ipo=images" vertex="1" parent="1">
<mxGeometry x="130" y="340" width="100" height="100" as="geometry" />
</mxCell>
<mxCell id="vOM8OKsdxTkJchFtbWwN-14" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="vOM8OKsdxTkJchFtbWwN-11" target="vOM8OKsdxTkJchFtbWwN-13">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="vOM8OKsdxTkJchFtbWwN-11" value="Relay 1 channel 5v" style="shape=image;verticalLabelPosition=bottom;verticalAlign=top;imageAspect=0;image=https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fcdn-reichelt.de%2Fbilder%2Fweb%2Fxxl_ws%2FA300%2FKY-019.png&amp;f=1&amp;nofb=1&amp;ipt=b196d3b1547f34c2e0ffed3746d0f691eaa8c0acf7aaf456cf8fe0f44c9796d8&amp;ipo=images" vertex="1" parent="1">
<mxGeometry x="620" y="344.94" width="110" height="90.12" as="geometry" />
</mxCell>
<mxCell id="vOM8OKsdxTkJchFtbWwN-13" value="Lamp" style="shape=image;verticalLabelPosition=top;verticalAlign=bottom;imageAspect=0;image=https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fi.pinimg.com%2Foriginals%2F5a%2Fa5%2F0f%2F5aa50fd522de3b341ef3d9ab86fb04db.png&amp;f=1&amp;nofb=1&amp;ipt=59d21a893f9107a73794be569144a9a6c0e6d0683580917087e4cb72b938626e&amp;ipo=images;spacingTop=1;labelBorderColor=none;labelBackgroundColor=none;labelPosition=center;align=center;" vertex="1" parent="1">
<mxGeometry x="646" y="160.60000000000002" width="58" height="101.21" as="geometry" />
</mxCell>
<mxCell id="vOM8OKsdxTkJchFtbWwN-16" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="vOM8OKsdxTkJchFtbWwN-15" target="vOM8OKsdxTkJchFtbWwN-8">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="vOM8OKsdxTkJchFtbWwN-15" value="&lt;br&gt;NTP time" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.database;whiteSpace=wrap;labelPosition=center;verticalLabelPosition=middle;align=center;verticalAlign=middle;" vertex="1" parent="1">
<mxGeometry x="500" y="181.20999999999998" width="60" height="60" as="geometry" />
</mxCell>
<mxCell id="vOM8OKsdxTkJchFtbWwN-17" value="" style="html=1;verticalLabelPosition=bottom;align=center;labelBackgroundColor=#ffffff;verticalAlign=top;strokeWidth=2;strokeColor=#0080F0;shadow=0;dashed=0;shape=mxgraph.ios7.icons.wifi;pointerEvents=1;rotation=-40;" vertex="1" parent="1">
<mxGeometry x="320.00000000000006" y="300" width="44.86" height="31.72" as="geometry" />
</mxCell>
<mxCell id="vOM8OKsdxTkJchFtbWwN-18" value="WiFi Router" style="image;image=img/lib/clip_art/networking/Router_Icon_128x128.png;labelPosition=center;verticalLabelPosition=top;align=center;verticalAlign=bottom;labelBackgroundColor=none;" vertex="1" parent="1">
<mxGeometry x="170.6" y="160.60000000000002" width="59.4" height="59.4" as="geometry" />
</mxCell>
<mxCell id="vOM8OKsdxTkJchFtbWwN-20" value="" style="html=1;verticalLabelPosition=bottom;align=center;labelBackgroundColor=#ffffff;verticalAlign=top;strokeWidth=2;strokeColor=#0080F0;shadow=0;dashed=0;shape=mxgraph.ios7.icons.wifi;pointerEvents=1;rotation=-220;" vertex="1" parent="1">
<mxGeometry x="240" y="230.09" width="44.86" height="31.72" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
9 changes: 8 additions & 1 deletion flow/readme.md
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
_we have nothing in here, come back tomorrow_
## Project Overview
*(text generate with chat GPT)* 😄
![overview-schema](/img/overview-schema.drawio.png)

The schematic diagram illustrates the interconnectedness of various IoT devices, including an ESP8266 microcontroller, an LDR sensor, a 5V 1-channel relay, a lamp, an NTP time module, and a WiFi router. At the center of the diagram is the ESP8266, serving as the main control unit. The LDR sensor detects ambient light levels and sends this information to the ESP8266. Based on the sensor readings, the ESP8266 triggers the 5V 1-channel relay to control the lamp, either turning it on or off. The NTP time module allows the ESP8266 to synchronize its internal clock with the global time server, ensuring accurate time-based operations. Finally, the WiFi router facilitates the communication between the ESP8266 and other connected devices, enabling remote control and monitoring of the IoT system. Together, these components form an integrated network, enabling automated and responsive functionality for the IoT system.
![algorith-flow](/img/algorith-flow.drawio.png)

The flowchart depicts the sequence of processes or algorithms for a project. It begins with a condition that checks if it is daytime. If it is daytime, the flowchart indicates that no action is taken. However, if it is nighttime, the flowchart proceeds to the next step, which involves checking the ambient light level. If the light level is bright, the flowchart directs the system to turn on the lamp. This flowchart outlines a simple but effective algorithm that ensures the lamp is only activated during the night when it is dark outside.
Binary file added img/algorith-flow.drawio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/overview-schema.drawio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion img/readme.md

This file was deleted.

File renamed without changes
28 changes: 21 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,35 @@
---

## About Project
The project aims to develop a sophisticated controller capable of efficiently managing the control of lamps using an integrated system comprising an LDF sensor, PIR sensor, real-time clock, and a Telegram bot. By combining these elements, the controller will be able to autonomously detect ambient light levels through the LDF sensor, trigger the lamps based on movement sensed by the PIR sensor, schedule lighting operations using the real-time clock, and provide remote control and monitoring capabilities through the Telegram bot. This comprehensive solution will enhance energy efficiency, convenience, and security by seamlessly adapting to changing lighting requirements and allowing users to effortlessly interact with the system via the Telegram platform.
I have created a project solely for exploring the features of the NodeMCU microcontroller (ESP8266) and fulfilling my desire to create an automatic backlight for my desk that adjusts according to day and night time using an LDR sensor. Several variables are stored in the ESP8266 EEPROM to prevent data loss upon restart. Additionally, I have incorporated a Telegram bot as an alternative method for remote control. I may consider adding more features in the future.

[![Development Status](https://img.shields.io/badge/status-in%20development-red)](https://github.com/spothings/strip-table/tree/dev)
[![Development Status](https://img.shields.io/badge/status-development-red)](https://github.com/spothings/strip-table/tree/dev)
![GitHub last commit](https://img.shields.io/github/last-commit/spothings/strip-table)

![strip_table_view](https://raw.githubusercontent.com/spothings/strip-table/dev/img/strip_table_view.jpg?token=GHSAT0AAAAAACA4XFCHEAU7CGJOGLGLDWOCZDQJMRA)
![strip-table-view](img/strip-table-view.jpg)

## Feature
- Turn on and off lamp with relay
- Using LDF to get light value
### Current
- Turn on and off the lights using relay
- Use NTP client to get value day or night
- Using the LDR sensor to get the light intensity

### Dev
- Using EEPROM to store data
- Using Telegram bot for remote control

## Development
- [Documentation](/doc)
- [Project Workflow](/flow)
- [Source Code](/sch/main)
- [Board Schematic](/sch)
- [PCB and Gerber File](/pcb)

## Contributor
[![Contributors](https://contributors-img.web.app/image?repo=spothings/strip-table)](https://github.com/spothings/strip-table/graphs/contributors)

## Donation
For those of you who want to make a donation, we would really appreciate it.
If you think this project is helpful, you can make a donation. For those of you who want to make a donation, we would really appreciate it. Donations can be made through [Buy Me a Coffee](https://www.buymeacoffee.com/bukanspot) and [PayPal](https://paypal.me/bukanspot).

Donations can be made through [Buy Me a Coffee](https://www.buymeacoffee.com/bukanspot) and [PayPal](https://paypal.me/bukanspot).
## License
This project is using [spothings template](https://github.com/spothings/spothings). Copyright, Privacy Policy and License also sourced from there.

0 comments on commit ec4439c

Please sign in to comment.