This shows you the differences between two versions of the page.
pm:prj2025:eradu:toma.dumitrescu [2025/05/03 22:09] toma.dumitrescu |
pm:prj2025:eradu:toma.dumitrescu [2025/05/04 14:16] (current) toma.dumitrescu |
||
---|---|---|---|
Line 12: | Line 12: | ||
{{:pm:prj2025:eradu:hardware_schema1.png?200|}} | {{:pm:prj2025:eradu:hardware_schema1.png?200|}} | ||
+ | |||
+ | \\ | ||
+ | - Battery/Charger: powers the system with a certain voltage \\ | ||
+ | - HW-131: regulator for the ESP8266, and also a test for the components functionalities \\ | ||
+ | - ESP8266: microcontroller where the code goes \\ | ||
+ | - Voltage Divider: the analog sensor is not necessarily designed for this kit, thus the voltage should be normalized for A0 \\ | ||
+ | - Distance sensor: measures the distance by calculating time between sending and receiving wave \\ | ||
+ | - OLED: the display where the number of people will be showed \\ | ||
+ | - SD Card: used for storing information (extension of current features) \\ | ||
+ | \\ | ||
+ | Flow: the system is charged, a person passes near the sensor, ADC generates an interruption, a voltage is recorded by A0, | ||
+ | the value is converted to a distance, and if the distance is in some interval, then increase the counter and display the number on the OLED. \\ | ||
**Software Schema:** | **Software Schema:** | ||
{{:pm:prj2025:eradu:software_schema2.png?200|}} | {{:pm:prj2025:eradu:software_schema2.png?200|}} | ||
+ | |||
+ | \\ | ||
+ | - Display: module that has functions related to the OLED \\ | ||
+ | - Sensor: module that implements a basic interface between the microcontroller and the sensor (functions for interruption, reading, converting) \\ | ||
+ | - ADC: module that implements an interface for the ADC circuit \\ | ||
+ | - Counter: module that implements functions for updating count global variable, and also reset \\ | ||
+ | - SPI: module that implements an interface with SPI for this project components \\ | ||
+ | - Main: module that controls logic and combines functions from the above modules \\ | ||
+ | \\ | ||
+ | Flow: the same as in the pseudocode that is presented below; data is taken from hardware (voltages, pressed buttons), and processed in the software layer | ||
+ | |||
===Hardware Design=== | ===Hardware Design=== | ||
---- | ---- | ||
- | **Components list:** | + | **Components list:** \\ |
- | DBGOLD 6F22 battery, HW-131 power supply platform, ESP8266 Wi-Fi microcontroller, Breadboard, Distance sensor GP2Y0A21YK0F, OLED GME12864-14, | + | - DBGOLD 6F22 battery \\ |
- | SD card, wires, resistors, USB/USB-C cable | + | - HW-131 power supply platform \\ |
+ | - ESP8266 Wi-Fi microcontroller \\ | ||
+ | - Breadboard \\ | ||
+ | - Distance sensor GP2Y0A21YK0F \\ | ||
+ | - OLED GME12864-14 \\ | ||
+ | - SD card \\ | ||
+ | - wires \\ | ||
+ | - resistors \\ | ||
+ | - USB/USB-C cable \\ | ||
**Electrical Schema (KiCAD):** | **Electrical Schema (KiCAD):** | ||
{{:pm:prj2025:eradu:hardware_mc.png?200|}} | {{:pm:prj2025:eradu:hardware_mc.png?200|}} | ||
+ | |||
+ | Notes: \\ | ||
+ | - The values of the resistors in the voltage divider can differ, the only condition is to limit sensor_out interval to A_in voltage interval \\ | ||
+ | - On the schema, a green dot means an intersection of wires, otherwise wires that cross other wires do not interact \\ | ||
**Signals (Canva):** | **Signals (Canva):** | ||
Line 32: | Line 67: | ||
Digital: SCK, SDA, CS, DC, RES, USB UART TX/RX, VIN \\ | Digital: SCK, SDA, CS, DC, RES, USB UART TX/RX, VIN \\ | ||
- | Analog: sensor_VO, A0 | + | Analog: sensor_VO, A0 \\ |
+ | |||
+ | \\ | ||
+ | Notes: \\ | ||
+ | - In the above graph, there is a plot of the expected voltages for V_O and A_in when a person passes at some distances | ||
===Software Design=== | ===Software Design=== | ||
---- | ---- | ||
- | **Mediu de dezvoltare:** | + | **IDE:** |
- PlatformIO and Arduino on Visual Studio Code \\ | - PlatformIO and Arduino on Visual Studio Code \\ | ||
- Board platform: Espressif 8266 \\ | - Board platform: Espressif 8266 \\ | ||
- | - Program upload: USB \\ | + | - Program upload: USB or by Wi-Fi \\ |
**Libraries:** | **Libraries:** | ||
Line 61: | Line 100: | ||
while True: | while True: | ||
d = ADC_detect_with_low_delay() | d = ADC_detect_with_low_delay() | ||
+ | |||
if d <= threshold: | if d <= threshold: | ||
count++ | count++ | ||
| | ||
+ | clear_display() | ||
SPI_display(count) | SPI_display(count) | ||
</code> | </code> | ||
Line 69: | Line 110: | ||
===Results=== | ===Results=== | ||
---- | ---- | ||
+ | - A device that counts the people passing at a threshold distance from the sensor | ||
===Conclusions=== | ===Conclusions=== | ||
---- | ---- | ||
+ | 1) Before starting implementation, all components should be verified for correct functioning | ||
===Resources=== | ===Resources=== | ||
Line 80: | Line 123: | ||
---- | ---- | ||
https://circuitdigest.com/microcontroller-projects/interfacing-ssd1306-oled-display-with-esp8266-nodemcu | https://circuitdigest.com/microcontroller-projects/interfacing-ssd1306-oled-display-with-esp8266-nodemcu | ||
+ | https://www.instructables.com/ESP8266-ADC-Analog-Sensors/ | ||
+ | |||