Close
0%
0%

Quick Draw Motion Tracking

See if I can't make a 9/10 DOF sensor for a buddy's larger project

Similar projects worth following
Using a GY-91 MPU9250/BMP280 "10DOF Acceleration Gyroscope Compass Barometer Sensor", and an ESP32 ("Wemos Mini D1" form factor), we hope to reasonably accurately track the motion of a "gun" through a quick draw action, and then while "firing" at a target determine the aim. I'm not sure if the MPU9250's DMP will be helpful or not. "The reaction times of the best fast draw shooters is 0.145 seconds" (https://en.wikipedia.org/wiki/Fast_draw) so while the average person is probably a lot slower, it remains to be seen if sufficient, timely data can be captured.

  • 1 × GY-91 MPU9250 BMP280 GY-91 10DOF Acceleration Gyroscope Compass Nine Shaft Sensor
  • 1 × ESP32 TTGO wemos MINI D1 ESP32 wemos d1 mini esp8266 WiFi + Bluetooth

  • Teensy and the GY-91

    Todd12/22/2017 at 20:43 0 comments

    Adding the GY-91 was easy, but oddly (read: my incomplete understanding of C), it would reports type conversion errors on:

    int16_t mag_max[3]  = {0x8000, 0x8000, 0x8000},

     So after some research I changed it to:

    int16_t mag_max[3]  = {-32768, -32768, -32768},

    And it compiled.

    Then at then some point it starting giving me errors "undefined reference to `_kill`" and similar, and wouldn't compile, so after some Googling, I added this to my .ino:

    extern "C" {
      int _getpid() { return -1;}
      int _kill(int pid, int sig) { return -1; }
      int _write() {return -1;}
    }

     The LCD display lines are:

    1. acceleration values in milli-G's
    2. gyro values in degree/sec
    3. mag values in degree/sec
    4. yaw pitch roll

  • Teensy 3.5 & Nokia 5110 LCD sanity test

    Todd12/22/2017 at 20:12 0 comments

    Kinda glad for this excuse to finally try the Teensy. The Teensyduino installed easily, and the "button" to upload is easy and fast. I hadn't even realized the 3.5 had Digital Audio, CAN Bus, SD Card, and even ethernet support. Impressive!


    Anyway, making the demo code work with it was easy, even with the Hardware SPI.

    Video on Instagram "@toddzebert: Success. Demo code working on Nokia 5110 LCD with HW SPI and my first #Teensy. #arduino #maker"

  • A Spark, a D'oh!, a Surprise, and Data Sheets

    Todd12/21/2017 at 20:38 0 comments

    So SparkFun's documentation on it's "IMU Breakout - MPU-9250" (although it's lacking the BMP280 of GY-91, it's a start) looked good in it's Hookup Guide and it's SparkFun_MPU-9250_Breakout_Arduino_Library repo.

    In no particular order:

    • The Nokia 5110 display wasn't working because I didn't set `#define LCD true` which isn't documented (#AlwaysReadTheCode) but the Pro Mini seems just not quite up to running it ("30692 bytes (99%) of program storage space", "Global variables use 2089 bytes (102%) of dynamic memory". Perhaps I could rustle up those 41 bytes...?
    • Turns out I have an MPU9255!,  with a "Who am I" of 0x73. More about that below.
    • The MPU9250 lib they include a fork of incorrectly defines the `WHO_AM_I_AK8963` register as 0x49, while it's actually at 0x00.  The value is still 0x48 though.
    • I saw a comment about pulling NCS (Chip Select) high, but that seems to be only for SPI?

    The MPU9255:

    The InvenSense MPU-9255 is a System in Package (SiP) that combines two chips: the MPU-6555, and the market leading, 3-axis digital compass [still seems to be the AK8963C] with an on-board Digital Motion Processor™ (DMP) capable of processing complex MotionFusion™ algorithms.

    While the code now runs, I'm getting what seems like inaccurate/wildly fluctuating results - or so it seems to me - it stills motionless on my desk.

    The MPU-925x code mentions being Teensy 3.1 compatible (that may only be because of the 3.3V of the module though) - which should be more than sufficient to run the display (so as to avoid being tethered to the laptop for the Serial Monitor), and I have a 3.5, so I guess I'll be converting the example to use that board, and install Teensyduino.

  • I tried another library and failed, time for a sanity check

    Todd12/21/2017 at 03:03 0 comments

    A couple of the simpler-seeming (like from Sparkfun) assume 3.3v Pro Mini's so I ordered a couple, and hooked it all up including a Nokia 5110, burned the code... and nada.

    After some fiddling I decided I needed to verify both the Pro Mini's and the 5110's were working. It took me a couple libraries to find one that worked. Not sure if it was the libs or the wiring - there seems to be a number of pin layouts for the 5110.

    Probably not an obvious choice but this worked like a champ Nokia 5110 LCD, an Arduino Pro Mini 3.3V with 8MHz clock frequency

  • What are we dealing with here?

    Todd12/09/2017 at 03:05 0 comments

    Confusingly, this module is a combo of two chips, and one of which is a combo of two chips. 

    The module is commonly referred to a the GY-91, which is a MPU-9250 (9 axis g/a/m sensor) chip, plus a BMP280 (absolute barometric pressure sensor) chip.

    The MPU9250 is two dies in one package; from the Product Specs: 

    MPU-9250 is a multi-chip module (MCM) consisting of two dies integrated into a single QFN package. One die houses the 3-Axis gyroscope and the 3-Axis accelerometer. The other die houses the AK8963 3-Axis magnetometer from Asahi Kasei Microdevices Corporation. Hence, the MPU-9250 is a 9-axis MotionTracking device that combines a 3-axis gyroscope, 3-axis accelerometer, 3-axis magnetometer and a Digital Motion Processor™ (DMP)

    https://www.invensense.com/wp-content/uploads/2015/02/PS-MPU-9250A-01-v1.1.pdf

    I had Google a library before a fully grasped the above, and so tried to use this lib which is not the correct one.   https://github.com/kriswiner/ESP32/tree/master/MPU9250_MS5637

    Yeah, don't try that.

View all 5 project logs

Enjoy this project?

Share

Discussions

Todd wrote 12/22/2017 at 01:22 point

I remember Dragon's Lair the laserdisc game but not those others. I was more a Tail Gunner, or Discs of Tron player.

  Are you sure? yes | no

Bharbour wrote 12/22/2017 at 02:32 point

My favorite of the videos was Joust, although I liked the Tanks game a lot. I never paid much attention to the Dragon's Lair. It was a fun time though.

  Are you sure? yes | no

Todd wrote 12/22/2017 at 03:43 point

That's right, Joust! Played that a lot of my Apple ][+. Dragon's Lair was just sucked up so many quarters.

  Are you sure? yes | no

Bharbour wrote 12/21/2017 at 20:56 point

I used to work at a place called American Laser Games that made a quick draw game. They used light pen technology for point of aim detection. The fastest person there, was drawing in about 50mS (0.050S). When they videoed the pro's to make the games, the guys would have to slow down their draw because the draw and fire happened in 1 or 2 video frames.

  Are you sure? yes | no

Todd wrote 12/21/2017 at 22:47 point

Ah, yeah, "Duck Hunt" did come to mind - I remember flickering. I didn't realize it had advanced https://en.wikipedia.org/wiki/Light_gun .  But wow, 50mS is fast! Thanks for the comment.

  Are you sure? yes | no

Bharbour wrote 12/21/2017 at 23:09 point

These were cabinet arcade games back in the early 1990's (Mad Dog McCree). These guys used a laser video disk play to show live action video. Most of the games were western themed, but they had a couple of less successful ones that were not. The large CRT monitors put out enough light that you didn't need to flash the screen but the little 25" ones required flashing the screen when the gun trigger was pulled.

I was really surprised by the 50mS myself, I had always thought 200ms was about the limit on human reaction times.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates