Subscribe to Reddit:Electronics потік
A subreddit dedicated to news, articles and general discussions related to electronic systems and circuits. Circuit, tools and component questions should be posted in /r/askelectronicsElectronic systems and circuits
Оновлене: 2 години 1 хв тому

IMU-based head tracker

Ндл, 01/17/2021 - 21:39

I built a DIY head tracker a little while back using IR LEDs, a PS3 eye camera and OpenTrack based on the Delan clip design. It's pretty cool, but the latency and jitter (or more latency if you filter out more of the jitter) due to the fairly slow 75Hz sampling rate make playing fast-paced games like Dirt a little sickening for me.

So I made my own IMU-based tracker. I may not have bothered, but I knew I could recycle a bunch of code from my stabilized scope project and save a lot of time. I'm not the first to have done this of course - there's the EDtracker and this home made arduino based one and I'm sure many others. But I have the advantage of newer tech with better performance since a few years have passed since those other projects.

I made a custom PCB with an STM32G431KBT6 micro controller, ICM20602 6 axis IMU, and MMC5983MA 3 axis magnetometer. These sensors are faster and have less noise than older generations and the controller is at least an order of magnitude more powerful than a typical Arduino. My firmware does not use any libraries besides the Cube system provided by ST - everything is written from scratch. The system samples the IMU at 1kHz and the mag at 500Hz. The Kalman filter updates the quaternion-based attitude estimate with every reading so that my data output is very smooth with low latency. The device is configured to be recognized by Windows as a USB HID game controller. The quaternion data is converted to 16 bit unsigned integer Euler angles and transmitted over USB at 1kHz. I've also written a Gauss-Newton based calibration routine for the sensors that makes sure they produce the best possible data (if you run the calibration procedure carefully).

When mapped to in-game controls, the latency is very low. About 2-3 frames* on a 120Hz monitor running a game at 250 fps. Which is the same as my mouse (Razer Deathadder Chroma). Unfortunately, when using this device as input to OpenTrack, there is significantly more delay, about 7-8 frames*. There are many games that support head tracking with OpenTrack that do not have their own in-game settings/controls for it so it can't typically be bypassed (plus, OpenTrack has a lot of great features for customizing input curves etc that games don't have). I don't know too much about the Windows side of USB or how OpenTrack is programmed, but from what I've been told by /u/Halfway_Dead, fullscreen exclusive applications process USB inputs with much less latency than typical Windows Desktop Window Manger applications. So I'm guessing the difference is something related to that and I'm not sure how to improve it. Please post if you have ideas about this.

So the final result is that my system is noticeably smoother than the camera-based system, but the latency improvement was not as much as I had hoped (only about 1 frame*) due to, most likely, some USB issue in Windows/OpenTrack. And of course, my system, like all other IMU-based systems, does not track translation, only rotation - so that's +1 for camera systems. For my next project, I might try to combine both to get the smoothness and low latency of the IMU with the translation abilities of the camera-based system (this is similar to how some VR headsets work). Plus, if I have a camera, I don't need a magnetometer which saves some headache. But that would require me to dig into the OpenTrack code and would be a bigger project for me than this one was since I've got so much to learn.

The entire project is available on github.

*meaning monitor refreshes, not physics frames

submitted by /u/fireaway199
[link] [comments]

Hacking a Pinball Machine into a Coffee Table | TinyFPGA BX/Teensy 4.1 | 7-Segment Score Decoding Progress!

Сбт, 01/16/2021 - 19:45
Hacking a Pinball Machine into a Coffee Table | TinyFPGA BX/Teensy 4.1 | 7-Segment Score Decoding Progress!

I just solved one of the major design challenges. I can now remove the backbox that houses the score displays and circuit boards as I made progress over the last few weeks:

  • Implemented a display decoder chip using the open-source TinyFPGA BX board.
  • Coding my own SPI core in Verilog.
  • Addressing the display decoder logic.

    • The display decoder logic leverages combinational logic to simultaneously sample one digit which is instantaneously shown to the user. The score values are stored in RAM, created in the FPGA, and an interrupt output is toggled to notify the Teensy 4.1 that a score has been updated from a previous value.
    • The Teensy will then display the score on a couple of test OLEDs using the font of the original game. The actual size, locations and number of displays are to be determined, but getting it to score out reliably was a big challenge as this is my first FPGA project.

Demo and explanation video Here on my Instagram :)

submitted by /u/buildxyz
[link] [comments]