- Support for 2 Atari style joystick DB-9 connections. Directions, Trigger, and two analog (variable resistance) values.
- Use Wiimote, Nunchuk , gamepad for input devices. Configurable input setup options to accommodate different homebrew hardware. (Like Wiimote tile sensor used like paddle controller rotation.)
- Increase distance of busy little hands from vintage hardware.
If the Atari and the ESP are running on separate power supplies want to avoid back feeding the unpowered device. I'm not sure what a reasonable power draw from the Atari is and the ESP could consume several hundred mA. The i2c level shifter output enable will be controlled by ESP logic. A voltage supervisor was added to the Atari 5V supply to disable the ESP 3.3V regulator until Atari is powered. So if just ESP is powered, it won't start until Atari is powered. If just Atari is powered, i2c chip will be tri-state.
Going to use a dedicated level shifting chip TI TXS0104E for the i2c level shifting. This has 4 signals so will let the IO expander handle SCL SDA, the IO expander interrupt feedback, and feedback if the Atari is powered. While picking this chip noticed the 1M digital pots weren't in stock any longer at Digikey in TSSOP package...
After a quick mini project to make a 3d printed back shell for the joystick connector, wired up a Revision 2 PCB with extra interface for the i2c level shifting. An extra strip board pcb was created with 2n7000 level shifters. The PCB 3.3V rail was hooked up to 5V making the whole PCB work at 5V. Not very pretty but everything worked when tested with 800XL and Pac-Man / Super Breakout.
The Rev 2 PCB arrived this afternoon, but the Rev 3 design was started a few hours later....
Reviewing the AD5242 datasheet shows the wiper/leg voltages need to be within the supply voltage range. The current design has the digital pots powered from 3.3v rail to avoid level shifting the i2c bus. But the Atari needs 5v to the digital pot. I removed the 1M AD5242 chip, mounted it on a breakout board, and tested operation in bread board. Test circuit with the digital pot setup with another resistor as a voltage divider resulted in the observed behavior. Works when powered from 5V, When powered by 3.3V with 5V to the digital pot, no good.
So Rev 3 will power all of the i2c chips with +5V and still have one bus with level shifters for the ESP.
Digikey has the AD5242 1M back in stock but the price is up to $4.24 each for 1-9 pcs.
Test code is working using the https://github.com/hrgraf/ESP32Wiimote Arduino library for one joystick. The direction and trigger buttons are working, responsiveness is great. But still not getting the paddle inputs on Super Break out. The 100k pot is always full left and 1M pot is always full right on the screen. Test code uses the WiiMote ± buttons to adjust the pot output. Resistance change looks fine with the multi-meter.
One leg of the digital pot needed to be tied to +5 and the other end floating. Rev 1 of the PCB connected the leg to ground instead. I was able to rework the current board to correct the but put a lot of heat into the chip getting the enamel wire soldered. Doesn't seem like they are covering full range of resistance any more....
Also added a jumper to allow Atari to power the ESP32 dev board. So far I've been powering with separate USB power supply.
Got connectors wired up for testing with Atari. I changed the wire color to pin arrangement to better match the order the wires are contained in the cable. But, I goofed up something with the pinout so something else to double check and rework.
Finished some basic code to update all four digital pots and the both ports on the IO expander. Consistent 466 ms to update 255 times or refresh rate of 1.8 ms. Plan is to have one ESP32 core just spew out i2c in a loop while the other one handles the wiiMote bluetooth.
So the i2c test code stopped working abruptly after adding logic to set the digital pots output randomly every 2 seconds. Checked and double checked all the PCB connections and reworked most of the solder joints. Got the scope out and probed SCL and SDA. SDA had some small glitches but was staying at 3.3V. Tried another ESP32, same results.
Foiled again by the Arduino IDE! I had changed the ESP32 board to for another project but didn't change it back before resuming this testing. The other board must have had a different default pin for SDA. Everything worked fine after setting back to Node32s board. (I wonder if the 2.0 IDE will store board type in the project....)
Assembled test board. Joystick 1 has 100k digital pot and Joystick 2 has 1M for testing response. 5V on ESP module needed to be jumper-ed to joystick 5V connection to power IO side of the 16-bit expander. After that, i2c address probe found the 3 devices.