The prevailing pinball machine
Electrical pinball machines have been round for over 90 years and have undergone a number of huge modifications 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 pal 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, usually ranging between 12 and 48 volts and even increased. These excessive currents coupled with sparks from the relays imply no matter microcontroller is related to the system requires ample electrical and magnetic isolation. For that reason, opto-isolators are sometimes chosen since they bodily decouple electrical alerts from each other by means of using an inner LED, receiving phototransistor, and a few easy amplification to drive an output. Donner’s financial institution of isolators on a chunk 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 may very well be learn, the subsequent problem was tips on how to play sound results based mostly on a quick set off. Donners had a couple of decisions: a customized 8-bit audio gamers based mostly on an Arduino Nano, a SparkFun Audio Set off board, a cheap audio participant module, or an ESP32-based MP3 participant. The final choice was chosen for the reason that ESP32 has low latency between receiving a set off and taking part in 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 ability coming from the DAC is just 3W, a further layer of isolation and amplification was wanted. The audio transformer module interprets the incoming I2S sign into an audio waveform and helps to attenuate 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 strategy to play audio, so he opted for a resonator that turns the whole 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 taking part in.
Taking part in 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 taking part in a few video games on it. As will be heard in his video, every sound impact is performed with minimal latency as soon as a change is activated, and since every little thing is saved on an SD card, sound information will be simply swapped to new results at any time.