Skip to the content
2 layers110 × 70 mmSensing Device, the printed circuit board in 3D

Sensing Device

YueChengPeng/MagDock1

The vision is to develop a new input interface, which supports rich interaction inputs and can be configured to be used in various scenarios to boost user experience, promote working efficiency, spark creative…

Size
110 × 70 mm
Copper layers
2
Thickness
1.6 mm
Parts
20
Nets
21
Pads
65
Tracks, vias
125, 5
Pours
1
Routed
Yes
KiCad
KiCad 7 (file 20221018)
Created
14 Jan 2024
Updated
5 Mar 2024

Overview

Sensing Device is an open-source printed circuit board by YueChengPeng, from the YueChengPeng/MagDock repository on GitHub. It is a 2-layer board of 110 × 70 mm with 20 parts on 21 nets, routed with 125 tracks and 5 vias.

Its parts include 8 resistors, 4 capacitors, 2 ICs, 2 connectors and 2 switches.

README

README.md

MagDock: a modular and customizable tangible inputs interface

teaser

OVERVIEW

One Sentence Explanation

A customizable and reconfigurable haptic modular input interface for computers.

Problem being Solved

Interacting with computers nowadays, either via touchscreens or keyboards (which are basically all buttons) is BORING!

The vision is to develop a new input interface, which supports rich interaction inputs and can be configured to be used in various scenarios to boost user experience, promote working efficiency, spark creative expression, enable precise input, provide interesting haptic feedback, etc.

The Proposed Solution

solution_sensing

The input device consists of two parts: a base (left) and various tactile input components (right). To use, simply snap one input component onto the receptor of the base, which can automatically identify the component and read real-time inputs from it.

solution_sensing This input device can be directly used with laptops, pads, phones, etc. But to meet the requirements for the TECHIN514 course, I made a mockup of the computer using Raspberry Pi. To demonstrate the input potentials, I used a drawing web app (using P5.js on the browser of the Raspberry Pi) as a demonstration to showcase the potential of my design in supporting creative expressions (To be more specific, the joystick component is used to move the brush, the slider to adjust the width of the brush, the rotary knob to change the brush color, and the switch to clear the canvas).

This is just a glimpse of the application! __Other potential applications include software extension inputs (e.g. shortcuts in PS, AI, Figma), music controllers/synthesizers (e.g. volume, mix controls), tailored game controllers (e.g. joysticks), sleek controllers for your next robot, etc.

Working Video

https://youtu.be/ztausAnTfQE

SYSTEM ARCHITECTURE

Details on the sensor device and the display device be elaborated in later sections. This is an overview of how the system architecture looks like:

architecture

Highlights

  • Digital signal processing algorithms (explained in the "SENSOR DEVICE" section) are implemented on the ESP32S3 to convert 3-axis magnetic field data to interaction data.
  • BLE communication is used between the ESP32S3 XIAO and Raspberry Pi 4B to send real-time interaction data.
  • Websocket communication is used to realize real-time bidirectional data communication between the front-end app and the backend Python server.

SENSOR DEVICE

BOM

Schematic Diagram

sensor_schematic

Gallery

sensing_1 sensing_2 sensing_3

Details

🧲 🧲 ❤️ it's all about magnets ❤️ 🧲 🧲

Magnets, magnets, magnets, magnets! Hooray! In this project, magnets are without doubt the protagonist! It's used as:

  • Providing haptic feedback on the input components (inspired by Mechamagnets).
  • Providing the snapping force between the input components and the sensor base.
  • Serving as the conductor. As shown in the image, each input component has a resistor embedded in it - it's a cheap and simple alternative to NFC tags - it allows the sensor device to identify which component is attached to the base. The resistor is snap to the magnet, which in turn snap to the screws fixed on the main PCB, thus forming a conductive path. Then, a simple voltage divider circuit is enough to let the MCU recognize different input components.
  • Serving as the input trigger: when users interact with the inputs, the position of certain embedded magnets will change, enabling the 3-axis hall effect sensor to track its interaction state.

DSP to convert 3-axis magnetic field data to interaction data

Each input component has three kinds of magnets:

  • Haptic feedback provider.
  • "Snapper" to base.
  • Input trigger.

The input trigger moves along with the moving part of the input component, causing the magnetic field to change:

hall_effect_sense

Yes.. but how to interpret the raw three-axis magnetic field data?

dsp

  • Firstly the raw data goes through a moving average filter.
  • Then, for discrete inputs (including slider, rotary knob, and toggle switch), I documented the average reading of the TLV493D sensor with the input component's moving part in different positions. Then, given a new reading from the sensor, the algorithm will find the shortest Euclidean distance between the new vector and pre-collected vectors in the dataset, thus identifying the moving part's position. This algorithm is inspired by the RAG method (the vector in this case is text embeddings) in the LLM.
  • For continuous inputs (the joystick), I documented the sensor reading with the joystick pointing in different directions. The results were typical sinusoidal functions in the x and y direction (the Bx and By are used to configure the direction of the joystick, while the Bz is used to identify whether the joystick is moved away from the center point). Therefore, given a By and Bx value, I can first compare the Bx with the baseline to tell whether it's in [0, pi] or [pi, 2pi], then by calculating arccos(By), I can get the solution of the angle of the joystick.

