robot

You are currently browsing articles tagged robot.

He we’re test-driving the our latest robot creation for the first time. It’s the boy’s design and made mostly of wood. The tires are o-rings, and there’s a 12V AA batter pack sandwiched between the two pieces of plywood. The system right now consists of a drive controller using a Modern Device‘s RBBB (small Arduino-compatible) and the Pololu TB6612FNG Dual Motor Driver Carrier, a robot controller, which is a standard Arduino Uno (which doesn’t do a whole lot right now expect forward messages from the remote), and a remote controller, which is another RBBB, joystick and display.

Right now there are two driving modes. The first is a tank drive, where, for example, if the joystick is moved far left, the right wheel moves forward at full speed and the left week backward at full speed. The second mode is what I call “target drive,” in which you set the target speed and direction of each wheel. Soft starting and stopping is built in to the controller, and the jerkiness you see sometimes is a bug in the keep-alive timer — if the robot stops getting messages in target drive mode, then it will stop.

Music is “Don’t you” by stefsax (CC BY 2.5).

Here’s a 12-channel bidirectional logic level shifter with a 3.3V power regulator that I designed so I could easily interface 5V circuits with cool 3.3V widgets like the ADXL345 accelerometer, the NRF24L01+ wireless transceiver, and the Nokia 5110 8448 LCD. For the one in the picture, I used round machine pin headers because I use it with hookup wire and those female headers are very easy to separate from 40-pin lengths.

12-channel Bidirectional Logic Level Shifter

DIY 12-channel Bidirectional Logic Level Shifter / Logic Level Translator, using AMS1117 and 2N7000 MOSFET pass transistor interfaces

Up to twelve 5-15V logic signals can go into one side and come out as 3.3V signals on the other side, or the other way around (3.3V signals go in and can be read as 5-15V signals) in any combination. The regulator portion converts 5 to 15V DC into a steady 3.3V for up to 1 amp.

In this video, I show how it works translating from 7.5V to 3.3V. The video is from the A Hackable 12-Channel Bidirectional Logic Level Shifter/Translator post.

Why did I not just use a 74HC4050 or some other logic level translator? Because this is much cooler! It’s bidirectional, it has twelve independent channels, in includes a 3.3V regulator, it’s inexpensive, it’s good soldering practice, and it’s hackable. In the photo below, I’ve wired it up to specifically drive a 3.3V Nokia 5110 LCD. It uses only five of the 12 channels as logic level translators, channel two is wired directly to 3.3V for power, and channel 3 is wired directly to ground. The transistor on channel nine is turned so that the 5V signal controls the gate, which allows PWM control of the LED with full power from the regulator. I’ve also used a different resistor. (More photos below.) And why no resistor arrays? Because resistors are usually inexpensive and on hand, and resistor arrays would limit hackability.

Logic Level Shifter Hacked for Nokia 5110 LCD

Logic Level Shifter Hacked for Nokia 5110 LCD

It’s essentially a AMS1117 3.3V regulator with capacitor at the top, and then an array of MOSFET pass transistor interfaces with n-channel 2N7000 MOSFETs. Each side is held high by a resistor 5.6k ohm resistor. If the 5V side is pulled low, the voltage from ground to source will be 2.7V because the diode becomes forward biased, and this turns on the transistor, pulling the 3.3V side low. If the 3.3V side is pulled low, the transistor also turns on with 3.3V, pulling the 5.5V side low.

It was designed using KiCAD (free), and PCBs were ordered through SeeedStudio’s Fusion PCB service. All the components are easily available online, at Digikey or on eBay. Here are the parts I used. The costs reflect per items costs for small bulk purchases (usually around 10-50 pieces) on eBay.

  • 1 AMS1117 3.3V 1A Voltage Regulator – 28¢ (datasheet)
  • 1 22uF electrolytic capacitor – 9¢
  • 12 2N7000 n-channel MOSFET – 60¢ for 12 (datasheet)
  • 24 5.6K ohm resistors – 43¢ for 24
  • 2 12-pin female headers (I used round ones for the one in the picture, but you should use the standard square ones if you’re not just using jumper wires.) – 29¢ for one 40-pin header, then cut into smaller pieces.
  • 2 2-pin female headers
  • 1 custom PCB – $1.12

The total unit cost was $2.81, plus time and solder. I’ve decided to sell off the extras either as PCBs or as kits, so let me know if you’re interested by commenting below.

Here’s the schematic and a screenshot of the PCB design, as well as a larger version of the image above:

