Connecting the OPL2 Audio Board - DhrBaksteen/ArduinoOPL2 GitHub Wiki

The OPL2 Audio Board can be used together with a lot of development platforms. Below you will find how to connect the OPL2 board to your platform of choice. Don't forget to also connect the +5v / VCC1 and GND!

Board type A01 Data Latch1 Shift Reset2
Arduino 9 11 or ICSP4 10 13 or ICSP3 8
Arduino Mega 9 51 10 52 8
Teensy 2.0 9 (C6) 2 (B2) 10 (C7) 1 (B1) 8 (D3)
Teensy++ 2.0 9 (E1) 22 (B2) 10 (C0) 21 (B1) 8 (E0)
Teensy LC, 3.0 and later 9 11 10 13 8
Raspberry Pi / Orange Pi3 16 19 15 23 13
NodeMCU4 D7 D5
BBC Microbit 9 15 10 13 8

1 - The OPL2 Audio Board works on either 5v or 3.3v. Make sure that the VCC voltage matches with the logic level voltage of your development board. For example 5v for Arduino and 3.3v for Teensy or Raspberry Pi.

2 - Pins A0, Latch and Reset can be remapped to other digital IO pins when you initialize the library. Pin numbers shown here are library defaults.

3 - On Raspberry Pi and Orange Pi the 5v and GND pins are located at pin 2 and 6 respectively of the GPIO header. You can also run ./connecting to get the pinout specifically for your Pi. By default SPI is disabled on most PIs. You can enable it in config by running sudo raspi-config and enabling SPI in the 'Interfacing Options' menu. Numbers shown in the table are the pin numbers of the GPIO header.

4 - On NodeMCU you need to manually configure the Reset, A0 and Latch pins. For example you can use digital pins 2, 4 and 0 for this. This corresponds to pins D4, D2 and D3 on the NodeMCU respectively.

Other platforms

If your platform is not listed, but it is 100% Arduino compatible then you may still be able to use it with your OPL2 Audio Board board.

  1. If your board uses 3.3v logic levels then I recommend connecting the VCC (+5v on older boards) of the OPL2 board with the 3.3v output of your development board.
  2. The SPI connections DATA and SHIFT of the OPL2 board should be connected to the MOSI and SCK pins respectively of the first SPI bus of your development board. These may simply be called MOSI and SCK, or MOSI0 and SCK0 for example.
  3. The remaining pins of the OPL2 board (A0, LATCH and RESET) can be connected to any free digital pins on your developement board. You can either look for the pins that are equivalent to the Arduino Uno pins from the table above, or you can map them to different pins when you create the OPL2 instance in the code. For example to map pin A0 to digital pin 0 on your development board, LATCH to pin 1 and RESET to pin 2 the library instance is created as follows:
// OPL2(byte a0, byte latch, byte reset);
OPL2 opl2(0, 1, 2);
⚠️ **GitHub.com Fallback** ⚠️