Thursday, December 3, 2026

OpenPuck Xbox Controller

If you aren't familiar with OpenPuck, go read about it on the GitHub. If you don't care to learn, heres the TL:DR:
OpenPuck is a solution for the newly-released Valve Steam Controller. The Steam Controller, rather than connecting over bluetooth, uses a 2.4GHz receiver that is plugged into your PC or console over USB which communicates directly with the controller, giving you ultra low-latency input. However, Valve does not provide or sell replacements for the radio receiver. OpenPuck is an open-source alternative which uses an NRF52840 Pro Micro microcontroller.

I have been using OpenPuck since I got my Steam Controller. Its great and I love it mainly because by default, the Steam Controller is picked up as a mouse and keyboard rather than an xinput gamepad. Steam running on a PC usually does the work to have it function as a controller. But OpenPuck does that translation in the puck itself. Meaning OpenPuck is actually able to effectively emulate any controller you want it to. So I have been using it on my PS3 in the Dualshock 3 mode. Works great.

Last week I picked up this new Xbox Nano controller. Its pretty good, but its a standard BLE (Bluetooth Low-Energy) controller. And as it turns out, does not work that great with my Mac. So I had Claude clone the OpenPuck repo and make it work with my Xbox Controller.
I then flashed one of the spare NRF board I had lying around and designed and printed a custom case for it.
The end result: a little dongle that automatically connects to a BLE Xbox controller that is in pairing mode, and it able to emulate, PS3, PS4, PS5, Xbox 360, Xbox 1, Nintendo Switch, Nintendo Switch Pro, and mouse and keyboard.



Ram PCI

I began this project a couple of months ago with the intention of creating an Arduino-controlled bus communicator for my truck in order to graph fuel trims and O2 sensor readings over a longer period of time than my simple code-reader could. What I ended up with was a full dashboard with full J1850 VPW OBD2 support where I could track and monitor every item over a wireless connection on my phone or laptop.


The first steps

For some background: although OBD2 was standardized in 1996, the CAN bus that we know today (ISO 15765-4) was not mandated in the US until 2008. That meant that up until 2008, auto manufactures all had their own communication buses that used different wires, circuitry, and voltage modulation. Japanese cars had K-Line, Ford used PWM J1850, and GM and Chrysler used VPW J1850. My truck is a 2005 Dodge, so it uses J1850 VPW (Variable Pulse Width).
J1850 VPW communicates over one wire, pin 2 on the OBD2 port. every bit is communicated over this wire, sending and receiving between 0V and 7.5V. 
Since the truck's PCM communicates with all other modules and sensors over this wire, it is possible to monitor passive traffic on this bus without communicating with the PCM at all. This was what my first board was meant to do.
Since the Arduino could not receive bits hitting 7.5V, a 10k/15k divider was added to step the voltage down, and a 5.1V zener diode to protect the Arduino. The Arduino was flashed with Daniel Laszlo's open-source J1850VPWcore library to decode the frames at 250000 baud. Claude wrote me a python script to monitor the frames (sent in raw hex) in the terminal on my Mac. Once the concept was proven, the components were moved off of the breadboard and soldered onto a proto shield board on the Arduino.
Since the values being received were all raw hex, Claude and I worked to decode them and label the values into human-readable context:
Engine

RPM: ID 10, raw/4.
Speed and MAP: also in ID 10.
Throttle: ID 65; a second copy for the transmission computer appears in ID 1A.
Coolant temperature: ID C0, raw − 40 °C.
Intake air temperature and barometric pressure: ID D2.
Start mode: ID 63. You learned it means "engine not yet running", not "starter engaged".

Transmission

Shifter (PRNDL): ID 37.
Gear and converter lock: ID 3A. The high nibble gives unlocked, partial or full lock.
Transmission temperature: probably ID EA.

Body and other data

Fuel level: ID A4. It matched the gauge at 60%.
Battery voltage: ID C0, raw/16.
Status bits: brake, cruise, in-gear, off-idle.
A/C: A/C request and compressor clutch bits.
Clock: ID 80, in BCD.
VIN: sent in chunks in ID F0. Rebuilt the whole thing from the bus.
A tap from the trucks battery voltage was also added from pin 16 on the OBD2 port.
With the hex values decoded, I had Claude create for me an HTML dashboard that would connect directly to the Arduino and show the values as visual readouts. 


The transmit circuit

Although the current circuit worked great for monitoring passive values, it had no way to actually request information from the PCM that wasn't already being transmitted, such as the fuel trims & O2 sensor readings (which was the whole point of initiating this project). So I had to build a transmission circuit.
The challenge is that the Arduino's pins only put out 5V, but a "high" on the bus needs to be close to 7.5V. The Arduino also can't supply the current to pull the bus up against all the other modules connected to it. So the Arduino can't drive pin 2 directly. Instead it flips a switch that connects the bus to a separate 8V supply.

Power comes from the truck's battery on OBD pin 16. It goes through an inline fuse, then a 1N4001 diode, which protects against reversed polarity, then a 7808 voltage regulator, which outputs a steady 8V. Two small capacitors (0.33µF and 0.1µF) on the regulator keep the output clean.

The switch: two transistors. The Arduino can't switch 8V with a single transistor, so the circuit uses a pair:

