此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/scottbez1/smartknob
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

SmartKnob

SmartKnob is an open-source input device with software-configurable endstops and virtual detents.

A brushless gimbal motor is paired with a magnetic encoder to provide closed-loop torque feedback control, making it possible to dynamically create and adjust the feel of detents and endstops.

Join the Discord community to discuss the project with others, show off your build, or help answer each others' questions!

Build Status Build Status

Designs

SmartKnob View

The "SmartKnob View" is the premium SmartKnob experience with an integrated display shown in my demo video. Under active development.

🎉 Motors are now available! If you've been following this project, you'll know that the recommended motors went out of stock nearly immediately after it was published. Thanks to the community, we were able to identify the likely original manufacturer, and recently SparkFun Electronics has been getting them produced and regularly stocking them! (However, they've been selling out quickly each time they restock, so definitely sign up for backorder notifications if they're out of stock when you check). Thanks to everyone who helped search and investigate different motor options along the way!

Features:

  • 240x240 round LCD ("GC9A01"), protected by 39.5mm watch glass on rotor
  • BLDC gimbal motor, with a hollow shaft for mechanically & electrically connecting the LCD
  • Powered by ESP32-PICO-V3-02 (Lilygo TMicro32 Plus module)
  • PCB flexure and SMD resistors used as strain gauges for press detection (haptic feedback provided via the motor)
  • 8 side-firing RGB LEDs (SK6812-SIDE-A) illuminate ring around the knob
  • USB-C (2.0) connector for 5V power and serial data/programming (CH340)
  • VEML7700 ambient light sensor for automatic backlight & LED intensity adjustment
  • Versatile back plate for mounting - use either 4x screws, or 2x 3M medium Command strips (with cutouts for accessing removal tabs after installation)
  • Front cover snaps on for easy access to the PCB

Current status: Not recommended for general use, but may be a fun project for an advanced electronics hobbyist.

Demo video

How it works

3D CAD

Exploded view

Latest Fusion 360 Model: https://a360.co/3BzkU0n

DEMO: video editor timeline control

If you edit audio/video, imagine having a jog wheel where you could feel the clip boundaries as you scrolled through the timeline. Then switch to playback speed control, with a wheel that's spring-loaded to return to "paused," with snaps at 1x, 2x, 4x, etc. The SmartKnob can do this; it just needs some software integrations to be written. Check out a demo using a SmartKnob prototype to control a mock video timeline:

(you can actually try this demo yourself if you've already built a SmartKnob; plug it in over USB and go to https://scottbez1.github.io/smartknob/)

Build your own?

While this is a "DIY" open-source project, it is not yet a mature plug-and-play project. If you intend to build your own, note that it requires advanced soldering experience to build - very small-pitch surface-mount soldering is required (reflow or hot air recommended), and assembly is quite time-consuming and delicate. Please go into it with the expectation that you will almost certainly need to be able to troubleshoot some hardware and firmware issues yourself - I recommend reviewing/understanding the schematics and basic firmware before jumping in!

More documentation on the BOM and what parts you need to order is coming in the future - thanks so much for your interest! Follow me on Twitter for the latest updates on this and other projects.

View the latest auto-generated (untested) Base PCB Interactive BOM and Screen PCB Interactive BOM (or, the combined BOM csv) for electronics/hardware parts list. ⚠️ These are auto-generated from the latest untested revision on GitHub. For tested/stable/recommended artifacts, use a release instead.

A few miscellaneous notes in the meantime:

  • There's limited space inside the LCD mount for wiring, and 8 wires need to fit through the hole in the center. I used 30 AWG wire-wrapping wire. Enamel-coated wire would probably work too.
  • Older versions of the design (as seen in the videos) used glued-on BF350-3AA strain gauges to detect presses; in v0.5 these were replaced with footprints for SMD resistors, which exhibit similar properties when stretched/compressed and are much easier to assemble.
  • The TMC6300 is tiny and has a bottom pad, so I would seriously consider getting a stencil along with the PCB order. Even with the stencil I needed to manually clean up some bridging afterward; I highly recommend Chip Quik NC191 gel flux, available on Amazon (or use this non-affiliate link instead) or from your electronics distributor of choice. Flux is also very helpful when soldering the LCD ribbon cable to to screen PCB.
  • For breadboard prototyping, the TMC6300-BOB or SparkFun's TMC6300 driver board are awesome and way easier to work with than the bare chip if you just want to play around with low current BLDC motors
  • For AliExpress purchases: I highly recommend only using AliExpress Standard Shipping (purchasing in the US). I have had multiple purchases take months or never get delivered when purchased with Cainiao or other low cost shipping options, whereas AliExpress Standard is very reliable and generally faster in my experience.
  • Make sure to check the open issues - this design is not yet "stable", so beware that everything may not go smoothly.

Future plans:

  • consider switch to using an ESP32-S3-MINI-1 module
  • get wifi configured and working (probably MQTT?). Currently memory is an issue with the full display framebuffer sprite. PSRAM might fix this (requires newer ESP-IDF & unreleased Arduino core, and from a brief test I got horrible performance with PSRAM enabled), or the next item might help reduce memory:
  • migrate to LVGL, for better display rendering and easy support for menus, etc. Shouldn't require a full 240x240x24b framebuffer in memory, freeing some for wifi, etc.
  • Home Assistant integration, or other real-world applications
  • ???
  • Profit 😉

Already built one?

Check out the firmware/software documentation for tips on getting it programmed and hooking it up to your own software integrations.

If you've already uploaded the standard firmware and gone through the calibration process (see guide linked above if you don't know what this means), go to https://scottbez1.github.io/smartknob/ to try out an interactive web-based demo that uses Web Serial to talk to a SmartKnob that's plugged into your computer's USB port!

