One really cool feature of the OT-2 is that it has a speaker that you can play sounds out of! 🔈 🎵

This article will go over the basics of how you can get your OT-2 to play sounds out of the speaker!

Where is the speaker located?

The OT-2 and OT-2R have an 8 Ohm and 2 Watt speaker on the Raspberry Pi. This speaker can play mp3/mp4 files by utilizing a software with Python called mpg123. The OT-2/Ot-2R comes preloaded with /etc/audio/speaker-test.mp3 which is what is used in our example file path AUDIO_FILE_PATH.

How do I use it?

This is only supported with our Python API. You can call the speaker function using test_speaker. An example of how to use it is shown below.

import subprocess 
from opentrons import protocol_api, types
metadata = {'apiLevel': '2.9'}
AUDIO_FILE_PATH = '/etc/audio/speaker-test.mp3'
def run_quiet_process(command):
subprocess.check_output('{} &> /dev/null'.format(command), shell=True)
def test_speaker():
print('Speaker')
print('Next\t--> CTRL-C')
try:
run_quiet_process('mpg123 {}'.format(AUDIO_FILE_PATH))
except KeyboardInterrupt:
pass
print()


def run(protocol: protocol_api.ProtocolContext):
tr2 = protocol.load_labware('opentrons_96_tiprack_20ul', '1')
p20 = protocol.load_instrument('p20_single_gen2', 'left', tip_racks=[tr2])
p20.pick_up_tip()
p20.drop_tip()
test_speaker()

Please reach out to support if you have further questions at support@opentrons.com

Did this answer your question?