Blog Home

Controlling a drum machine with the Arduino Opta

Arduino TeamJune 25th, 2024

Makers have long asked the question “why bother with an expensive PLC when I can just use an Arduino?” The answer comes down to the priorities and needs of industrial clients. In a factory automation setting, the client will prioritize durability, reliability, and serviceability over the one-time purchase price of the device itself. But to prove that Arduino’s professional turnkey solutions are just as easy to use as their developer-focused educational counterparts, Jeremy Cook leveraged an Arduino Opta micro PLC to build a drum machine.

This isn’t any old drum machine that plays sound samples or synthesized notes, but rather a robotic drum machine that makes noise by banging on stuff like a true percussion instrument. Cook could have built this with any Arduino board and a few relays, but instead chose to implement the Opta and new Opta Digital Expansion. That is robust enough for serious commercial and industrial applications, but is still simple to program with the familiar Arduino IDE. Programmers can also use conventional PLC languages if they prefer.

In this case, Cook made noise with relays and solenoids. The Opta has four built-in relays and Cook’s sketch flips one of them to make a sound analogous to a hi-hat. Cook added an Arduino Pro Opta Ext D1608S module with its solid-state relays for the other two “drums.” One of those fires a solenoid that taps a small hand drum (the kick drum sound), while the other controls a solenoid that hits a power supply enclosure (the snare sound).

Together, those three sounds can cover the basics of a drum track. Cook’s sketch is a drum sequencer program that stores each sound sequence as array, looping through them until turned off. 

An Opta may be overkill for a project like this one, but this does a great job of demonstrating the ease at which an Arduino user can transition to professional PLC work.