Base PCB

Ordering notes: use white soldermask, for reflecting light from RGB LED ring around the knob. Should be 1.2mm thick (not "standard" 1.6mm).

If you are ordering a stencil for solder paste from JLCPCB and plan to apply paste by hand (as shown in the video) without a stencil frame/machine, make sure to select "Customized size" and enter smaller dimensions (e.g. 100mm x 100mm) to avoid getting a much larger stencil than you need. This will also likely reduce the cost of shipping substantially! Also, select only the Top side; the bottom only has 2 SMT components - the motor connector and VEML7700 ALS - so it's not worth getting a stencil for that.

Latest auto-generated (untested and likely broken!) artifacts⚠️:

Schematic

Interactive BOM

PCB Packet

Gerbers

⚠️ For tested/stable/recommended artifacts, use a release instead.

Screen PCB

Ordering notes: Must be 1.2mm thick (not "standard" 1.6mm) per mechanical design. (The PCB silkscreen mentions 0.6mm thickness - this is the thickness of the VHB tape for adhering the LCD; the PCB should be 1.2mm thick)

There are few enough components on the Screen PCB that I chose to hand-solder them rather than reflow with solder paste and a stencil, but if you order a stencil, see the note above about selecting a "Customized size" to be easier to handle and save on shipping. Also make sure to select the Bottom side only; all the components are on the bottom side of the screen PCB.

Latest auto-generated (untested and likely broken!) artifacts⚠️:

Schematic

Interactive BOM

PCB Packet

Gerbers

⚠️ For tested/stable/recommended artifacts, use a release instead.

Printed parts

You will need six printed parts. The current stable designs can be found as STL assets in the v185 mechanical release or you can export the latest untested designs from the CAD model by opening it in Fusion 360: https://a360.co/3BzkU0n

The parts can probably be FDM 3D printed with a well-tuned printer, but the parts shown in videos/photos were MJF printed in nylon for tight tolerances and better surface finish.

If you wanted a simpler build, you could omit the LCD and just merge the knob + glass from the model into a single STL to get a closed-top knob.

Export and print the following 6 parts:

  • Enclosure
  • Knob (RotorAssembly->KnobAssembly->Knob)
  • ScreenPlatform
  • RotorSpacer (RotorAssembly->RotorSpacer)
  • MountBase
  • BackPlate

⚠️ If you opt to go for MJF Nylon printing from JLCPCB, their system may complain about < 0.8mm wall thickness detected on the MountBase, ScreenPlatform and RotorSpacer parts. This appears to be a false positive, possibly on some of the print tapers. You should be able to ignore this, as all print orders at JLCPCB are subject to a final manual review, and they will contact you by email if there are any job-stopping issues or risks with your prints.

NanoFOC (3rd party)

If you're looking to tinker with FOC/haptic feedback, but don't want to build a full SmartKnob View yourself, I can recommend the NanoFOC DevKit++, an open-source design made and sold by a member of the SmartKnob community! It's super compact and is a great testbed or core for building your own BLDC-based haptic input device.

Image of the NanoFOC PCB

The NanoFOC uses an ESP32-S3, and the SmartKnob firmware works on it out of the box; just select the nanofoc environment in PlatformIO rather than the view environment when uploading.

Frequently Asked Questions (FAQ)

Can I use this cheap gimbal BLDC motor I found on AliExpress?

I can't stop you, but I will caution that you probably won't be super happy with it depending on your intended application.

