Project to create a teensy based gamecube controller with hall effect sensors, snapback filtering, and notch calibration

PhobGCC

Gamecube controller motherboard using a teensy as the microcontroller. Aim is to make an accessible and consistent controller. Has the option of using hall effect sensors instead of potentiometers, notch calibration, and snapback filtering.

If your interested in making one, join the project discord to ask questions and get the most up to date information: https://discord.gg/eNJ7xWMvxf

Check out the wiki for some info about how the phobGCC works: https://github.com/Phobos132/PhobGCC/wiki

Hall effect sensors:

Prototypes

Board Version 1.1:

1.1

Initial prototypes:

Prototypes

Comments
  • Experimental notch adjustment

    Experimental notch adjustment

    This changes the calibration procedure.

    First it goes through collecting data: cardinals, then diagonals, then optionally notches. Then it does up to 12 more steps, in which you can adjust the notches while viewing the live output of the stick. Press B to reset to default.

    This needs testing with a controller shell that actually has notches.

  • Merge hardware revision branches

    Merge hardware revision branches

    Rather than having branches with variants of the firmware code, split out the hardware-specific code into separate root .ino files, and put the shared code in another included source file.

  • Implement lighter-weight Kalman filter

    Implement lighter-weight Kalman filter

    It should both run faster and be more responsive to small stick inputs.

    It's faster because I removed all the unnecessary matrix math.

    It responds to small stick inputs better because I made it weight the stick position higher when the stick isn't moving quickly in that axis. See the following graph, where orange is the new filter and yellow is the old filter (only shown for 100% stick travel).

    Screenshot_20220325_001150

    Bottom unit is frames at 60fps.

    Hopefully there are no bugs.

  • Clean&comment, add cal point outlier rejection

    Clean&comment, add cal point outlier rejection

    Cleaned and commented linearizeCal, cleanCalPoints, and calcStickValues.

    Added rejection of 4 largest and smallest values in each axis for the origin for cleanCalPoints.

  • Control UI overhaul

    Control UI overhaul

    Implemented the Rienne-style commands for PhobGCC configuration. All Sticks freeze when changes occur. C-stick Offset now displays the coordinate output when changed or allows for the current state to be checked. Also set up a safety check so that the user can't set it too high.

  • Add axis smoothing for ledgedashes

    Add axis smoothing for ledgedashes

    The previous attempt incurred quite a large performance penalty, so I moved the filter gain computation out of runKalman into its own function that can be called only when the source parameters get changed.

  • Dev fixed time step basic

    Dev fixed time step basic

    • a fixed timestep of 1ms for the filter
    • teensy 4.0 support
    • averaging of ADC reading
    • small hysteresis on stick values to reduce noise/jitter

    Tested on boards 1.0, 1.1 with teensy 3.2, and 1.1 with teensy 4.0

  • C-stick Offset + SafeMode + Harder To Reset

    C-stick Offset + SafeMode + Harder To Reset

    C-stick Offset can now be adjusted using the X or Y button to define the Axis, A to increase or B to decrease. Controller now has a safe mode, Dpad Down + Start is necessary to configure anything. Reset is now harder to input, Start+Dpad Left.

  • Debug resetDefaults

    Debug resetDefaults

    Check resetDefaults for bugs and clean/comment (I think there's a small issue in there somewhere that makes the analog stick behave strangely after resetting the controller for the first time after programming)

  • Rework Teensy 3.2 Communication Code

    Rework Teensy 3.2 Communication Code

    Disclaimer: I can search stackoverflow posts well enough to cobble stuff together, but software is definitley not my specialty. This is not necessarily a good way of doing this, just a way that I got it to work on my setup.

    Requirements/Specifications: Non-blocking - Must allow other code to run while waiting for the next command Relatively low latency - Unclear exactly how important this is, shoot for <10 us between end of command and start of response Commands are expected to be 200kHz with ~1.25us lows indicating 1 and ~3.75us lows indicating 0 Responses will be ~250kHz with ~1us lows indicating 1 and ~3us lows indicating 0 See simples website for the the 'joybus' protocol: https://simplecontrollers.bigcartel.com/gamecube-protocol

    Implementation: Current implementation uses one of the teensys hardware serial ports to allow for asynchronous reading and writing of data The joybus protocol is approximated by the serial protocol in a 2 joybus bit per serial byte style, see: http://www.qwertymodo.com/hardware-projects/n64/n64-controller While the serial port can read and write the data well, it is not good at doing so with low latency, because of this interrupts and timers are used to keep track of how many bits have been read or written in order to respond with low latency

    Details: two main functions involved: bitcounter() function called by the RX pin interrupt which will activate on the falling edge of every pulse on the data line increments the bit count if only one bit has been read (indicating the start of a new command) start a timer which will call the communicate() function and set the commStatus to Read (because we are reading a command)

    	communicate()
    		function that gets called using timers to read data out of the hardware serial port buffers, parse it, determine the appropriate response, and write the data back to the hardware serial port buffers to be sent over the data line
    		
    	Process:
    		comm status is _commIdle
    		data line goes low causing interrupt, bitcounter runs:
    			start timer that will call communicate when the first 8 bits of the command have arrived
    			set the comm status to _commRead
    		
    		40us later
    		
    		communicate() gets called by the timer
    		if the comm status is commRead:
    			checks that we have 4 bytes of serial data (first 8 bits of the command)
    			read those 4 bytes and parse into a single byte of joybus data
    			set the serial baud rate to fast to be ready to send a response
    			decide if the byte is a probe, origin, or poll command, or something else (error)
    			if its a probe command:
    				set the timer to trigger again at the end of the response, send the preset probe response and set the write Queue to the probe response length + the command length
    				set the comm status to _commWrite
    			if its an origin command:
    				set the timer to trigger again at the end of the response, sent the preset origin response and set the write queue to the origin response length + the command length
    				set the comm status to _commWrite
    			if its poll command:
    				set the timer to trigger again a bit before the end of the poll command
    				set the comm status to _commPoll
    			if its something else:
    				got garbage data, reset everything, clear the serial port and try waiting for a stop bit to syncronize 
    		some time later
    		
    		communicate() gets called again by the timer
    		if comm status is _commPoll:
    			wait for _bitCount to reach 25, indicating that the poll command has finished
    			send the data in pollResponse (done immediately to minimize latency)
    			set the timer to trigger again at the thend of the poll response
    			set _writeQueue to the length of the poll response + the length of the poll command
    			set the comm status to _commWrite
    		if the comm status is _commWrite:
    			wait for _bitCount to equal _writeQueue, indicating that the response has finished
    			turn the serial baud rate back to slow
    			set the comm status to _commIdle
    			set _bitCount to 0
    			set _writeQueue to 0
    			clear the serial port in case there's any garbage data left to be ready for the next command
    

    Phobos' Suggestions:

    General cleanup and commenting (obviously)

    Improved parsing of serial bytes to joybus bits, should be able to just look at bits 2 and 5 (6?) of the serial data to decide what the joybus bits are, rather than matching the whole byte

    Try running in half duplex mode, this is a recent addition to the teensy serial library and worked with the teensy 4.0, should work here too. Will make things cleaner and will remove the need for the diode

    Consider setting up the hardware serial directly rather than using the teensy serial libraries, may make things cleaner and lower latency

    See if the response can be sent to the hardware serial buffers as an array rather than one byte at a time, I tried this but wasn't able to make it work without increasing latency significantly

    See if we can interrupt directly from the hardware serial port on data available (not serialevent(), I think this can be done but was too complicated for me to implement quickly

  • Create Full Build Instructions

    Create Full Build Instructions

    Need to fully document the build process including: Ordering Boards Ordering Parts Disassembling a controller Assembling the board Programming the Teensy

matrix-effect This is a dumb matrix effect type thing
matrix-effect This is a dumb matrix effect type thing

matrix-effect This is a dumb matrix effect type thing. It's only like one source file which should compile... Define __POSIX or __WIN though, for posi

Sep 23, 2022
Linux HWMON sensors driver for ASUS motherboards to get sensor readings from the embedded controller

asus-wmi-ec-sensors Linux HWMON sensors driver for ASUS motherboards to read sensors from the embedded controller Many ASUS motherboards do not publis

Aug 30, 2022
Create a firework effect with WS2812b LED and a MCU
Create a firework effect with WS2812b LED and a MCU

LED-Fireworks Firework effect with WS2812b LED and a MCU This project uses FastLED library to control the LED strip. WS2812b IC is embedded into each

Nov 18, 2022
A simple 3D game engine for GameCube, Wii, 3DS, Windows, and Linux.

octave A Simple 3D Game Engine for GameCube, Wii, 3DS, Windows, and Linux Windows Setup Download and Install: Visual Studio Community 2017 (with C++ s

Nov 8, 2022
A cheap,simple,Ongeki controller Use Keyboard Simulation and Mouse Simulation to controller the ongeki game. Using Pro-micro control.
A cheap,simple,Ongeki controller Use Keyboard Simulation and Mouse Simulation to controller the ongeki game. Using Pro-micro control.

N.A.G.E.K.I. A cheap,simple,Ongeki controller Use Keyboard Simulation and Mouse Simulation to controller the ongeki game. Using Pro-micro control. 中文版

Nov 18, 2022
A cheap,simple,Ongeki controller Use Keyboard Simulation and Mouse Simulation to controller the ongeki game. Using Pro-micro control.
A cheap,simple,Ongeki controller Use Keyboard Simulation and Mouse Simulation to controller the ongeki game. Using Pro-micro control.

N.A.G.E.K.I. PLEASE CHECK Main Project A cheap,simple,Ongeki controller Use Keyboard Simulation and Mouse Simulation to controller the ongeki game. Us

Dec 30, 2021
DirectX 11 library that provides convenient access to compute-based triangle filtering (CTF)

AMD GeometryFX The GeometryFX library provides convenient access to compute-based triangle filtering (CTF), which improves triangle throughput by filt

Oct 6, 2022
custom esp8266 controller for driving the pwm led controller

room8266 custom esp8266 controller for driving the pwm led controller designed to drive this: https://github.com/austinscreations/PWM-LED-Controller t

Nov 1, 2021
This repo contains source code of our paper presented in IROS2021 "Single-Shot is Enough: Panoramic Infrastructure Based Calibration of Multiple Cameras and 3D LiDARs"
This repo contains source code of our paper presented in IROS2021

Single-Shot is Enough: Panoramic Infrastructure Based Calibration of Multiple Cameras and 3D LiDARs Updates [2021/09/01] first commit, source code of

Nov 17, 2022
QNEthernet, an lwIP-Based Ethernet Library For Teensy 4.1

QNEthernet, an lwIP-Based Ethernet Library For Teensy 4.1 Version: 0.10.0-snapshot The QNEthernet library provides Arduino-like Ethernet functionality

Nov 4, 2022
ROS1 and ROS2 messages for event based image sensors

ROS package with array messages for event based cameras This package has definitions for messages created by event based sensors. The events are kept

Feb 22, 2022
Fast and Accurate Extrinsic Calibration for Multiple LiDARs and Cameras
Fast and Accurate Extrinsic Calibration for Multiple LiDARs and Cameras

Fast and Accurate Extrinsic Calibration for Multiple LiDARs and Cameras The pre-print version of our paper is available here. The pre-release code has

Nov 24, 2022
An easy to build CO2 Monitor/Meter with Android and iOS App for real time visualization and charting of air data, data logger, a variety of communication options (BLE, WIFI, MQTT, ESP-Now) and many supported sensors.
An easy to build CO2 Monitor/Meter with Android and iOS App for real time visualization and charting of air data, data logger, a variety of communication options (BLE, WIFI, MQTT, ESP-Now) and many supported sensors.

CO2-Gadget An easy to build CO2 Monitor/Meter with cell phone App for real time visualization and charting of air data, datalogger, a variety of commu

Nov 15, 2022
Application firewall PoC with filtering performed in the kernel, for Linux.

Voi Application firewall with filtering performed in the kernel, for Linux. Status Currently just scaffolding code No where near ready for a productio

Sep 15, 2022
Invariant-ekf - C++ library to implement invariant extended Kalman filtering for aided inertial navigation.
Invariant-ekf - C++ library to implement invariant extended Kalman filtering for aided inertial navigation.

inekf This repository contains a C++ library that implements an invariant extended Kalman filter (InEKF) for 3D aided inertial navigation. This filter

Nov 21, 2022
This repository is used for automatic calibration between high resolution LiDAR and camera in targetless scenes.
This repository is used for automatic calibration between high resolution LiDAR and camera in targetless scenes.

livox_camera_calib livox_camera_calib is a robust, high accuracy extrinsic calibration tool between high resolution LiDAR (e.g. Livox) and camera in t

Nov 26, 2022
A generic and robust calibration toolbox for multi-camera systems
A generic and robust calibration toolbox for multi-camera systems

MC-Calib Toolbox described in the paper "MultiCamCalib: A Generic Calibration Toolbox for Multi-Camera Systems". Installation Requirements: Ceres, Boo

Nov 13, 2022
the implementations of 'A Flexible New Technique for Camera Calibration' and Bouguet's method

StereoCameraCalibration MonocularCameraCalibration/StereoCameraCalibration/StereoCameraRectification 1、Class "MonocularCameraCalibration" provides the

Nov 3, 2022
Create a calculator of any kind in any language, create a pr.

calculators Create a calculator of any kind in any language, create a pr. Create a calculator of any type using the programming language of your choic

Oct 21, 2022