Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
images
README.md
main.ino

README.md

Deskheight sensor

Simple arduino-based sensor to determine the height of my standing desk.

Workflow:

  1. main.ino: Attempt to connect to wifi network (blink WIFI LED while connecting, WIFI LED on when connected).
  2. main.ino: Determine desk height by measuring 3 times in rapid succession and taking the max value (this smooths out sensor readings).
  3. main.ino: Send a basic json payload with the deskheight to my home server (blink SUCCESS LED).
  4. main.ino: In case of any issues, blink ERROR LED.
  5. home server: listen on port and dump incoming json to file using logstash
  6. home server: for every incoming request, create according sensor in home-assistant using logstash
  7. home server: in home-assistant, use template sensor to determine whether desk is up or down based on sensor value.

Pictures

Deskheight sensor

Bill of Materials

Wiring Diagram

TODO :-)

Code

The code can be found in main.ino.

Requires some a secrets.h file that sits in the same directory that looks like:

#define SECRET_WIFI_SSID "myssid";
#define SECRET_WIFI_PASSWORD "mysecretpassword";
#define SECRET_HTTP_HOST "10.1.1.1"
#define SECRET_HTTP_PORT 1234
#define SECRET_HTTP_USER "secret-user"
#define SECRET_HTTP_PASSWORD "secret-password"
You can’t perform that action at this time.