Skip to content

Lukas-Sturm/MotorKnob

Repository files navigation

MotorKnob - Firmware

A very simple haptic device. Inspired by Scott Bezek's Smart Motor Knob and Karlitos/Binaris.

It uses my fork of haptic-bldc-lib by VIPQualityPost.
It can be interfaced with using I2C.

Hardware

This uses a special gimbal motor.
And a simple MT6701 Encoder (the big ones).
In combination with a SimpleFocShield.
Everything running on a STM32F4.

STLs for a simple mount are included.
Also checkout the Onshape Document for the Motor Mount and the very basic Shield Holder, feel free to adapt them to your needs.

Driver

There is also a compatible Linux Driver plus Yocto Layer available.
Plus Demo Application using it.

Protocol

communication.h contains all the i2c/SMBus logic.
I used a form of SMBus, it basically reads and writes words (2 bytes) per command, because this is supposed to interact with Linux a Driver.

Reads

First Byte: Address Register
Second Byte: Lower Data Byte
Third Byte: Upper Data Byte

adheres to SMBus standard for reading a word

Writes

needs the address MSB set to 1
position can't be written

e.g:
0b10000001 (0x81) writes end position
0x81 0x10 0x00 -> Sets end position to 16.

adheres to SMBus standard for writing (except the extra write bit)

Registers

  • 0x00 start position
  • 0x01 end position
  • 0x02 detent count
  • 0x03 position

Bit 8 is reserved and indicates a Write command.

Why not i2c read/write bit?

SMBus protocol always starts by sending a write with the register it wants to read/write. Then it either sends more data or sends a empty read package. That's why I need to set a write bit in the initial write command for the address. ¯\(ツ)/¯ atleast that's how I got it running communicationg with Linux host.

Notes

  • This is very basic
  • Currentsense is disabled (just stopped working with my setup)

About

Basic Haptic Feedback Device using a BLDC Motor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published