arduino

You are currently browsing articles tagged arduino.

Here’s an Arduino-compatible GI-SP0256-AL2 speech synthesizer module that I’m finishing up. It’s a great 1980’s-era allophone speech synthesizer chip that was used in Intellivision expansion modules and sold at RadioShack stores for years for about $12. You can still find them from time to time on ebay, and they produce a fantastic synthesized speech sound. The chip is sometimes called the “SPO256-AL2” (with the letter “O” as opposed to the numeral “0”) due to a typo in the original documentation from RadioShack.

First, here’s a video of the speech synthesizer in action:

The chip works by sending it a series of allophones (59 to choose from) that make up all the sounds of the English language. It’s a real rats nest when wired up on a breadboard, so I thought I’d throw it together on a little 5cm circuit board. (Let me know by commenting below if you’re interested in one.)

The board leaves open (and accessible) four analog pins and four digital pins (two with PWM), plus two additional analog pins in you use the serial clock and data lines that are set up for I2C communication by default. The eight non-I2C pins are paired with ground pins, and three are set up by default to configure the device address for I2C communication. It requires regulated 5V via a standard 6-pin FTDI connection (you don’t need to use all pins unless you’re programming it), and there’s an output jumper at the bottom that can be amplified to power a speaker.

Here’s the design. It’s about 2 inches square. I’ll post the code when I get it finished up. Let me know if you’re interested!

Arduino-compatible SP0256-AL2 Speech Synthesizer

Arduino-compatible SP0256-AL2 Speech Synthesizer

Some Code

Here’s some of the code I used for my test. I’ve updated the code on Februay 18, 2012 to include the required loop() method (which I’d accidentally left out) and to rename the “SS” constant so it doesn’t conflict with the Slave Select constant in case that’s defined.

// Voice Pins -- The SP0256 address pins are all on the same port here.
// This isn't necessary but it does make it a lot easier to pick an
// allophone in code using PORTC in this case.
#define PIN_A1  A0
#define PIN_A2  A1
#define PIN_A3  A2
#define PIN_A4  A3
#define PIN_A5  A4
#define PIN_A6  A5
#define PIN_ALD  2
#define PIN_LRQ  12

// some words to say
byte purple[] = {PP, ER1, PP, LL };
byte monkey[] = {MM, AX, NN1, KK1, IY };
byte garden[] = {GG1, AR, PA3, DD2, IH, NN1 };
byte moment[] = {MM, OW, MM, EH, NN1, TT2 };

void setup() {
  // Set pin modes
  pinMode( PIN_ALD, OUTPUT );
  pinMode( PIN_LRQ, INPUT );
  DDRC = B00111111;  // Sets Analog pins 0-5 to output

  digitalWrite(PIN_ALD, HIGH);

  speak( purple, (byte)(sizeof(purple) / sizeof(byte)) );
  speak( monkey, (byte)(sizeof(monkey) / sizeof(byte)) );
  speak( garden, (byte)(sizeof(garden) / sizeof(byte)) );
  speak( moment, (byte)(sizeof(moment) / sizeof(byte)) );
}

void loop() {
}

void speak( byte* allophones, byte count ) {
  for( byte b = 0; b < count; b++ ) {
    speak( allophones[b] );
  }
  speak( PA4 ); // short pause after each word
}

void speak( byte allophone ) {
   while ( digitalRead(PIN_LRQ) == HIGH )
    ; // Wait for LRQ to go low

  PORTC = allophone; // select the allophone

  // Tell it to speak by toggling ALD
  digitalWrite(PIN_ALD, LOW);
  digitalWrite(PIN_ALD, HIGH);
}

Allophones

Here are the allophone definitions:

#define PA1 0x00
#define PA2 0x01
#define PA3 0x02
#define PA4 0x03
#define PA5 0x04

