Skip to content

๐Ÿ—œ๏ธ A custom standing desk that you can control from the command line.

License

Notifications You must be signed in to change notification settings

alaingalvan/fig-standing-desk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

38 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Cover Image

Fig Table

License Donate

A repository with everything involved in the design and engineering of the Fig Table. This includes:

  • Server - A Rust HTTP server
  • Client - A Node.js CLI tool that you can easily send requests to the table from.
  • CAD - 3D model schematics for the outer table design.
Product Store Cost
Raspberry Pi 3 B+ w/ PSU Amazon $46.99
32 GB Micro SD Card Amazon $10.59
Relay Board Amazon $7.59
Female to Female GPIO Cables (40) Amazon $4.99
DC Power Pigtails (10) Amazon $5.28
12V 10A Power Supply Amazon $15.47
2x Linear Actuators Ebay $94.27
8' x 12" x 1" Plywood Lowes $36.98
Wood Glue Home Depot $4.47
Gray Stain Home Depot $15.54
Wood Satin Lacquer Home Depot $10.77
Aluminum 6063 Square Tube 4' x 6" X 6" X .125" Metal Supermarkets $60.00
Aluminum 6063 Square Tube 6' x 6" X 3" X .125" Metal Supermarkets $45.00
Aluminum 6063 Square Tube 4' x 4" X 4" X .125" Metal Supermarkets $26.66
Total w/o tax 383.94

Security

For security reasons your Pi should be set up with a firewall to only allow for requests from web ports:

sudo apt-get install ufw
ufw allow 80
ufw enable

Server

The application that runs on the Raspberry Pi 3 B+, creates an HTTP server at port 3007 that a client can POST to.

  • /api - POST API endpoint, you send the following schema.
type APIRequest = {
  // float that describes direction of the table.
  direction: number
  // milliseconds to perform action
  time: number
}

Compiling

Instructions come from this guide.

# Step 1: Install the C cross toolchain
sudo apt-get install -qq gcc-arm-linux-gnueabihf

# Step 2: Install the cross compiled standard crates
rustup target add armv7-unknown-linux-gnueabihf

# Step 3: Configure cargo for cross compilation
mkdir -p ~/.cargo
cat >>~/.cargo/config <<EOF\n[target.armv7-unknown-linux-gnueabihf]\nlinker = "arm-linux-gnueabihf-gcc"EOF

# Step 4: Build
cargo build --target=armv7-unknown-linux-gnueabihf

Deploying

Wire your Pi as follows:

Physical Pin Description Motor Controller
31 GPIO 6 Actuator 1 Up
33 GPIO 13 Actuator 1 Down
35 GPIO 19 Actuator 2 Up
37 GPIO 26 Actuator 2 Down
2 - 5V
39 - GND

Install Raspian lite, and configure it for your keyboard/country since by default it's set to the UK.

Then cd to the standing desk server distribution.

# Download the server
wget https://github.com/alaingalvan/fig-standing-desk/raw/master/server/dist/fig-table-server

# Configure either iptables or an nginx reverse proxy
sudo iptables -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-port 3007

# Run the server as root.
sudo ./fig-table-server

# Create a service that includes the server.
cat >>/etc/init/table-server.conf <<EOF\n exec ~/fig-standing-desk/fig-table-server EOF
sudo ln -s /etc/init/table-server.conf /etc/init.d/table-server
sudo service table-server start

Client

CLI Animation

A CLI application that's meant to be installed as a global module on node.

git clone git@github.com:alaingalvan/fig-standing-desk.git
npm i client -g
๐Ÿ fig-table Node.js CLI

Usage:
    fig-table <number>            Move table up by x centimeters
    fig-table [options]

Options:
    -h, --help                    Display this message
    -v, --version                 Print version info and exit
    -c, --config <ip-address>     Configure the app with a unique ip.

CAD

Blender files used to design and CNC the table.