Skip to content

Commit

Permalink
Merge pull request gcormier#92 from tagno25/dev
Browse files Browse the repository at this point in the history
More esphome configuration notes
  • Loading branch information
gcormier authored Mar 21, 2022
2 parents 7d68775 + a5a242d commit 1cb3798
Show file tree
Hide file tree
Showing 3 changed files with 335 additions and 107 deletions.
109 changes: 2 additions & 107 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,112 +134,7 @@ To recall a memory slot you push the up button the number of times for that memo
This has been moved to [DIY.md](DIY.md)

# Serial commands
After the marker byte '<', there's the Command byte, then two fields of ascii integer digits.
Terminate each field with any non-digit character eg !,./ or a line-break.
missing digits are interpreted as a 0 so <L.. is valid and passes two 0s to the L command.
First field (position) can be any number up to a maximum of 65535, the second field (slot) has a maximum of 255.

```
data start (first byte)
char meaning
-----------------
< start Rx Marker
command (second byte)
cmd meaning
-----------------
+ increase
- decrease
= absolute
C Ask for current location
S Save location to (UpButton) EEPROM
s Save location to Downbutton EEPROM
L Load (Upbutton) location from EEPROM and move
l load Downbutton location from EEPROM and move
W Write arbitrary data to EEPROM
R Read arbitrary data from EEPROM
T play tone
position (third/fourth bytes or 1st digit field. max 65535)
cmd meaning
-----------------
+- relative to current position
=SsW absolute position
T tone frequency
CRLl (ignore)
push_addr (fifth byte or 2nd digit field. max 255)
cmd meaning
-----------------
SLlWwR EEPROM pushCount/slot
T tone duration/4 ms. (250 == 1s)
+-=C (ignore)
```

Examples
```
<W3000,3. # writes location 3 with height 3000.
<T3000,255. # plays a 3000Hz tone for 1sec
<C0.0. # reports current height
<+300.. # nudge desk up by 300
<L,5. # recall position from slot 2
<l,5. # recall position from down-button slot 2
<R.0/ # read eeprom slot 0
```
This has been moved to [Serial.md](Serial.md)

# esphome configuration
This is only an example for the Wemos D1 Mini. Any esphome compatible device can be used.

Do NOT use the 5V from the Megadesk to power your esphome controller. Megadesk does not have the ability to dissipate
the amount of heat produced by the linear regulators with a high-power device. These devices can requires 100-300mA of current. For comparison, the megadesk itself only requires 10-15mA.

There exists one device with a built-in buck converter that could take the 24V power - https://www.ezsbc.com/product/wifi01-sw/ (unaffiliated and not tested)

Connections will be
```
MISO -> RX
SCK -> TX
GND -> GND
```



```
name: megadesk
platform: ESP8266
board: d1_mini
logger:
api:
password: ""
ota:
password: ""
wifi:
ssid: "xxxxxxxxxxx"
password: "xxxxxxxxx"
ap:
ssid: "Desk Fallback Hotspot"
password: "xxxxxxxxxx"
captive_portal:
uart:
baud_rate: 115200
tx_pin: D0
switch:
- platform: uart
name: "Desk up"
data: '<L0,4.'
- platform: uart
name: "Desk down"
data: '<L0,3.'
- platform: uart
name: "Desk middle"
data: '<L0,5.'
```
esphome example configuration avalible at [esphome.md](esphome.md)
57 changes: 57 additions & 0 deletions Serial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Serial commands
After the marker byte '<', there's the Command byte, then two fields of ascii integer digits.
Terminate each field with any non-digit character eg !,./ or a line-break.
missing digits are interpreted as a 0 so <L.. is valid and passes two 0s to the L command.
First field (position) can be any number up to a maximum of 65535, the second field (slot) has a maximum of 255.

```
data start (first byte)
char meaning
-----------------
< start Rx Marker
command (second byte)
cmd meaning
-----------------
+ increase
- decrease
= absolute
C Ask for current location
S Save location to (UpButton) EEPROM
s Save location to Downbutton EEPROM
L Load (Upbutton) location from EEPROM and move
l load Downbutton location from EEPROM and move
W Write arbitrary data to EEPROM
R Read arbitrary data from EEPROM
T play tone
position (third/fourth bytes or 1st digit field. max 65535)
cmd meaning
-----------------
+- relative to current position
=SsW absolute position
T tone frequency
CRLl (ignore)
push_addr (fifth byte or 2nd digit field. max 255)
cmd meaning
-----------------
SLlWwR EEPROM pushCount/slot
T tone duration/4 ms. (250 == 1s)
+-=C (ignore)
```

Examples
```
<W3000,3. # writes location 3 with height 3000.
<T3000,255. # plays a 3000Hz tone for 1sec
<C0.0. # reports current height
<+300.. # nudge desk up by 300
<L,2. # recall position from slot 2
<l,2. # recall position from down-button slot 2
<R.0/ # read eeprom slot 0
```

# esphome configuration
esphome example configuration avalible at [esphome.md](esphome.md)
Loading

0 comments on commit 1cb3798

Please sign in to comment.