Nearly every off-the-shelf BLDC gimbal motor that the community has tested (which is pretty much ALL the cheap ones you'll find on AliExpress, trust me) has moderate to severge cogging. That means the motor wants to snap to certain positions by itself even when unpowered. This means you won't be able to get completely smooth rotation when virtual detents are turned off, and the motor's cogging may interfere with or overpower the virtual detents, particularly if you set them to lower strength or make then very fine-grained.

The recommended motor is definitely the best (i.e. lowest cogging) off-the-shelf motor we've come across so far, and is the only readily-available motor that I would consider "good" for this application.

If you've found another motor that is completely smooth when unpowered, we'd LOVE to hear about it in the discord; if you're wondering about some cheap motor you saw online, either just order one and try it for yourself, or ask about it in discord but don't be surprised (or offended) if the response you get is something terse like "nope, no good".

How much does it cost?

I wish I could tell you now, but I don't actually know off the top of my head. Check back soon - I've only built a few so far, which was the result of a bunch of tinkering and prototyping over an extended period, so I don't have all the expenses tallied up yet. Probably less than $200 in parts? But some items have gotten more expensive, and you may be limited by minimum order quantities or shipping charges from multiple separate suppliers.

Does it work with XYZ?

Not yet, regardless of whatever "XYZ" you're thinking of. So far I've only implemented enough firmware for the demo shown in the video, so you can't actually use it for anything productive yet. The basic detent configuration API is there, but not much else. Lots of firmware work remains to be done. If you build one, I'd love your help adding support for "XYZ" though!

Can I buy one as a kit or already assembled?

Probably not? Or at least, I don't have any immediate plans to sell them myself. It's not that I don't want you to be happy, but hardware is a hard business and I just work on this stuff in my free time.

It's open source with a fairly permissive license though, so in theory anyone could start offering kits/assemblies. If someone does go down that route of selling them, note that attribution is required (and I wouldn't say no to royalties/tips/thanks if you're in a giving mood 🙂).

Firmware and Software

More extensive documentation of the firmware and software (and how to get started) can be found in the dedicated SmartKnob Firmware and Software Guide

General Component Info

Magnetic encoders

MT6701 (MagnTek)

Excellent sensor at a reasonable price - highly recommended. Less noisy than TLV493D, and more responsive (control loop is more stable) using SSI.

  • Lots of IO options - SSI, I2C, and ABZ - should offer good response latency
  • SSI includes CRC to validate data
  • No power-down or low-power options - may not be ideal for battery-powered devices
  • Not available from US distributors (Mouser, Digi-Key)

Datasheet

Ordering (LCSC)

TLV493D (Infineon)

Not used in the SmartKnob view, but a common/popular magnetic encoder in general. It's a mediocre choice for a haptic feedback implementation. Easy to prototype with using Adafruit's QWIIC breakout board.

In my testing, it's noisy, requiring filtering/smoothing that can slow responsiveness, hurting control loop stability. Or, with less filtering, the noise can easily be "amplified" by the derivative component in the PID motor torque controller, causing audible (and tactile) humming/buzzing.

But the bigger issue is that there is apparently a known silicon issue that causes the internal ADC to sometimes completely lock up, requiring a full reset and re-configuration, which can cause delays/gaps in data! See section 5.6 in the User Manual

In the Master Controlled Mode (MCM) or the Fast Mode (FM) the ADC conversion may hang up. A hang up can
be detected by:
 - Frame Counter (FRM) counter stucks and does not increment anymore.

In my experience testing 4 different Adafruit breakout boards, 2 of them (50%) regularly exhibit this lockup behavior within a minute or two of use. It is possible to detect and auto-reset (and there is code in the project to do so), but it is slow and may cause undesirable jumps/delays if the sensor locks up often.

Datasheet

AS5600 (AMS)

A mediocre choice. Cheap breakout boards are readily available.

In my testing, it's fairly noisy (anecdotally, noisier than the TLV493d), requiring filtering/smoothing that can slow responsiveness, hurting control loop stability. Additionally, it saturates at a lower magnetic field strength than other sensors I tested, requiring a significant air gap (8-10mm) when used with a strong neodymium diametric magnet like Radial Magnets 8995.

Datasheet

Motor drivers

TMC6300-LA

This is a relatively new IC and it's a perfect match! There generally aren't any other drivers (with integrated fets) that meet the requirements for the low-voltage and low-current motors used in this project (DRV8316 might work, but has not been tested).

Highlights:

  • 2-11V DC motor supply input
  • Up to 1.2A RMS
  • Tiny (3x3mm QFN)

Datasheet

Product page

Motors

32mm Rotor, Hollow Shaft, Diametric magnet

  • 32mm rotor
  • 15mm overall height (including magnet), 12.75mm height w/o magnet, 9mm rotor height
  • low/zero cogging - excellent for completely smooth input
  • 5.9mm hollow shaft
  • built-in diametric magnet for encoder
  • Proven option

This is overall the easiest motor to get started with. Low cogging and a built-in diametric magnet are great!

Available from SparkFun!

Acknowledgements

This project was greatly inspired by Jesse Schoch's video "haptic textures and virtual detents" and the corresponding discussion in the SimpleFOC community. Seriously, this project wouldn't exist if not for that video - thank you Jesse!

License

This project is licensed under Apache v2 (software, electronics, documentation) and Creative Commons Attribution 4.0 (hardware/mechanical) (see LICENSE.txt and Creative Commons).

Copyright 2022 Scott Bezek

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
smartknob - Copyright 2022 Scott Bezek Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ---- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

SmartKnob 是一种开源输入设备,具有软件可配置的止动(endstops )装置和虚拟定位器 展开 收起
C/C++ 等 4 种语言
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化