In conclusion, this sensor device features a single sensor for configuring diverse inputs from different input devices.

DISPLAY DEVICE

BOM

Schematic Diagram

display_schematic

Gallery

display_2 display_3 display_4

Details

The display device is built around the Raspberry Pi. It runs a Python backend and a frontend using P5.js. The Python reads inputs from a button (capture screenshot) and controls the x27 stepper motor directly via four GPIOs (which is not safe to do so, but the x27 stepper motor consumes little current and is safe to drive using mere GPIOs on the Raspberry Pi. Otherwise H-Bridge should be used, such as the TB6612 IC). The needle of the motor indicates the current stroke width of the brush. A 7-inch LCD display is plugged into the Raspberry Pi using an HDMI cable to show the canvas of the P5.js. An LED is used to indicate if the button is pressed and a screenshot is captured.

BATTERY CONSIDERATIONS

Sensor Device

sensor_power sensor_sensitivity

usage modes

  • __Sleep: if the sensor detects no reading change for 5 min, switch to sleep mode. In this mode, 20% of the time will be used to be Active without BLE (to detect whether there is a reading change); and 80% of the time will be in deep sleep.
  • Sensing: active sensing mode, collect sensor data and send data to display device via BLE. In this mode, the MCU would always be active with BLE to guarantee a fluent user experience.

reflections

  • As a peripheral device of computers like keyboards and mice, I want my device can be used for around a week without charging. So I determine my "days of use" metric based on my application scenario.
  • Any battery size under 10cm * 5cm is acceptable since my device is something you would put on the table for a long time, but not carry with you a lot. I also made the size of my sensing device relatively large because in this way users can better interact with those tangible inputs, allowing it to provide a better hand feel.
  • The battery tradeoff: although the battery size can be relatively large, the major consideration would be the cost (larger battery capacity, more expensive). So the first tradeoff I made would be to choose a 2000mAh Lipo battery, which balances cost and battery capacity.
  • Other potential tradeoffs can be: when the data transfer rate is low, the power consumption will be low as well, but in my application case, it’ll cause a negative user experience, which can be an important tradeoff.
  • After analyzing my power, I learned that both the processor and sensor can run on very low energy consumption modes (some sensors provide low power modes as well). These features can be used to optimize power consumption.

Display Device

display_power display_sensitivity

usage modes

  • Idle mode: not receiving data from the processor for 5 minutes, idle the Pi and disable HDMI (turn the screen off) to save power
  • Interactive mode: perform intended drawing functionalities (receive sensor data, plot graph via p5.js, and other interactive inputs/outputs: e.g. LED, button, and stepper motor).

reflections

  • After analyzing, I found that Raspberry Pi consumes TONS of power, and it is also very picky on the power supply: the Pi4B requires a good quality USB-C power supply capable of delivering 5V at 3A https://github.com/YueChengPeng/MagDocker/blob/main/datasheet/raspberry-pi-4-datasheet.pdf. I found no Lipo battery or power bank that can supply a current this large. Therefore, it’s better to power it directly via USB-C power cables but not batteries. A good display also consumes a lot of power. Given that, the "days of use" will be "forever" as long as you have the power plugged in.

  • The usage of power cables is a good tradeoff considering user experience.

    • Cost: large-capacity batteries (even imagine there does exist one that supports 3A output) are obviously more expensive than a simple USB-C charger.
    • Portability: small size (lightweight) and large capacity (work longer) obviously cannot be achieved at the same time. If we want the Pi to work longer, the battery size will hinder better portability. But with the USB-C charger, this will be a non-issue.

BUDGET SUMMARY

Sensor Device ComponentsPriceNumberTotal Price
XIAO ESP32S37.4917.49
2000mAh Lipo battery13.99113.99
Button0.510.5
Switch0.6410.64
SMD LED0.2710.27
TLV493DA1B6HTSA21.511.5
JST-PH 2-Pin SMT Right Angle Connector0.7510.75
Acrylic enclosure18.99118.99
Magnets (8mm and 3mm)12112
Resistors & Capacitors0.510.5
Sum56.63
Display Device ComponentsPriceNumberTotal Price
Raspberry Pi 4B35135
stepper motor515
Button0.510.5
LED0.410.4
JST connectors111
7inch display45.99145.99
Acrylic enclosure515
Sum92.89
Total Sum149.52
Total Sum Purchased by GIX97.32

FUTURE WORKS

  • Enrich the tangible input components library.
  • Change the component identification mechanism: maybe small NFC tags are strong substitutions.
  • Increase receptors of the sensor base! Originally I envisioned something like the dock on the IOS/MacOS that consisted of a long receptor of many icons (components, in my case). Due to the time limit, I could only implement a version with only one receptor. It will definitely be interesting to have a, e.g. four receptor base, where users can configure different combinations of components under different work scenarios.
  • Fully open source my design and provide more detailed steps to replicate this work. Also include a user guide on how to design the user's tangible inputs (e.g. the middle "haptic" layer of the input components can be changed on the fly to configure different haptic feedback).
  • Implement a driver software, so that this input interface can be used on software on my computer. In the software, users can dynamically reconfigure the DSP algorithm for their customized components.