#define OY  0x05
#define AY  0x06
#define EH  0x07
#define KK3 0x08
#define PP  0x09
#define JH  0x0A
#define NN1 0x0B
#define IH  0x0C
#define TT2 0x0D
#define RR1 0x0E
#define AX  0x0F
#define MM  0x10
#define TT1 0x11
#define DH1 0x12
#define IY  0x13
#define EY  0x14
#define DD1 0x15
#define UW1 0x16
#define AO  0x17
#define AA  0x18
#define YY2 0x19
#define AE  0x1A
#define HH1 0x1B
#define BB1 0x1C
#define TH  0x1D
#define UH  0x1E
#define UW2 0x1F
#define AW  0x20
#define DD2 0x21
#define GG3 0x22
#define VV  0x23
#define GG1 0x24
#define SH  0x25
#define ZH  0x26
#define RR2 0x27
#define FF  0x28
#define KK2 0x29
#define KK1 0x2A
#define ZZ  0x2B
#define NG  0x2C
#define LL  0x2D
#define WW  0x2E
#define XR  0x2F
#define WH  0x30
#define YY1 0x31
#define CH  0x32
#define ER1 0x33
#define ER2 0x34
#define OW  0x35
#define DH2 0x36
#define SSS 0x37
#define NN2 0x38
#define HH2 0x39
#define OR  0x3A
#define AR  0x3B
#define YR  0x3C
#define GG2 0x3D
#define EL  0x3E
#define BB2 0x3F

Here’s a small, inexpensive, modular, and easy-to-customize motor controller I’m working on that incorporates the Modern Device RBBB ($13), and Pololu’s TB6612FNG Dual Motor Driver Carrier ($8.50). If I fry or want to retask the brain or the driver or both, I can just pop them out and move along. Plus, because the RBBB is essentially a little Arduino, I’m in complete control of the code; I can rest assured that my robot will adequately obey the Three Laws. 🙂

It’s precisely 50 mm square. The ADDY jumpers will allow it to be addressed on an I2C network if desired. I’m working through some DC motor code, but I’m also planning some bipolar stepper code as well. The PCB was designed with Fritzing, which I found to be very usable but a bit limiting.

I’ve decided to sell off the extras either as kits or bare PCBs, so let me know if you’re interested by commenting below.

DMD: Dual Motor Doohickey v1.0 - A flexible motor controller

DMD: Dual Motor Doohickey v1.0 - A flexible motor controller

UPDATE: The circuit boards arrived in three weeks time (detailed at SeeedStudio PCB Turn-Around Time (Registered Mail) ), and I’m very pleased with the results. Here are a few pictures of the boards below. Click on the thumbnail for a larger image.

This was updated again on November 7, 2011 to add Fritzing reference, and the ebay link.

The goal was to crawl on the cheap, and what’s cheaper than popsicle sticks craft sticks and fishing line? Next we’ll wire up a 555 circuit so it can roam untethered, but until then, here’s how to make one of your own. But first the video! 🙂 (UPDATE: Details about the untethered “version 2” with the 555 timer circuits can be found at StickBot V2.0 - Untethered!.)

Supplies

  • 4 Popsicle craft sticks (like Popsicle brand ice pop sticks)
  • 3 small eye screws
  • A few feet of mono-filament (fishing line). We used 10 lb test.
  • 3 pipe cleaners (one is just decorative)
  • 1 small cable tie
  • A bit of masking tape
  • 1 mini micro hobby servo

How to Make It

  1. Body: Stack four popsicle craft sticks, and drill three pilot holes through all of them — one in the center and one at each end. Three of the sticks will be the legs, and one will be the body.
  2. Joints: Arrange the legs on top of the body, and fasten them together with three small eye screws. On most eye screws, the threads will not go all the way to the top, so the legs should be free to move back and forth.
  3. Muscle: With a small cable tie (and possibly a dab of glue), fasten a 3.7g mini micro hobby servo to the body stick, centered between the middle and hind legs, with the motor shaft at the rear. Attach a servo arm so that it points out like the legs when the motor is in its center position. (You can get these motors on ebay for a couple bucks.)
  4. Tendons:Cut six lengths of monofilament, each about 9 inches long. For each line, tie a knot into one end, and thread it from the bottom through the hole at the end of the leg. The knot should be big enough that it won’t slip through the hole. Thread the mono-filament from the legs as follows (in this order):
    • Front left: Left to right, though the center eye, and through the right end of the servo horn.
    • Front right: Right to left, though the center eye, and through the left end of the servo horn.
    • Back left: Left to right, though the center eye, and through the left end of the servo horn.
    • Back right: Right to left, though the center eye, and through the right end of the servo horn.
    • Middle left: Left to right, though the front eye, and through the right end of the servo horn.
    • Middle right: Right to left, though the front eye, and through the left end of the servo horn.
  5. Adjustment: Carefully pull each line snug so that the legs are all perpendicular to the body, and tape them down to the servo horn. Trim off the ends, leaving an inch or so for later adjustment or tightening.
  6. Legs: Cut some pipe cleaners into six 3-inch lengths and wrap each one around the end of a leg. Bend the legs so that they all touch the surface, and are angled toward the back of the crawler. It can take a little time to get it just right, and you’ll probably want to adjust it when you get the motor hooked up.
  7. Antennae: Add some antennae if you wish by wrapping a couple 5-inch lengths of pipe cleaner to the front legs.
  8. Brain: Power the servo with an Arduino, Basic Stamp, or other micro controller, and program it to turn left and right continuously. There’s a sample sketch below.