Q1, a 2N3904 (NPN). Arduino pin D4 connects to its base through a 4.7k resistor. A 10k resistor from the base to ground holds it off while the Arduino is booting or being flashed. That way the circuit can never accidentally talk on the bus while the pin is floating.
Q2, a 2N3906 (PNP). Its emitter sits on the 8V supply. A 10k pull-up from its base to 8V keeps it off by default.
How they work together. When D4 goes high, Q1 turns on and pulls Q2's base down through a 4.7k resistor. That turns Q2 on, connecting 8V to the output. When D4 goes low, both turn off. Q1 is the level shifter between the Arduino's 5V world and the 8V world, and Q2 does the actual switching. D4 high means bus high, and D4 low means the transmitter lets go.
Protecting the bus. The output from Q2 goes through a 1N4148 diode and then a 47Ω resistor to OBD pin 2:
The diode only lets current flow out toward the bus. When another module drives the bus high, that voltage can't flow backward into my circuit. It also drops about 0.7V, which brings the 8V supply down to roughly 7.3V on the bus, right in the range the other modules expect.
The 47Ω resistor limits the current if two modules ever try to drive the bus at the same moment. It also softens the edges of each pulse slightly.
Why it only drives high. Each module on the bus has its own weak pull-down. When nobody is transmitting, the bus rests at 0V on its own. A transmitter only ever has to push the line high and then let go. That's why this circuit has no "drive low" side. When Q2 turns off, the bus falls back to 0V by itself.
The value of each bit is set by how long the bus stays in a state, either 64µs (short) or 128µs (long), and whether it's high or low at the time. Every bit flips the bus state. A frame starts with a longer 200µs pulse that marks the start of the message. The J1850VPWCore library handles all of this, using one of the Arduino's hardware timers to toggle D4 at exactly the right moments.
There were other various bugs troubleshooted and fixed before it was fully working. But after the transmit circuit was completed, I was able to not only see my fuel trims and O2 sensor readings, but also read and erase codes, test module readiness, etc. We also added a graphs tab where you can add any reading and plot it over any amount of time and export the graph as a CSV or a PNG. Hugely helpful for diagnostics.


Going wireless

All of this was amazing and it was exactly what I was hoping achieve in this project. However, this entire time I was driving for hundreds of miles, gathering as much information as I could with the Arduino plugged into the truck and to a USB dock that was plugged into my laptop which would sit on my arm rest. The laptop would slide when I hit the brakes and it was too cumbersome overall. So I wanted to add wireless connectivity.
My first attempt at this was with a clone USB host shield that I had lying around. I had done some research and discovered that this board could be used to host a bluetooth connection and transmit over a serial USB bluetooth dongle. So I decided to order what was sold as a CSR 4.0 bluetooth dongle and had Claude update the firmware to boot.
This is where it all went wrong.
The USB host shield lets the Arduino act as the computer for a USB device. A Bluetooth dongle can't do anything on its own, though. The host has to run all the Bluetooth software and walk the dongle through every step. The library that makes this possible, USB Host Shield 2.0, was mostly written for PS3 and Wii controllers, not for connecting to a Mac.
The first problem was that the USB Host Shield was not powering the CSR dongle with the correct voltage so the dongle was not communicating at all. The poor quality Host Shield knockoff was outputting 4.1V over the 3.3V rail, well out of the operating range. After soldering a 200ohm resistor onto the 3.3V rail I was able to get it down to ~3.5V to power the dongle.
It turned out to be a clone of the CSR8510 chip, too. It never answered some of the setup questions, so the Arduino sat waiting forever.
The library announced itself as a "Toy/Robot" device, which macOS hides. Its old-style PIN pairing didn't work with newer Macs either.
The my mac kept hanging up. macOS asks a few questions before it connects, and the library didn't understand them. By reading my mac's Bluetooth logs alongside a debug mode Claude added to the Arduino, we found each one the Mac was waiting on.
The Arduino forgot the pairing key every time it was unplugged, so the Mac refused to reconnect. The fix was saving the key to the Arduino's EEPROM.
In total it took eight separate patches to the Bluetooth library before my Mac would even pair and stream data. And even then, the CSR dongle would constantly drop connection, making it effectively useless.
The bigger problem was that the Uno was already nearly full. It has 32KB of storage for code and only 2KB of RAM. That RAM has to hold the bus decoder, the polling and safety logic, and now an entire Bluetooth stack. We had to shrink the Bluetooth buffers just to make it fit, and keep the debug logging to a bare minimum. Every feature I wanted next, like trip tracking or check-engine codes, meant cutting something else.
I had enough. So I ordered an Arduino Uno R4 Wifi with built-in bluetooth and wifi, and 16x the storage and RAM for $20.


Porting the R4 WiFi

Claude rewrote most of the existing code to work properly on the R4's RA4M1 chip. But some changes were made to take advantage of the R4's new hardware. Namely, we decided to ditch the bluetooth idea in favor of WiFi. By hosting it's own WiFi network, the R4 could effectively become a server, hosting the entire GUI dashboard as a web page, saving logs, and saving trip data without any work being done client side. Previously, the html file was just run locally and would use Chrome to connect to the Arduino over a serial interface. With the dashboard being hosting directly from the Arduino, none of this was necessary anymore. Any device could connect to the router address of the R4 and have full functionality with the dashboard without any serial interface or USB connections.
So that's what we did. Some bugs were addressed and we also optimized it for mobile devices. I now have an iPad mini that lives in my truck so that it is always connected to the dashboard.
One additional benefit that the R4 brings, is an integrated CAN controller. Meaning, in the future I could add full CAN bus (ISO 15765-4) support to this board. All it would require is an additional CAN transceiver chip, such as an MCP2562 and some additional circuitry. There is already provisions on the proto board for a small surface mount chip such as this.
I may add that in the future, but for now, the whole setup works great.






OpenPuck Xbox Controller

If you aren't familiar with OpenPuck, go read about it on the GitHub . If you don't care to learn, heres the TL:DR: OpenPuck is a so...