DIY Smart Desktop Companion
by Shahbaz Hashmi Ansari in Circuits > Robots
1043 Views, 9 Favorites, 0 Comments
DIY Smart Desktop Companion
Greetings everyone, and welcome back to my Instructables tutorial! In this project, we're building Desktop Companion V2, an upgraded version of my DIY desktop companion robot powered by the Seeed Studio XIAO ESP32-S3.
Desktop companion robots are a fun way to bring a little personality to your workspace. After building the first version, I wanted to take things further by improving the enclosure, adding touch interaction, and giving the robot physical movement using a servo motor.
The result is a compact, 3D-printed robot with an OLED display for animated eyes, a touch sensor for interaction, and a servo mechanism that brings the companion to life. I'll also show you how I used Seeed Studio CodeCraft to develop and flash the firmware, along with how to control the robot in standalone mode and through a Python script.
Project Overview:
In this tutorial, you'll learn:
- How to assemble a desktop companion robot using the Seeed Studio XIAO ESP32-S3.
- How to use Fusion360 for enclosure design.
- How to install an OLED display, touch sensor, and servo motor inside a custom 3D-printed enclosure.
- How to assemble the robot's body and servo-based movement mechanism.
- How to develop and flash firmware using Seeed Studio CodeCraft.
- How to implement animated eyes and touch-based interactions.
- How to test the robot in standalone mode.
- How to control the desktop companion using a Python script.
- How to bring all the hardware and software together to create your own interactive desk companion.
Whether you're interested in robotics, embedded systems, 3D printing, or just want a little robot on your desk, this project is a great way to explore how these technologies work together.
Now, let's get started and build Desktop Companion V2!
Supplies
Before starting, gather the following electronic components, tools, and software to build Desktop Companion V2.
Electronic Components Required
- Seeed Studio XIAO ESP32-S3
- 1.3-inch OLED Display
- TTP223 Touch Sensor
- Servo Motor
- Jumper Wires
- USB-C Data Cable
Mechanical Components and Tools
- 3D-Printed Enclosure
- PLA Filament
- Hot Glue Gun and Glue Sticks
- Soldering Iron and Solder Wire
- Wire Cutter or Precision Cutter
Software and Development Tools
- Seeed Studio CodeCraft
- Python
Once you have all the components ready, let's move on to preparing the 3D-printed enclosure and assembling the robot!
3D-printed Enclosure
The enclosure consists of two main parts: the robot's body and the base. I printed the body using yellow PLA filament and the base using black PLA filament to give the robot a contrasting look.
Print Settings
- Filament: PLA
- Nozzle Temperature: 205°C
- Bed Temperature: 60°C
- Layer Height: 0.2 mm
- Infill Density: 15%
These are standard starting settings for PLA. The exact settings may need slight adjustments depending on your filament brand and the geometry of the enclosure.
Once both parts are printed, remove any supports and check that the body and base fit together properly before moving on to the electronics assembly.
Installing the OLED Display and Touch Sensor
Start by installing the 1.3-inch OLED display into the front section of the 3D-printed body. Position the display carefully so that it sits properly in the designated opening and the screen remains visible from the outside.
Once aligned, use a small amount of hot glue to secure the display in place. Make sure the glue does not cover the visible screen or interfere with the display's connections.
Next, install the touch sensor in its designated position on the enclosure. Secure it with hot glue, ensuring that the sensing area remains accessible for touch interaction.
Before proceeding, check that both components are firmly mounted and that their wires have enough room inside the enclosure. Avoid pulling or bending the wires sharply, as this could damage the connections.
With the OLED display and touch sensor installed, the enclosure is ready for the next assembly step.
Where to Get Your PCBs Manufactured
This project is all about bringing a DIY electronics idea to life. And if you're working on your own electronics projects and need custom PCBs, NextPCB is worth checking out.
You can visit their website, upload your Gerber files, choose your PCB specifications and quantity, and get a quote for your order.
NextPCB also offers a range of PCB manufacturing services to support your next hardware project.
And here's a bonus for new users: you can get a $30 discount coupon after registering, according to the sponsor offer. Check the website for the applicable terms and eligibility.
Visit NextPCB here: https://www.nextpcb.com/
Thanks to NextPCB for sponsoring this part of the project!
Installing the Servo Motor
Next, install the servo motor that allows the desktop companion to move. Position the servo in its designated slot inside the 3D-printed body and make sure it is properly aligned with the movement mechanism.
Secure the servo in place, ensuring that it does not shift during operation. Once the servo is mounted, attach the servo arm to the base using hot glue, as shown in the assembly photos. Check that the arm is firmly attached and that the base can move with the servo.
Before closing the enclosure, rotate the mechanism gently by hand to check for any obstruction. Make sure the servo arm and base have enough clearance to move freely without hitting the body or the internal components.
With the servo motor installed and the base attached, the robot's movement mechanism is ready for the electronics and final assembly.
Wiring the Electronics
Once the OLED display, touch sensor, and servo motor are installed, it's time to connect them to the Seeed Studio XIAO ESP32-S3.
The connections are as follows:
1. Servo Motor
- Signal wire → GPIO 1
- VCC → 5V pin on the XIAO ESP32-S3
- GND → GND pin on the XIAO ESP32-S3
2. Touch Sensor
- Signal/OUT → GPIO 2
- VCC → 3V3 pin
- GND → GND pin
3. OLED Display
- SDA → GPIO 5
- SCL → GPIO 6
- VCC → 3V3 pin
- GND → GND pin
Use jumper wires to complete the connections, and double-check each wire before powering on the board. Make sure the components share a common ground.
Important: The servo can draw a significant amount of current, especially when it starts moving or encounters resistance. If the XIAO ESP32-S3 resets or the servo behaves unpredictably, use a suitable external 5V supply for the servo and connect its ground to the XIAO's ground. Ensure the touch sensor and OLED are compatible with 3.3V logic.
Once all the connections are complete, arrange the wires neatly inside the enclosure, keeping them clear of the servo's moving parts. You're now ready to mount the controller board and finish assembling the robot.
Completing the Assembly
Now it's time to bring all the parts together and finish assembling Desktop Companion V2.
First, carefully place the Seeed Studio XIAO ESP32-S3 inside the enclosure, making sure all the wires are connected properly and nothing interferes with the servo mechanism. Secure the board in its designated position.
Next, arrange the internal wiring neatly so that the wires don't get caught in the moving parts. Double-check the connections to the OLED display, touch sensor, and servo motor before closing the enclosure.
Once everything is in place, install the back cover of the robot's body. Make sure it fits properly without pinching any wires.
Finally, check that the servo arm is securely attached to the base and that the base can move freely. Give the enclosure a final inspection to ensure that all components are firmly mounted.
That's it! The hardware assembly of Desktop Companion V2 is complete. In the next step, we'll develop and flash the firmware using Seeed Studio CodeCraft to bring the robot to life.
Developing the Firmware With CodeCraft
I used Seeed Studio CodeCraft to generate and refine the firmware for Desktop Companion V2. I started with the prompt below, then iteratively updated the code to add standalone and PC-controlled modes, more personality states, and Python serial communication.
Initial prompt:
I'm using XIAO ESP32-S3 Sense. Please help me implement: Hey, I'm building a small desktop companion robot for a personal project and I need help writing the code for it. The brain is a Seeed Studio XIAO ESP32-S3. For now it's a simple test build — just one servo motor so I can prototype the head/arm movement, a small OLED screen so it has a face, and a touch sensor so I can interact with it by tapping it.
Here's how everything is wired up: the servo signal wire goes to GPIO1. The OLED is a 128x64 SH1106 display connected over I2C, with SDA on GPIO5 and SCL on GPIO6, at I2C address 0x3C. For the touch input, I'm using a touch sensor module connected to GPIO4, which outputs a digital HIGH or LOW signal, so please use digitalRead() instead of touchRead().
Use the Adafruit_GFX and Adafruit_SH110X libraries for the display, FluxGarage_RoboEyes for animated eyes, and ESP32Servo for the servo. The touch sensor should cycle through at least three personality modes, each with a distinct eye expression and servo behaviour. Include proper debouncing and keep the code organized into clear sections.
Follow-up prompt:
After testing the initial version, I provided the working firmware and Python client script to CodeCraft and asked it to build on the existing architecture rather than start from scratch. I moved the touch sensor to GPIO2 and expanded the firmware to support standalone personality modes, touch gestures, automatic inactivity states, and PC-controlled behaviour through USB serial. The PC sends STATE: messages to trigger distinct eye expressions and servo movements, with automatic fallback to standalone mode when communication stops.
I continued refining the generated code until the display, touch interactions, servo movement, and Python control worked together as intended.
You can try CodeCraft for free, or get 10% off CodeCraft Pro if you'd like to explore the same AI-assisted development workflow.
Once the firmware is ready, connect the XIAO ESP32-S3 to your computer, select the appropriate board and connection settings, and flash the code. Then move on to testing the robot in both standalone and PC-controlled modes.
Working Video & Tutorial
Congratulations! You’ve successfully built your DIY Smart Desktop Companion. A demonstration video of this project can be viewed here: Watch Now
Thank you for your interest in this project. If you have any questions or suggestions for future projects, please leave a comment, and I will do my best to assist you.
I will continue to update this instructable with new information. Don’t forget to follow me for updates on new projects and subscribe to my YouTube channel (YouTube: roboattic Lab) for more content. Thank you for your support.