1
0

Initial commit

This commit is contained in:
2025-09-16 21:41:15 +02:00
commit 430a4491d2
3 changed files with 13754 additions and 0 deletions

72
Readme.md Normal file
View File

@@ -0,0 +1,72 @@
# SmartCube V1
**SmartCube** is a tiny, customizable desk toy built with an ESP8266 D1 Mini. It can display messages on an OLED, monitor battery voltage, control a buzzer, and respond to button presses.
---
## 1⃣ Clone the Repository
If you are on **Windows**, open **Command Prompt (CMD)**:
1. Press **Win + R**, type `cmd`, and press **Enter**.
2. Navigate to the folder where you want to store the project (optional):
```bash
cd C:\Users\YourUsername\Downloads
```
3. Clone the repo:
```bash
git clone https://git.kopic.hr/tomislav/SmartCube_ESPHome
cd SmartCube_ESPHome
```
This downloads all the files for your SmartCube.
---
## 2⃣ Install Python
1. Download Python 3.13+ from [python.org](https://www.python.org/downloads/).
2. During installation, **check “Add Python to PATH”**.
3. Verify installation in CMD:
```bash
python --version
```
---
## 3⃣ Install ESPHome
Install ESPHome using Pythons package manager:
```bash
pip install esphome
```
Check installation:
```bash
esphome version
```
---
## 4⃣ Flash the SmartCube
1. Connect your D1 Mini to your PC using a **data-capable micro-USB cable**.
2. Upload the firmware:
```bash
esphome run smartcube.yaml
```
ESPHome will compile and flash the firmware.
3. After flashing, the cube will connect to the Wi-Fi you set in the config.
* If it fails, it will start a fallback AP named **SmartCube** with password **12345678**.
* Connect to this AP to configure your Wi-Fi.

13587
Roboto-Regular-8pt.bdf Normal file

File diff suppressed because it is too large Load Diff

95
smartcube.yaml Normal file
View File

@@ -0,0 +1,95 @@
esphome:
name: smartcube
esp8266:
board: d1_mini
framework:
version: recommended
# WiFi
wifi:
ssid: "YOUR_WIFI_SSID"
password: "YOUR_WIFI_PASSWORD"
ap:
ssid: "SmartCube"
password: "12345678"
captive_portal:
logger:
api:
ota:
- platform: esphome
- platform: web_server
# I2C for OLED
i2c:
sda: GPIO4 # D2
scl: GPIO5 # D1
scan: true
# Font (must be BDF)
font:
- id: my_font
file: "Roboto-Regular-8pt.bdf"
size: 8
# SSD1306 OLED
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
rotation: 180
lambda: |-
it.print(0, 0, id(my_font), "Hello SmartCube!");
# Buttons
binary_sensor:
- platform: gpio
pin:
number: GPIO12 # D6
mode: INPUT_PULLUP
inverted: true
name: "Button Left"
id: button_left
- platform: gpio
pin:
number: GPIO13 # D7
mode: INPUT_PULLUP
inverted: true
name: "Button Middle"
id: button_middle
- platform: gpio
pin:
number: GPIO15 # D8
mode: INPUT_PULLUP
inverted: true
name: "Button Right"
id: button_right
# Buzzer
output:
- platform: gpio
pin: GPIO0 # D3
id: buzzer_output
switch:
- platform: output
name: "SmartCube Buzzer"
output: buzzer_output
# Battery voltage monitoring
sensor:
- platform: adc
pin: A0 # TOUT
name: "Battery Voltage"
id: battery_voltage
update_interval: 30s
filters:
- multiply: 6.93
unit_of_measurement: "V"