Merge branch 'main' of https://git.kopic.hr/tomislav/SmartCubeV1
This commit is contained in:
107
Readme.md
107
Readme.md
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
**SmartCube** is a tiny and customizable desk toy using the ESP8266 D1 Mini.
|
**SmartCube** is a tiny and customizable desk toy using the ESP8266 D1 Mini.
|
||||||
Built entirely from cheap, easy-to-find parts, it can connect to Wi-Fi and can be programmed to do just about anything:
|
Built entirely from cheap, easy-to-find parts, it can connect to Wi-Fi and can be programmed to do just about anything:
|
||||||
show notifications, display the weather, monitor stuff, show a clock, serve a web site, be a virtual pet or whatever else your caffeine-fueled brain can imagine.
|
show notifications, display the weather, monitor stuff, show a clock, serve a web site, mine crypto, be a virtual pet or whatever else your caffeine-fueled brain can imagine.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -17,23 +17,6 @@ show notifications, display the weather, monitor stuff, show a clock, serve a we
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Bill of Materials
|
|
||||||
|
|
||||||
| **Component** | **Quantity** | **Description** | **Notes** |
|
|
||||||
|---------------------------|--------------|-------------------------------------------|---------------------------------------------|
|
|
||||||
| ESP8266 D1 Mini | 1 | Microcontroller module | |
|
|
||||||
| SSD1306 OLED Display | 1 | 128x64 resolution, I2C interface | |
|
|
||||||
| 14250 Rechargeable Battery| 1 | Lithium-ion battery | Make sure you get the rechargeable type, most 14250 are not |
|
|
||||||
| TP4056 Module | 1 | Charging and protection circuit | Does not need to have a USB connector |
|
|
||||||
| 6x6 Push Buttons | 3 or 4 | Tactile push buttons | |
|
|
||||||
| 20mm Piezo Buzzer | 1 | Caseless buzzer for audio | |
|
|
||||||
| Resistors (10kΩ) | 3 or 4 | Pull-down resistors for buttons | Not reqired if you are using ESP32 |
|
|
||||||
| Wires | Several | Thin wires for connections | |
|
|
||||||
| Enclosure | 1 | 3D-printed case | 3D printable STL files are in `hardware/case/` |
|
|
||||||
| 2x6mm screw | 12 | Small screws for seembling the case | Does not have to be exactly 6mm long |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Demo Code Explanation
|
## Demo Code Explanation
|
||||||
|
|
||||||
This repository contains a basic "Hello, World!" project for the SmartCube.
|
This repository contains a basic "Hello, World!" project for the SmartCube.
|
||||||
@@ -82,11 +65,33 @@ This is meant to provide a minimal starting point for further development with t
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Assembly Instructions
|
## Bill of Materials
|
||||||
|
|
||||||
|
| **Component** | **Quantity** | **Description** | **Notes** |
|
||||||
|
|---------------------------|--------------|-------------------------------------------|---------------------------------------------|
|
||||||
|
| ESP8266 D1 Mini | 1 | Microcontroller module | |
|
||||||
|
| SSD1306 OLED Display | 1 | 128x64 resolution, I2C interface | |
|
||||||
|
| 14250 Rechargeable Battery| 1 | Lithium-ion battery | Make sure you get the rechargeable type, most 14250 are not |
|
||||||
|
| TP4056 Module | 1 | Charging and protection circuit | Does not need to have a USB connector |
|
||||||
|
| 6x6 Push Buttons | 3 or 4 | Tactile push buttons | |
|
||||||
|
| 20mm Piezo Buzzer | 1 | Caseless buzzer for audio | |
|
||||||
|
| Resistors (10kΩ) | 3 or 4 | Pull-down resistors for buttons | |
|
||||||
|
| Resistors (220kΩ and 56kΩ)| 1 | Voltage divider | For monitoring the battery charge level |
|
||||||
|
| Wires | Several | Thin wires for connections | I used wires from inside an old ethernet cable |
|
||||||
|
| Enclosure | 1 | 3D-printed case | 3D printable STL files are in `hardware/case/` |
|
||||||
|
| 2x6mm screw | 8 | Small screws for assembling the case | Does not have to be exactly 6mm long |
|
||||||
|
| 2x2mm screw | 4 | Small screws for the front | Mostly for cosmetic purposes |
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
1. Push the ESP8266 microcontroller in the ledge on the bottom [the cube body](https://git.kopic.hr/tomislav/SmartCubeV1/raw/branch/main/hardware/case/SmartCube_Body_3_button.stl) it sould 'click in' with the USB-C port facing the hole.
|
---
|
||||||
|
|
||||||
|
## Assembly Instructions
|
||||||
|
---
|
||||||
|
1. **Body**
|
||||||
|
|
||||||
|
Push the ESP8266 microcontroller in the ledge on the bottom [the cube body](https://git.kopic.hr/tomislav/SmartCubeV1/raw/branch/main/hardware/case/SmartCube_Body_3_button.stl), it should 'click in' with the USB-C port facing the hole.
|
||||||
|
|
||||||
Body with 3 or 4 button slots is available in the `hardware/case/`
|
Body with 3 or 4 button slots is available in the `hardware/case/`
|
||||||
|
|
||||||

|

|
||||||
@@ -95,29 +100,37 @@ Body with 3 or 4 button slots is available in the `hardware/case/`
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
2. **Buttons**: You can glue in the buttons to the top slots at this step and solder the resistors to them
|
---
|
||||||
|
|
||||||
|
2. **Buttons**
|
||||||
|
|
||||||
|
At this step, glue the buttons into the top slots and solder resistors to their outputs. You can connect the resistor outputs together, and don't forget to attach an extra wire to the button inputs, this will later be used to connect them to the 3.3V line.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Solder all of the buttons to the microcontroller:
|
Next, solder all of the button outputs to the microcontroller.
|
||||||
Pin numbers for buttons and other stuff is defined in the [example config](https://git.kopic.hr/tomislav/SmartCubeV1/src/branch/main/src/example_config.h) and the schematic for the [D1 Mini is here](https://git.kopic.hr/tomislav/SmartCubeV1/raw/branch/main/hardware/schematics/esp8266.png):
|
|
||||||
You don't have to follow my pin definition exactly but I find this the easiest way to assemble and fit everything in. 3 Button variant is the standard. If you are gonna go with the 4 button variant you will need to define this yourself.
|
|
||||||
|
|
||||||
- Button Left (PIN_BTN_L): (D6) GPIO12
|
Pin numbers for the buttons (and other components) are defined in the [example config](https://git.kopic.hr/tomislav/SmartCubeV1/src/branch/main/src/example_config.h), and the schematic for the [D1 Mini is here](https://git.kopic.hr/tomislav/SmartCubeV1/raw/branch/main/hardware/schematics/esp8266.png).
|
||||||
- Button Middle (PIN_BTN_M): (D7) GPIO13
|
You don't have to follow my exact pin definitions, but I've found this setup to be the easiest way to assemble and fit everything in. The 3-button variant is the standard. If you decide to go with 4 buttons, you'll need to define the extra pin yourself in the code.
|
||||||
- Button Right (PIN_BTN_R): (D8) GPIO15
|
|
||||||
|
* Button Left (PIN_BTN_L): (D6) GPIO12
|
||||||
|
* Button Middle (PIN_BTN_M): (D7) GPIO13
|
||||||
|
* Button Right (PIN_BTN_R): (D8) GPIO15
|
||||||
|
|
||||||
|
Finally, solder the GND wire to the resistor outputs and connect 3.3V to the button inputs.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
---
|
||||||
|
3. **OLED Display**
|
||||||
|
|
||||||
3. **OLED Display**: Crew in or glue the SSD1306 to the [front part of the cube](https://git.kopic.hr/tomislav/SmartCubeV1/raw/branch/main/hardware/case/SmartCube_Front.stl) solder the 4 wires to the OLED display, make sure you have some extra lenght, 4-5cm sould be more than enough
|
Screw in the 2x2mm screws and hot glue the SSD1306 to the [front part of the cube](https://git.kopic.hr/tomislav/SmartCubeV1/raw/branch/main/hardware/case/SmartCube_Front.stl) solder the 4 wires to the OLED display, make sure you have some extra length, 4-5cm should be more than enough
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
The OLED display must be connected via I2C on pins:
|
||||||
The OLED display must to be connected via I2C on pins:
|
|
||||||
- **SDA**: D2 (GPIO4)
|
- **SDA**: D2 (GPIO4)
|
||||||
- **SCL**: D1 (GPIO5)
|
- **SCL**: D1 (GPIO5)
|
||||||
- **GND**: GND
|
- **GND**: GND
|
||||||
@@ -125,15 +138,32 @@ The OLED display must to be connected via I2C on pins:
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
4. **Buzzer**: Glue in the buzzer to the [back part of the cube](https://git.kopic.hr/tomislav/SmartCubeV1/raw/branch/main/hardware/case/SmartCube_Back_Speaker_Side_Hole.stl)
|
---
|
||||||
|
4. **Buzzer**
|
||||||
|
|
||||||
|
Glue in the buzzer to the [back part of the cube](https://git.kopic.hr/tomislav/SmartCubeV1/raw/branch/main/hardware/case/SmartCube_Back_Speaker_Side_Hole.stl) with superglue
|
||||||
|
|
||||||
|
As defined in the [example config](https://git.kopic.hr/tomislav/SmartCubeV1/src/branch/main/src/example_config.h) connect:
|
||||||
|
- the positive wire of the buzzer to the 3.3V
|
||||||
|
- the negative wire to PIN_BUZZER (D3) GPIO0
|
||||||
|
|
||||||

|

|
||||||
|
---
|
||||||
|
|
||||||
5. **Power Supply Setup**:
|
**Battery Setup**
|
||||||
- Battery is not required and you can skip this step if you want to but it is much cuter when it's portable. A single 600mAh 14250 lasts about 24 hours.
|
|
||||||
- Solder the 14250 battery to the TP4056 module input pins.
|
The battery is optional. Your SmartCube will work fine when powered via USB; however, adding one makes it portable (and much cuter).
|
||||||
- Wire the output of the TP4056 to the **3.3V pin** on the D1 Mini to power the device.
|
|
||||||
- Connect the **5V output pin** from the D1 Mini to the **input port** on the TP4056 module to allow charging trough the Data USB port on the ESP8266.
|
A single 700 mAh 14250 battery lasts about 24 hours. Keep in mind there's currently no way to manually power the Cube off, it will continue running until the battery is depleted. The TP4056 prevents the cell from being completely drained and should protect it from damage.
|
||||||
|
|
||||||
|
* Solder the 14250 battery to the **TP4056 input pins**.
|
||||||
|
* Wire the **TP4056 output** to the **3.3V pin** on the D1 Mini to power the device.
|
||||||
|
* Connect the **5V output pin** from the D1 Mini to the **TP4056 input port** to allow charging through the USB data port on the ESP8266.
|
||||||
|
* *(Optional)* Add a **voltage divider** to monitor battery level on the ESP8266 **A0 pin**:
|
||||||
|
* **R1 = 220kΩ** (between battery positive and A0)
|
||||||
|
* **R2 = 56kΩ** (between A0 and GND)
|
||||||
|
|
||||||
|
This scales the battery voltage safely down for measurement (~0-0.85V).
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -147,10 +177,11 @@ The OLED display must to be connected via I2C on pins:
|
|||||||
|
|
||||||
- This is still a work in progress
|
- This is still a work in progress
|
||||||
- Everything is pretty tightly packed in there and it's a mess. But it's not as hard to make as it looks.
|
- Everything is pretty tightly packed in there and it's a mess. But it's not as hard to make as it looks.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- Ensure all connections are secure. Hot glue is your friend.
|
- Ensure all connections are secure and isolated. Hot glue is your friend.
|
||||||
- Test the circuit thoroughly before placing and glueing it in the enclosure.
|
- Test the circuit thoroughly before placing and gluing it in the enclosure.
|
||||||
- Battery is the trickiest part to fit in, it's best to glue the charging module directly to it and put it in the case last
|
- Battery is the trickiest part to fit in, it's best to glue the charging module directly to it and put it in the case last
|
||||||
|
|
||||||
For questions or additional details, feel free to reach out! I would love to hear some feedback.
|
For questions or additional details, feel free to reach out! I would love to hear some feedback.
|
||||||
|
Reference in New Issue
Block a user