This repository contains the firmware for a custom-built automated electric armchair.
Detailed project information and documentation is available on the website:
Note: In the current version V2.2, only the esp-project in the board_single/ folder and the custom libraries in common/ are used.
The projects in the folders board_control/
and board_motorctl/
are no longer compatible and are legacy from V2.1.
Photo of the built frame that carries the armchair
The firmware is designed for an ESP32 microcontroller integrated into a custom PCB developed here: Project Work 2020
A detailed diagram illustrating all components and wiring can be found in the file connection-plan.drawio.pdf.
For more details refer to the documentation on the website.
A custom pcb with relays and protection for controlling the 2 motors that adjust the rest positions of the armchair was created in this repository as well:
Date: 2024.09.08
Folder: hardware/chairAdjust-relayBoard
Schematic: hardware/chairAdjust-relayBoard/export/schematic.pdf
For this project ESP-IDF v4.4.4 is required
#download esp-idf
yay -S esp-idf #alternatively clone the esp-idf repository from github
#run installation script in installed folder
/opt/esp-idf/install.sh
git clone git@github.com:Jonny999999/armchair_fw
Navigate to the react-app directory and install required packages using npm:
cd react-app
npm install
When flashing to the ESP32, the files in the react-app/build/
folder are written to a SPIFFS partition.
These files are then served via HTTP in the Wi-Fi network "armchair" created by the ESP32.
Initially, or when changing the React code, you need to manually build the React app:
cd react-app
#compile
npm run build
#remove unwanted license file (filename too long for spiffs)
rm build/static/js/main.8f9aec76.js.LICENSE.txt
Note: For testing the app locally, use npm start
source /opt/esp-idf/export.sh
Run once per terminal
cd board_single
idf.py build
idf.py flash
To view log output for debugging, follow the same steps as in the Upload section, but run:
idf.py monitor
[long press]
opens menu for selecting the desired mode (JOYSTICK for driving)[3x click]
enters JOYSTICK mode[rotate]
adjusts the leg rest position [press + rotate]
at the same time: adjusts the back rest positionEncoder Event | Action |
---|---|
rotate left | Move leg rest up by 10% |
rotate right | Move leg rest DOWN by 10% |
press + rotate left | Move back rest down by 5% |
press + rotate left | Move back rest up by 5% |
Note: first tick is ignored -> quickly rotate 2 ticks at first
Count | Type | Action | Description |
---|---|---|---|
1x long | switch mode | MENU_MODE_SELECT | Open menu for selecting the current control mode |
1x | control | [MASSAGE] freeze input | When in massage mode: lock or unlock joystick input at current position. |
1x short, 1x long | switch mode | ADJUST-CHAIR | Switch to mode where the armchair leg and backrest are controlled via joystick. |
2x | toggle mode | IDLE <=> previous | Enable/disable chair armchair (e.g., enable after startup or switch to previous mode after timeout). |
3x | switch mode | JOYSTICK | Switch to JOYSTICK mode, to control armchair using joystick (default). |
4x | switch mode | HTTP | Switch to remote control via web-app http://191.168.4.1 in wifi armchair . |
5x | switch mode | MENU_SETTINGS | Open menu to set various options, controlled via display and rotary encoder. |
6x | switch mode | MASSAGE | Switch to MASSAGE mode where armchair shakes differently, depending on joystick position. |
7x | |||
8x | toggle option | deceleration limit | Disable/enable deceleration limit (default on) => more responsive. |
12x | toggle option | alt stick mapping | Toggle between default and alternative stick mapping (reverse direction swapped). |
Encoder Event | Current Menu | Action |
---|---|---|
long press | main-menu | Exit MENU mode to previous control mode (e.g., JOYSTICK). |
long press | value-select | Exit to main-menu without changing the value. |
click | main-menu | Select currently highlighted menu item -> enter value-select screen. |
click | value-select | Confirm value / run action. |
rotate | main-menu | Scroll through menu items. |
rotate | value-select | Change value. |
Control the armchair via a virtual joystick on the web interface.
Usage:
armchair
, no password.