Skip to content

Commit 8ad7bfe

Browse files
committed
update
1 parent 86f3ef4 commit 8ad7bfe

File tree

13 files changed

+9762
-8759
lines changed

13 files changed

+9762
-8759
lines changed

.devcontainer/esphome/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM esphome/esphome:latest
2+
3+
# Create a non-root user
4+
RUN adduser --disabled-password --gecos '' vscode && \
5+
usermod -aG dialout vscode && \
6+
mkdir -p /home/vscode/.esphome && \
7+
chown -R vscode:vscode /home/vscode/.esphome
8+
9+
USER vscode
10+
WORKDIR /workspace
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "ESPHome",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"context": ".."
6+
},
7+
"runArgs": [
8+
"--privileged",
9+
"--network=host"
10+
],
11+
"settings": {
12+
"terminal.integrated.defaultProfile.linux": "/bin/bash"
13+
},
14+
"extensions": [
15+
"esphome.vscode-esphome"
16+
],
17+
"remoteUser": "vscode"
18+
}

.devcontainer/devcontainer.json renamed to .devcontainer/kibot/devcontainer.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
{
2-
"name": "devContainer",
2+
"name": "KiBot",
33
"image": "ghcr.io/inti-cmnb/kicad9_auto_full:latest",
44
"runArgs": [
55
"-v",
66
"/var/run/docker.sock:/var/run/docker.sock"
77
],
8-
"postCreateCommand": "bash ./.devcontainer/post-create.sh",
98
"customizations": {
109
"vscode": {
1110
"extensions": [
1211
"danielmeza.kicad-syntax-highlighter",
13-
"ESPHome.esphome-vscode",
1412
"argmaster.gerber-x3-x2-format-support",
1513
"ms-python.python",
16-
"ms-python.vscode-pylance",
1714
"github.vscode-github-actions"
1815
]
1916
}

.devcontainer/post-create.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ name: Release
22

33
on:
44
push:
5-
paths:
6-
- '**.kicad_sch'
7-
- '**.kicad_pcb'
5+
branches:
6+
- main
7+
- develop
88
pull_request:
9-
paths:
10-
- '**.kicad_sch'
11-
- '**.kicad_pcb'
12-
9+
branches:
10+
- main
11+
- develop
12+
1313
jobs:
1414
release:
1515
runs-on: ubuntu-latest
1616
container:
1717
image: ghcr.io/inti-cmnb/kicad9_auto_full:latest
18-
# permissions:
19-
# contents: write
18+
permissions:
19+
contents: write
2020
steps:
2121
- name: Checkout
2222
uses: actions/checkout@v4

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ current state: untested :warning:
44

55
inspired by [joshr120/PD-Stepper](https://github.com/joshr120/PD-Stepper) but being fully open hardware/software.
66

7-
Stepper motor controller using Trinamic TMC2209, ESP32-S3 and USB-PD mountable onto any NEMA17 motor.
7+
Stepper motor controller using Trinamic TMC2208, ESP32-S3 and USB-PD mountable onto any NEMA17 motor.
88

99
## Main Features:
1010
- **ESP32-S3**
1111
- alternatively a LM555 pulse generator can be used.
1212
- **USB Power Delivery** providing up to 20V operation
1313
- alternatively 9-24 Volt external supply
14-
- **TMC2209** silent stepper motor driver
15-
- optional
14+
- **TMC2208** silent stepper motor driver
15+
- optional
1616
- rotary encoder:
1717
- **AS5048B** 14-Bit angular position sensor
1818
- **MPU-9250** 9-axis motion sensor
@@ -43,9 +43,17 @@ The complete BOM is available in different formats:
4343

4444
#### Layout
4545

46-
| Top | Bottom |
47-
| ---------------------------------------------- | ---------------------------------------------------- |
48-
| ![top view](pcb/docs/img/esp32stepper-top.svg) | ![bottom view](pcb/docs/img/esp32stepper-bottom.svg) |
46+
<table border="0" width="100%">
47+
<tr>
48+
<th><strong>Top</strong></th>
49+
<th><strong>Bottom</strong></th>
50+
</tr>
51+
<tr>
52+
<td><img src="pcb/docs/img/esp32stepper-top.svg" alt="PCB top view" width="400"></td>
53+
<td><img src="pcb/docs/img/esp32stepper-bottom.svg" alt="PCB bottom view" width="400"></td>
54+
</tr>
55+
</table>
56+
4957

5058
All fabrication files needed to produce this PCB are located within the [release package](https://github.com/nerdyscout/esp32stepper/releases).
5159

_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
title: ESP32STEPPER
2222
email: stefan.herold@posteo.de
23-
description: "Stepper motor controller using TMC2209, ESP32-S3 and USB-PD mountable onto any NEMA17 motor."
23+
description: "Stepper motor controller using TMC2208, ESP32-S3 and USB-PD mountable onto any NEMA17 motor."
2424
baseurl: "esp32stepper" # the subpath of your site, e.g. /blog
2525
url: "" # the base hostname & protocol for your site, e.g. http://example.com
2626
github_username: nerdyscout

firmware/esphome/tmc2208.yaml

Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
1+
2+
external_components:
3+
- source: github://slimcdk/esphome-custom-components
4+
components: [tmc2208_hub, tmc2208, stepper]
5+
# - source:
6+
# type: local
7+
# path: components
8+
9+
esphome:
10+
name: esp32stepper
11+
project:
12+
name: nerdyscout.esp32stepper
13+
version: "1.1"
14+
platformio_options:
15+
board_build.flash_mode: dio
16+
upload_speed: 921600
17+
on_boot:
18+
- tmc2208.configure:
19+
microsteps: 4
20+
direction: clockwise
21+
interpolation: true
22+
- tmc2208.currents:
23+
irun: 16
24+
ihold: 0
25+
tpowerdown: 0
26+
iholddelay: 0
27+
standstill_mode: freewheeling
28+
29+
- output.turn_off: #Microstep resolution configuration (internal pull-down resistors: MS2, MS1: 00: 1/8, 01: 1/32, 10: 1/64 11: 1/16
30+
id: MS1_pin
31+
- output.turn_off:
32+
id: MS2_pin
33+
34+
#set PD voltage # 5V 9V 12V 15V 20V
35+
- output.turn_off: # 1 0 0 0 0
36+
id: CFG1_pin
37+
- output.turn_on: # - 0 0 1 1
38+
id: CFG2_pin
39+
- output.turn_off: # - 0 1 1 0
40+
id: CFG3_pin
41+
42+
esp32:
43+
board: esp32-s3-devkitc-1
44+
# variant: esp32s3
45+
framework:
46+
type: arduino
47+
48+
# This should point to the public location of this yaml file.
49+
dashboard_import:
50+
package_import_url: github://nerdyscout/esp32stepper/firmware/esphome/tmc22208.yaml#main
51+
import_full_config: false # or true
52+
53+
ota:
54+
platform: esphome
55+
password: !secret ota_password
56+
57+
wifi:
58+
ssid: !secret wifi_ssid
59+
password: !secret wifi_password
60+
61+
web_server:
62+
version: 3
63+
port: 80
64+
65+
captive_portal:
66+
67+
mqtt:
68+
broker: !secret mqtt_broker
69+
username: !secret mqtt_username
70+
password: !secret mqtt_password
71+
72+
api:
73+
password: !secret api_password
74+
75+
logger:
76+
# level: DEBUG
77+
78+
i2c:
79+
sda: GPIO46
80+
scl: GPIO45
81+
scan: true
82+
# id: bus_a
83+
84+
uart:
85+
- id: serial_extern
86+
tx_pin: GPIO43
87+
rx_pin: GPIO44
88+
baud_rate: 115200
89+
- id: serial_stepper
90+
tx_pin: GPIO17
91+
rx_pin: GPIO18
92+
baud_rate: 115200
93+
94+
tmc2208_hub:
95+
id: tmc_hub
96+
uart_id: serial_stepper
97+
98+
output:
99+
- platform: gpio
100+
pin: GPIO21
101+
id: MS1_pin
102+
- platform: gpio
103+
pin: GPIO13
104+
id: MS2_pin
105+
106+
- platform: gpio
107+
pin: GPIO14
108+
id: CFG1_pin
109+
- platform: gpio
110+
pin: GPIO12
111+
id: CFG2_pin
112+
- platform: gpio
113+
pin: GPIO11
114+
id: CFG3_pin
115+
116+
light:
117+
- platform: neopixelbus
118+
type: GRB
119+
variant: WS2812
120+
pin: GPIO10
121+
num_leds: 2
122+
id: led_rgb
123+
- platform: partition
124+
name: "RGB LED 1"
125+
segments:
126+
- id: led_rgb
127+
from: 0
128+
to: 0
129+
- platform: partition
130+
name: "RGB LED 2"
131+
segments:
132+
- id: led_rgb
133+
from: 1
134+
to: 1
135+
136+
stepper:
137+
- platform: tmc2208
138+
id: driver
139+
tmc2208_hub_id: tmc_hub
140+
max_speed: 800 steps/s
141+
acceleration: 1500 steps/s^2
142+
deceleration: 1500 steps/s^2
143+
rsense: 100 mOhm
144+
vsense: False
145+
enn_pin: GPIO09 # Enable not input pin for the driver.
146+
diag_pin: GPIO08 # Error signaling from the driver.
147+
index_pin: GPIO07 # Serves as stepping feedback from the internal step pulse generator
148+
step_pin: GPIO02 # Provides stepping pulses to the driver.
149+
dir_pin: GPIO04 # Controls direction of the motor.
150+
on_status:
151+
- logger.log:
152+
format: "Driver is reporting an update! (code %d)"
153+
args: ["code"]
154+
# only supported by TMC2209
155+
# on_stall:
156+
# - logger.log: "Motor stalled!"
157+
# - stepper.stop: driver
158+
# - light.turn_on:
159+
# id: led_rgb
160+
# transition_length: 0s
161+
# - delay: 250ms
162+
# - light.turn_off:
163+
# id: led_rgb
164+
# transition_length: 1s
165+
166+
button:
167+
- platform: restart
168+
name: Restart
169+
170+
- platform: template
171+
name: Stop
172+
on_press:
173+
- stepper.stop: driver
174+
175+
binary_sensor:
176+
- platform: gpio
177+
name: Button 1
178+
pin:
179+
number: GPIO47
180+
mode: INPUT
181+
inverted: true
182+
id: btn1
183+
filters:
184+
- delayed_on: 10ms
185+
186+
- platform: gpio
187+
name: Button 2
188+
id: btn2
189+
pin:
190+
number: GPIO48
191+
mode: INPUT
192+
inverted: true
193+
filters:
194+
- delayed_on: 10ms
195+
196+
display:
197+
- platform: ssd1306_i2c
198+
model: "SSD1306 128x64"
199+
lambda: |-
200+
it.print(0, 0, id(roboto), "Hello World!");
201+
202+
sensor:
203+
# - platform: bme280_i2c
204+
# update_interval: 10s
205+
# temperature:
206+
# name: "BME280 Temperature"
207+
# pressure:
208+
# name: "BME280 Pressure"
209+
# humidity:
210+
# name: "BME280 Humidity"
211+
212+
- platform: adc
213+
name: "VBUS Voltage"
214+
pin: GPIO05
215+
update_interval: 2s
216+
attenuation: 12dB
217+
filters:
218+
- multiply: 8.47742
219+
220+
- platform: rotary_encoder
221+
name: "Rotary Encoder"
222+
pin_a: GPIO15
223+
pin_b: GPIO16
224+
pin_reset: GPIO03
225+
id: rotary
226+
# on_value:
227+
# then:
228+
# - stepper.set_target:
229+
# id: driver
230+
# target: !lambda "return id(rotary)->current_position;"
231+
232+
number:
233+
- platform: template
234+
name: Target position
235+
min_value: -10000
236+
max_value: 10000
237+
step: 10
238+
lambda: return id(driver)->current_position;
239+
update_interval: 1s
240+
set_action:
241+
- stepper.set_target:
242+
id: driver
243+
target: !lambda "return x;"
244+
245+
font:
246+
- file: "gfonts://Roboto"
247+
id: roboto
248+
size: 10

0 commit comments

Comments
 (0)