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.

Mechatronic Tank

Mechatronic Tank

We would like to introduce Mechatron, our mechatronic tank. When we designed and built Mechatron we wanted him to be tough looking, industrial, and retro-futuristic, with lots of metal, rivets, and gears. He’s built entirely out of aluminum, brass, and steel, but inside, he’s chock-full of high tech electronics. See pictures and more text below. And be sure to watch the video to see Mechatron in action!

 

Mechatron includes special wheels with rollers slanted at 45 degree angles and driven by dedicated gearboxes, four powerful motors, and a software-controlled drive system that we wrote that operates each of the wheels independently. The result is that he can move in any direction at any time in any orientation. In other words, he can drive forward and backwards or turn like a normal vehicle, but he can also drive perpendicular to the direction he’s facing or at any desired angle. Weighing in at forty five pounds, he is by far our heaviest robot, but he is also our most agile, which makes him tremendous fun to drive.

Mechatron’s gun turret pans 360 degrees, includes 8 range-finding sonars for target detection, a laser, and a high-powered electric automatic weapon that shoots brass or plastic pellets. Ammunition is fed from the base of the robot up through one of the articulated metal tubes attached to the turret (the other tube contains wires). He can fire extremely rapidly while standing still or moving.

Strips of 52 programmable RGB LED lights have been mounted on Mechatron’s underside and within his turret. The turret LEDs indicate the robot’s current mode and whether the weapon system is armed. The LEDs on the underside change color depending on the direction of each of the individual wheels (Blue = Stopped. Green = Forward. Red = Backward), which helps to illuminate how Mechatron’s unique drive system works.

Mechatron is designed to function in a variety of different modes, including both user-controlled Radio Control and/or fully-autonomous. For the RC mode, we built our own controller which matches Mechatron in look-and-feel. The left joystick controls the pan and tilt of the gun turret and includes the firing button on top (which is armed using the missile switch). The right joystick controls the drive system. Forward and Backward motion (Y-axis) moves the robot forward or backward. Twisting the joystick turns the robot in the direction of twist (Z-axis). Moving the joystick left or right (X-axis) causes the robot to strafe left or right while maintaining his current orientation. Combined X-Y-Z joystick motions create unique and agile movements, such as strafing in circles. The robot can move in any direction, while panning and tilting its turret and firing all at the same time.

 

Technical Specifics:

  • Overall Design:   Beatty Robotics
  • Arduino Software: Beatty Robotics
  • Metal armor plates: Beatty Robotics
  • Main Microcontroller: Arduino Mega 2560
  • Microcontroller used for controlling LED lights: Arduino Nano
  • Light Controller Software: Beatty Robotics
  • Wheels: AndyMark (special thanks to Andy Baker, who was great to work with on these)
  • Drive Gears: Modulox (special thanks to Dan Richardson at iR3 Creative Engineering & Andy Baker at AndyMark)
  • Pan-Tilt gears and other parts: RobotZone (special thanks to ServoCity)
  • Pan-Tilt Servos: Hitec Digital
  • Sonars:  (12) Maxbotix MaxSonar Ultrasonic Sensors
  • Turret Sensor Head: Beatty Robotics
  • RGB LED strips:  Adafruit (Go Blinky Belt!)
  • MP3 Sound Board:  Sparkfun MP3 Trigger
  • Servo Controller: Pololu Maestro
  • Voltage Regulators: Pololu & Dimension Engineering
  • High-amp Relays: DFRobot
  • Motor Controllers: (2) Dimension Engineering Sabertooth 2×25
  • Motors: (4) CIM
  • Wireless Communication:  Xbee Radio with Sparkfun Xbee Explorer Regulated board
  • Joy Sticks: (2) 3-axis hall-effect joysticks from CH Products
  • Batteries: (1) 12v 3-cell Lithium-Polymer 20C
  • Aluminum, hardware, fasteners, wire, tools, and much else: McMaster-Carr
  • Wire, electronic components, IC boards, and much else: Sparkfun & RobotShop
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