Parts

20
QtyValueFootprintReferences
3100ΩResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR5, R7, R8
21.2kΩResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR4, R6
2100 nFCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC2, C3
2200 pFCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC1, C4
24.3kΩResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR1, R3
13.7v Lipo batteryConnector_JST:JST_ZE_SM02B-ZESS-TB_1x02-1MP_P1.50mm_HorizontalBT1
165ΩResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR2
1ID_PADScrew_connector:40mm_rectangle_M3J2
1LS R976LED_SMD:LED_0805_2012Metric_Pad1.15x1.40mm_HandSolderD1
1PWR_PADConnector_JST:JST_NV_B02P-NV_1x02_P5.00mm_VerticalJ1
1SW_SPDTButton_Switch_THT:SWITCH_THT_SPDT_11MA1QS1SW2
1SW_SPSTButton_Switch_THT:SW_PUSH-12mmSW1
1TLV493DPackage_TO_SOT_SMD:SOT-23-6U2
1~XIAO ESP32 THT:XIAO_ESP32_SENSEU1

More from YueChengPeng/MagDock

3
  • 2 layers35.8 × 23.4 mmBreakout, the printed circuit board in 3D

    Breakout

    YueChengPeng/MagDock

    The vision is to develop a new input interface, which supports rich interaction inputs and can be configured to be used in various scenarios to boost user experience, promote working efficiency, spark creative…

    10 parts1
  • 2 layers46 × 50 mmDisplay rasp, the printed circuit board in 3D

    Display rasp

    YueChengPeng/MagDock

    The vision is to develop a new input interface, which supports rich interaction inputs and can be configured to be used in various scenarios to boost user experience, promote working efficiency, spark creative…

    7 parts1
  • 2 layers14.2 × 9.1 mmChip 6pin breakout, the printed circuit board in 3D

    Chip 6pin breakout

    YueChengPeng/MagDock

    The vision is to develop a new input interface, which supports rich interaction inputs and can be configured to be used in various scenarios to boost user experience, promote working efficiency, spark creative…

    3 parts1

Similar boards

  • 2 layers66.9 × 74.5 mmDeskHop Rev1, the printed circuit board in 3D

    DeskHop Rev1

    hrvach/deskhop

    Fast Desktop Switching Device

    20 parts7.9kGPL-3.0
  • 2 layers86.4 × 64.8 mmSlot machine, the printed circuit board in 3D

    Slot machine

    google/google-ctf

    Google CTF

    20 parts5.1kApache-2.0
  • 2 layers36.2 × 26.8 mmEsp32 minimal, the printed circuit board in 3D

    Esp32 minimal

    atopile/atopile

    Design circuit boards with code! ✨ Get software-like design reuse 🚀, validation, version control and collaboration in hardware; starting with electronics ⚡️

    20 parts4kMIT
  • 2 layers108.1 × 393.8 mmSweep compact ble, the printed circuit board in 3D

    Sweep compact ble

    davidphilipbarr/Sweep

    Sweep - a small promicro based keyboard inspired by the Ferris.

    20 parts2.1k
  • 2 layers26 × 15.9 mmTPS54340 Buck Regulator, the printed circuit board in 3D

    TPS54340 Buck Regulator

    rusefi/rusefi

    rusefi - GPL internal combustion engine control unit

    20 parts1.2k
  • 2 layers67.6 × 30.5 mmRgb to hdmi, the printed circuit board in 3D

    Rgb to hdmi

    hoglet67/RGBtoHDMI

    Bare-metal Raspberry Pi project that provides pixel-perfect sampling of Retro Computer RGB/YUV video and conversion to HDMI

    20 parts1kGPL-3.0
  • 2 layers44.3 × 28.7 mmLin bus adapter esp32, the printed circuit board in 3D

    Lin bus adapter esp32

    hackclub/OnBoard

    💡 Join 1,000 teenagers and make your first PCB with a $100 grant!

    20 parts915
  • 2 layers89.5 × 61.6 mmFreeDeck TH 2020-02, the printed circuit board in 3D

    FreeDeck TH 2020-02

    FreeYourStream/freedeck-hardware

    all the stuff you need to build your own FreeDeck

    20 parts772

Questions

How big is the Sensing Device PCB?

It measures 110 × 70 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Sensing Device use?

20 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Sensing Device KiCad files?

From the YueChengPeng/MagDock repository on GitHub, at the commit this page was made from: the board is pcb/Sensing Device/Sensing Device.kicad_pcb and its schematic pcb/Display Device/display_rasp/display_rasp.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Sensing Device design in my own project?

Its repository states no licence, so its author keeps all rights: ask YueChengPeng before reusing the design.