Before I placed my order, I had questions about Seeed Studio Fusion PCB service turn-around time for shipping to the USA, and so I figure others might as well.

Here are details of my order of the ten 5cm square PCB’s shown in DMD: Dual Motor Doohickey (Modular RBBB and TB6612FNG Driver Board). The total cost was $13.42, including shipping (subtotal $9.90, plus $3.52 Registered Air Parcel). There were no “extras” (like 100% e-test, special colors or shipping methods, etc.).

  • 8/02/2011
    • 7:52 AM – Order placed. The total charge appeared on my PayPal account six minutes later, and the order confirmation with order number arrived at the same time.
    • 8:47 AM – I added the order number to the silkscreen layer of the PCB as requested and sent the gerber files to the email address specified about an hour after the order was placed. The design and gerbers were created with Fritzing.
    • 6:26 PM – Received an order update email: The order has been changed to status “Processing.”
  • 8/03/2011, 4:37 AM – Received an order update email: The order has been changed to status “In production.”
  • 8/04/2011, 1:49 AM – Received a person email from Dwin, I assume because when I ordered I had asked them to let me know if there were any problems: “Your PCB is under processing. If the file and design meets requirements, they will be processed and shipped in 4-6 working days.”
  • 8/08/2011
    • 4:33 AM – Received an order update email: The order has been changed to status “Traceable.”
    • 4:56 AM – Received an order update email: The order has been changed to status “Shipped.” (Yay!)
    • 9:21 PM – Received an order update email with a link for tracking the order.
  • 8/09/2011, 4:44 PM – Tracking status: “Acceptance” at Hong Kong; Tracking status: “Origin Post is Preparing Shipment.”
  • 8/11/2011, 10:53 AM – Tracking status: “Processed Through Sort Facility” at Hong Kong. “The item left Hong Kong for its destination.” (United States of America)
  • 8/23/2011
    • 7:29 AM – Tracking status: “Arrival at Unit” at my local post office.
    • 4:01 PMDelivered. I actually received 12 (instead of 10), and they all look great. They were very well packaged in a small corrugated cardboard box with lots of bubble wrap.

That’s 21 days or three calendar weeks start to finish — not bad at all! Tonight, I solder!

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

We finished up PopsicleBot StickBot with a couple of 555 timer circuits to allow it to roam freely and untethered. It was a lot of fun to build, and even though it’s not the fastest walker or the simplest design, it feels very organic, partly because it’s entirely analog. (As another reader noted, it would have been a lot easier to just use a Microchip PIC12F683 — or PICAXE-08M or 08M2 — but that wouldn’t have been quite as fun, and I was really looking forward to making “eyes” out of the circuits.) See the original post here: StickBot: A Simple 6-Legged Walker. You can click on any of the photos to see larger versions.

StickBot v2 - Untethered

StickBot v2 - Untethered

There’s a 9V battery now attached to its belly with a cable tie. The power feeds into a 7805 voltage regulator, which is fastened with a drop of glue and another cable tie under its nose. 5V and GND are fed up to it’s right eye, where a 555 timer is set up to oscillate between 0 and 4.25 volts with a frequency of 1Hz — so a half second for the left step, then a half second for the right, and so on. The green wire is the 1Hz square wave output.

StickBot v2 - Power

StickBot v2 - Power

The soldering work is far from beautiful, but it is functional, and of course wrapping it up in tape makes it look a little cleaner. You can see where I slipped in little pieces of electrical tape where needed to avoid unwanted connections. There’s a video of soldering up one of the eyes here: StickBot - Building the Right Eye

5V and GND are also fed up to the left eye, where the inner green wire carries the 1Hz square wave generated by the right eye, and the outer green wire carries the servo control signal. The 555 circuit that makes up the left eye creates this control signal, using (in part) a resistor (R3) that I bundled with the other eye. I did this to keep the number of components in each eye balanced. Nobody wants to see a PopsicleBot StickBot with one eye that’s much bigger than the other!

To simplify the soldering work, I left pin 4 (reset) empty on both circuits, as well as pin 5 (the control voltage pin) on the 1Hz oscillator. Ideally, you’d tie both reset pins up to 5V, and tie the empty pin 5 to ground through a 10nF capacitor. This keeps unwanted noise from potentially affecting the circuit.

Here’s the schematic: (Click for a larger version.)

PopsicleBot v2.0 Schematic

StickBot v2.0 Schematic, with two 555 timer circuits sweeping a servo motor from right to left.

…and here’s the video:

Resources

Here are some helpful resources if you’re working with 555 timer circuits.

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!

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!

Newer entries »