Using the SOMO-II MP3 Module with Arduino

Using the SOMO-II MP3 Module with Arduino

We often add sound effects and even music to our robots. We’ve used a number of approaches, but our latest method is the SOMO-II MP3 Module. Here are some pictures (from a rover robot we’re working on) and the technical details of how we integrated the SOMO module. First, here is a top view showing the speaker on the left, the Arduino in the middle, a stack of relays, and the SOMO (orange and silver colored square) on the right.

A closer view of the SOMO mounted on female headers soldered to a black protoboard. You can see the microSD card sticking out, which will give you an idea of how small the SOMO is. You can also see the 1K Ohm resister, which is required to get it to work.

The underside of the prototype board. The SOMO is using the brown, orange, yellow, purple, black, and red wires. The other wires are unrelated.

We took a powered USB speaker apart, hacked into it, and screwed it to the main plate. We pulled out the speaker’s battery and wired the speaker into the robot’s main 5V battery. We also rewired the speaker’s buttons so that we could control its functionality using an Arduino-controlled relay to change its mode so that it will receive an incoming external audio signal.

Here are the steps to get the SOMO setup: First, put your mp3 sound files onto a microSD card. The files should be in a folder called “01”. And they should be numbered 001xxxxx.mp3, 002xxxxx.mp3, and so on, where xxxxx is any name you want to give them (or no name at all, just the number prefix). The main thing is that the files need to begin with the numeric sequence as shown. Next, wire the SOMO to your Arduino and a powered speaker like this. We used Arduino pin 38 and 40 on our Arduino Mega, but you can use whichever suitable digital pins you wish to (or Serial1, Serial2, or Serial3 on a Mega).

Important Note: The SOMO operates at 3V. If your Arduino operates at 5V (which most do), then solder a 1K ohm resistor on the SOMO’S RX Line. For the speaker, purchase a small, powered USB speaker and cut open the stereo audio cable. You’ll see three wires: white, yellow, and orange. Solder the white wire to the project’s ground. Solder the other two wires to DAC_L and DAC_R. These provide “line out” for a stereo headphone jack, external powered speaker, or amplifier. If you are using a small, non-powered speaker, then use SPK- and SPK+ instead.

The Arduino source code was the trickiest part. We couldn’t find any libraries or examples of using the SOMO with Arduino, so we wrote our own. Thank you to Curtis Whitley for helping us to figure out how to calculate checksums. At the bottom of this post, we’ve provided a sample program that shows how to play an mp3 track from the microSD card. It provides an example of exactly how to operate the SOMO-II from an Arduino.

SOMO Arduiono Code
If you wish to copy and paste, grab the code out of this file.

Security Robot

Security Robot

Security V is a small security robot. It’s equipped with the following capabilities:

  • Automatic electric gun (Airsoft pellet gun) with ammunition cage
  • Pan-Tilt Gun Turret
  • Targeting laser
  • FPV Camera
  • (3) Ping sensors for object avoidance
  • LED Light Strips
  • MP3 Sound Player
  • IR Human Detection Sensor
  • Moto Controller
  • Two motors
  • Two treaded drive wheels and two omni wheels
  • Arduino Mega Microcontroller
  • Xbee Radio for remote control
  • Button panel for selecting the mode

We programmed it with five different modes:

1. Roams autonomously around the house, playing R2-D2 like sounds as it explores & avoids obstacles
2. Remote Control
3. Dance Mode (Plays the song Mr. Roboto and dances around)
4. Guard Mode (enables its infrared human detection sensor and plays a police siren if anyone tries to sneak past it)
5. Shoot (shoots the gun)

Security V Security Robot
Security V slider image
Security Robot
Security Robot
Security Robot – Top View
Talking Robots!

Talking Robots!

We flipped on the power switch for our robot named Security. Then a low rumble erupted from somewhere in the room. The song Mr. Roboto began to play and the robot danced, moving back and forth, spinning and turning, playing its lights–all to the music. It was hilarious! We learned how to change the robot’s software so that I could control the pattern of the robot’s dance. I made the dance longer, more complicated, and even more fun than it was before!

A lot of our robots now talk, play sound effects, or play music, including Security, Roamer, and Mechatron. They have different ways of talking. Roamer uses a text-to-speech chip that my Uncle Chris helped solder into place, and the others use a tiny sound board that reads MP3 files from a micro-SD card. Most of the talking robots say “Roger, roger” because we want them to be a bit like the Battle Droids in Star Wars. It is so much fun to make them say things!

One of the mp3 sound boards we use in our robots