The prevailing pinball machine
Electrical pinball machines have been round for over 90 years and have undergone a number of large adjustments all through their evolution. Maybe the most important was the transfer from mechanical-style computer systems that used relays and gears to microprocessors and solid-state MOSFETS. Element14 Presents host Mark Donners was lately despatched one such pinball machine from a good friend for repairs that was made in 1972. It options an assortment of lights, bumpers, and even a mechanical rating counter, however sound results are noticeably absent, which prompted Donners so as to add them.
Defending the microcontroller
Older pinball machines run at comparatively excessive voltages, typically ranging between 12 and 48 volts and even larger. These excessive currents coupled with sparks from the relays imply no matter microcontroller is related to the system requires satisfactory electrical and magnetic isolation. Because of this, opto-isolators are sometimes chosen since they bodily decouple electrical alerts from each other by means of the usage of an inner LED, receiving phototransistor, and a few easy amplification to drive an output. Donner’s financial institution of isolators on a bit of protoboard permits for as much as eight distinct triggers from the assorted outputs on the pinball machine.
Methods to play MP3 information?
Now that the alerts from the machine might be learn, the subsequent problem was how you can play sound results primarily based on a short set off. Donners had a couple of selections: a customized 8-bit audio gamers primarily based on an Arduino Nano, a SparkFun Audio Set off board, an affordable audio participant module, or an ESP32-based MP3 participant. The final possibility was chosen because the ESP32 has low latency between receiving a set off and enjoying the corresponding audio file, assist for high-quality I2S sound output, and has the potential for including Wi-Fi/BLE connectivity sooner or later.
As a result of the facility coming from the DAC is barely 3W, an extra layer of isolation and amplification was wanted. The audio transformer module interprets the incoming I2S sign into an audio waveform and helps to reduce the digital noise coming from the DAC. Subsequently, the amplifier takes the lower-power audio sign and boosts it excessive sufficient to drive a speaker. On this case, Donners sought a non-destructive solution to play audio, so he opted for a resonator that turns your entire pinball machine’s chassis into the speaker’s diaphragm.
The firmware
On the software-side, the ESP32 begins by initializing the SD card and its I2S pins for communication with the audio transformation module. Subsequent, it configures the pins related to the opto-isolators’ outputs as inputs earlier than getting into right into a loop. In right here, every pin is checked for a set off sign, and if one is discovered, the audio library causes the accompanying sound file on the SD card to start enjoying.
Enjoying some pinball
After getting a number of of the bumpers and change banks related to the opto-isolator inputs, Donners examined out his newly improved pinball machine by enjoying a few video games on it. As may be heard in his video, every sound impact is performed with minimal latency as soon as a change is activated, and since the whole lot is saved on an SD card, sound information may be simply swapped to new results at any time.