A Simple Arduino Sketch

#include 

#define SERVO_PIN       9    // what pin is the servo on?
#define LEFT_EXTENT     0    // how far left should the servo go?
#define RIGHT_EXTENT    180  // how far right?
#define PAUSE           500  // how many milliseconds between steps?

Servo myservo;

void setup() {
  myservo.attach(SERVO_PIN);
}

void loop() {
  myservo.write( LEFT_EXTENT );
  delay(PAUSE);
  myservo.write( RIGHT_EXTENT );
  delay(PAUSE);
}

Video Music Credits

The music in the video is by Morusque (CC BY-NC): http://ccmixter.org/files/Nurykabe/32448

Updated Name

I realized that Popsicle was actually a registered brand name and not just a common word, so in order to avoid any confusion or trouble, I changed this little guy’s name to StickBot. This project does not (and never did) have anything to do with Popsicle brand ice pops. In fact, I’m not even sure the craft sticks I uses were actually from Popsicle brand ice pops. So my sincere apologies to the Popsicle people; I hope you continue to let me eat your ice pops because life would simply not be the same without them!

Modern Device offers a couple of fantastic, low-cost, bare-bones Arduino-compatible boards and kits, called the BBB (Bare Bones Board)  and the RBBB (Really Bare Bones Board). The BBB is larger (yet still 1/3 smaller than the ArduinoDuemilanove), and the RBBB is about the smallest and least expensive you can go with the full size ATMega168 or ATmega328 — great if you have limitations on space.

But with less space usually comes fewer components, so here’s a breakdown of what the BBB has specifically that the RBBB does not. You might find that the $13 RBBB kit is really all you need.

  • ICSP Header – The RBBB does not have an in-circuit serial programmer header. This header is for directly programming the AVR MCU (microcontroller), rather than just loading up sketches. For example, you might use it to burn a bootloader onto a blank AVR chip. But if you’re happy with the Arduino environment, then you probably won’t need this; the chips often already have the bootloader installed.
  • 0.1 uF Capacitor, Pin 21 – The capacitor is left off of the RBBB, but they recommend you add it externally.
  • 10K Resistor, Pin 2 – This resistor lies between Pin 2 and the TxD pin on the USB-BUB or FTDI TTL-232R cable port. The purpose of this is to prevent something connected to the TxD pin (which is the chip’s RX line) from supplying enough current to actually power the microcontroller if it’s not powered on its own.  So long as you’re using the whole cable port or are powering the board independently, the resistor isn’t necessary.
  • 15uH Inductor and Capacitor, Pin 20 – Inductors help to smooth out current, and it’s really a nice-to-have rather than a must-have. The Arduino board itself doesn’t even include it.
  • 1N400x Diode – This 1-amp power diode lies between the +5-12V power jack and ground, and prevents current from flowing through the entire circuit in the wrong direction. Wire your power carefully and you won’t need it.
  • 0.1uF Capacitor – This is one of two bypass capacitors that sit between the power jack and ground just before the voltage regulator, and it’s missing on the RBBB. The larger capacitor is still there, though, and it helps smooth out the voltage coming in (e.g. filtering out electrical noise). The smaller capacitors are for smoothing smaller frequencies.
  • Power Jumpers – The BBB has two 3-pin jumpers that allow you to configure its power source, and the RBBB omits these jumpers. The jumpers allow you to power either from USB or an external supply. A power rail supply can be passed through the regulator or not, or even used to power a breadboard if the main power comes from USB or the power jack. The RBBB is simpler, allowing you to power either from USB, or from the power jack, or (if the power is already regulated) directly to a power pin. If you already know how you’re going to power your device, you probably don’t need the flexibility provided by the BBB.

That’s it. Other than these things (and the obvious size and pin differences), the two boards are functionally identical.

Newer entries »