header



Welcome to the Micro Center Tech Support Blog!
Find free technical support on a variety of products featured at Micro Center and plenty of how-tos on new technology. Start searching our Blog below or search our Tech Center archives »

Can't find what your looking for? Take advantage of our Tech Support services »

Join the MC Tech Support Community Forum: Get direct advice from the Knowledge Experts @ Micro Center.
Click here to access the Forum »

Search This Blog

Showing posts with label breadboard. Show all posts
Showing posts with label breadboard. Show all posts

Wednesday, May 29, 2013

MiniPingBot Construction

MiniPingBot
This small Arduino obstacle-avoiding robot is an experiment in reducing 
the size and complexity of larger kit and Do It Yourself (DIY) robots.


Bot Mechanics:

I started with an enclosed 4-cell AA battery pack. This had an advantage of having a small slide switch mounted in the case, so you don't have to keep disconnecting the power connector.

battery pack 

Two mini (9g) continuous rotation servo motors (RobotShop.com ~$5 / ea.) were attached to the back of the battery case using double-stick foam tape. Hot glue further secures the motors to the case, but probably is not needed as long as the tape is reasonably fresh and tacky.

servo motors 

A pair of small wheels off of a toy car were hollowed out, and were the perfect size for the round disk servo horn. The horn disk was press-fit into the wheel and super-glued in place. Hot glue on the inside of the wheel adds additional support between the disk and the inside surface.

small wheels 

A breadboard was trimmed down on the band saw to make a better fit, and the double-stick foam backing used to anchor the board to the lid of the battery box.

breadboard 

A piece of 1/8" plastic sheet was trimmed to make a mount for a 4-pin ultrasonic sensor module. Using a pencil, the position of the two cylindrical sensors was marked out on the plastic, and holes cut using a Dremel tool with a multi-purpose routing drill. A small piece of sticky-back Velcro helps space the sensor from the plastic and help hold it in place. Two O-rings are added to hold the sensors in the openings. A bead of hot glue was run along the edge of the breadboard and two small screws anchor the sensor assembly securely to the bot.

plastic sheet 

For the front wheel, a tiny ball-bearing was screwed to the battery box. (The front end of the box is mostly empty space, so there is no chance of shorting the batteries.) A hunt in the junk box came up with a small wheel assemble from some old printer parts, and a valve stem cap from a bicycle tire that fits over the bearing perfectly. A little cutting and sanding of the plastic frame with the tiny wheel, and then the two parts were glued together with more hot glue.

ball-bearing

small wheel
glued together 

Bot Electronics:

The Arduino Nano connects directly into the breadboard. This is mounted at the rear of the board to allow access with the USB cable for programming the bot. A ground wire is connected between one of the negative rails and the "GND" pin on the Nano. Power is provided by a wire running from "VIN" on the Nano to the positive 5v rail.

breadboard 

The power wires from the battery pack are cut off close to the front of the breadboard. The positive (red) and negative (black) wires are each soldered to a pair of pins in a 2x2 connector and hot glue used to insulate the exposed pins. This fabricated connector plugs into one of the power rails of the breadboard. (This will be our 6v rail - assuming there are four 1.5v Alkaline batteries in the box)

power wires

A 5v regulator has the input pin bent out and a red wire soldered to it. (Hot glue can coat the exposed pin, or use a small piece of heat-shrink tubing to cover it.) The center pin (ground) and 5v output pin are trimmed off and inserted directly into the second power rail of the breadboard. (Note that this step is probably not required, but was done only as a precaution to provide 5v or less for the ultrasonic sensor and Arduino boards.) The red wire has the end soldered to a single pin or is stiffened by tinning the end with solder. This is then connected to the positive side of the 6v rail from the batteries. A wire connects both negative (ground) rails together.

power wires

Servo Motor wires have the signal wire split off and the power wires trimmed shorter. Another 2x2 pin connector has the two servo motor ground wires soldered on, and the two power wires soldered on the remaining two pins. Hot glue to insulate, and then the servo motor power is connected to the 6v rail. The two signal wires from the servo motors have enough reach to be connected to any of the Arduino pins. These each have a small pin soldered to the end and insulated with hot glue. Servo motor signal wires are attached to Arduino D10 and D11.

Servo Motor wires 

A four-wire connector is prepared for the sonar module. The outside power (Vcc and Gnd) connections are soldered to a pair of pins and connected to the 5v power rail. The inside pair of pins (Trig and Echo) are soldered to another pair of pins and connected to D5 and D6.

four-wire connector 

Programming:

Sample sketches are included. MiniPingBot1_0.ino is the first attempt to create a very simple program that uses a single ping to check distance. Then, based on the result, it moves forward, or if it detects an obstacle close by, backs up, rotates to the left and continues. This sketch is using the NewPing library and the core routines from the whisker-bot sketch from Parallax.

#include <NewPing.h>    // include new-ping library
#include <Servo.h>      // Include servo library

#define TRIGGER_PIN  5  // using 4-pin Ping Sensor
#define ECHO_PIN     6
#define MAX_DISTANCE 200  // max distance is 500cm (~16.4 ft)
Servo servoLeft;         // Declare left and right servos
Servo servoRight;
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); //declare sonar (ping sensor)

void setup() {
  servoLeft.attach(10);       // Attach left servo signal to pin 13 
  servoRight.attach(11);      // Attach right servo signal to pin 12
  //Serial.begin(115200);     // Open serial monitor at 115200 baud to see ping results
}

void loop()  {
    delay(50);                 //wait 50ms between pings
    int uS = sonar.ping_cm();  // get distance in cm from sensor

// based on distance, do something...
// if uS = 0 distance to object is >= MAX_DISTANCE

  //Serial.print("Ping: ");      // Monitor ping results in
  //Serial.print(uS);            // serial monitor window
  //Serial.println("cm");        // comment out when done debugging

if (uS > 30)   {
    forward(300);       // forward 1/2 second
}
else {
    backward(100);       // obstacle detected closer than MAX_DISTANCE
    turnLeft(400);      // try turning left a bit and check again
}

}


// Servo control from Parallax BOE-Bot Whisker sketch

void forward(int time)                       // Forward function
{
  servoLeft.writeMicroseconds(1700);         // Left wheel counterclockwise
  servoRight.writeMicroseconds(1300);        // Right wheel clockwise
  delay(time);                               // Maneuver for time ms
}

void turnLeft(int time)                      // Left turn function
{
  servoLeft.writeMicroseconds(1300);         // Left wheel clockwise
  servoRight.writeMicroseconds(1300);        // Right wheel clockwise
  delay(time);                               // Maneuver for time ms
}

void turnRight(int time)                     // Right turn function
{
  servoLeft.writeMicroseconds(1700);         // Left wheel counterclockwise
  servoRight.writeMicroseconds(1700);        // Right wheel counterclockwise
  delay(time);                               // Maneuver for time ms
}

void backward(int time)                      // Backward function
{
  servoLeft.writeMicroseconds(1300);         // Left wheel clockwise
  servoRight.writeMicroseconds(1700);        // Right wheel counterclockwise
  delay(time);                               // Maneuver for time ms
}

MiniPingBot1_1 changes the method of determining distance with the sensor. One problem I noticed with the 1.0 version of the code was that the ping sensor would occasionally return a bad value and cause the bot to correct multiple times, even when no obstacle was close. Using the PING_MEDIAN function, five pings are used and the median result is returned to the program. This seems to eliminate the odd course corrections.
int uS = sonar.ping_cm();
      // get distance in cm from sensor uS using single ping 
becomes:
unsigned int uS = (sonar.ping_median() / US_ROUNDTRIP_CM);
      // Get average distance for 5 pings, convert to cm
      // US_ROUNDTRIP_CM = distance sound travels in cm/sec
MiniPingBot files (zip) <== Click to download the MiniPingBot 1.0 & 1.1 sketch files and NewPing library. To use: extract the contents of this zip file to your Arduino working directory. Open the containing folder for the Arduino.exe program and locate the "libraries" subdirectory. Copy the entire "NewPing" folder into the libraries directory.

For more assistance contact Technical Support here.

Tuesday, April 2, 2013

Arduino Workshop - Parallel LCD Project 1: DFRobot Parallel LCD

Hardware Required:

Schematic:

No schematic necessary. All connections are made by installing the LCD Shield directly onto the Arduino's sockets.

Schematic


Note: The boards tested use different signal and data pins than the default examples in the LCD Library. Our LCD Shield uses pin 8 for Register Select, Pin 9 for Enable, and pins 4, 5, 6, 7 for data
- connecting to Arduino pins 12, 11, 5, 4 , 3 and 2, respectively. You cannot change these pin connections, but must make sure your Sketch code specifies the actual pins being used:

// the syntax to specify the connections used by the LCD Shield should read:
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);


Wednesday, March 6, 2013

Arduino Workshop - Serial LCD Project 2: Parallax Serial LCD


Hardware Required:

  • Arduino Uno board
  • Parallax 16x2 Serial LCD

    Hardware Required

Schematic:


Schematic

Use the breadboard to connect a Parallax serial LCD module. Insert the three pins on the back into the breadboard, then run patch wires from the data, +5v, and Ground.

Hello World


Friday, February 15, 2013

Arduino Workshop - Serial LCD Project 1: SparkFun Serial LCD


Hardware Required:

  • Arduino Uno board
  • SparkFun 16x2 Serial LCD

    Hardware Required


Schematic:


Schematic



Using the breadboard to connect a SparkFun serial LCD module. You can just as easily connect the LCD wires directly to the Arduino.

Wednesday, February 6, 2013

Wednesday, January 23, 2013

Arduino Workshop - Project 05: Push-On, Push-Off - Part 2

Hardware Required:
  • Arduino Uno board
  • LED (x2)
  • 330 ohm (x2), 10 K ohm resistors
  • Pushbutton switch (N.O.)
  • jumper wires

    Hardware Required

Schematic:


Schematic

Project Steps:


  1. Assemble an LED and pushbutton, following the directions for project 4.
    Add a second LED:
  2. Insert a second LED in the breadboard
  3. Connect a wire between the ground and the short pin of the second LED
  4. Connect a 330 ohm resistor between the D12 on the Arduino and the long-leg of the LED
    Change the program to turn LED2 on when LED1 is off, etc..
    • Save a copy of the Project4 code as a Project4b (file, save-as, enter new name)
    • Change all of the "LED" variables to "LED1"
    • Copy each line containing "LED1" and paste as a new line immediately following it.
    • Change "LED1" in each of the duplicate lines to "LED2", for example:
      const int LED1 = 13;
      const int LED2 = 13;
    • Change the Digital Output used for LED2 to 12 (const int LED2 = 12;)
    • Change the lines that turn LED2 on and off to the opposite of what LED1 has:
      digitalWrite(LED1, HIGH);
      digitalWrite(LED2, LOW);
    • Verify your code and upload to the Arduino.

Friday, January 18, 2013

Arduino Workshop - Project 04: Push-On, Push-Off - Part 1

Hardware Required:
  • Arduino Uno board
  • LED (any color)
  • 330 ohm, 10 K ohm resistor
  • Pushbutton switch (N.O.)
  • jumper wires

    Hardware Required

Schematic:

Schematic

Thursday, December 20, 2012

Arduino Workshop - Project 01: Blinking LED


Hardware Required:



Schematic:



Schematic:

arduino


Note: most Arduino modules have an LED connected to D13 already. Your LED should blink at the same time it does.

Project Steps:

  1. Insert the LED into the breadboard
  2. Connect a wire between the ground and the short pin of the LED
  3. Connect a 330 ohm resistor between the Digital pin 13 (D13) on the Arduino and the long-leg of the LED
  4. Connect the Arduino unit to your computer with the USB cable
  5. Open the Project1 sketch into the Arduino software and upload it to your module

Things to try:
  • Code: Change the blink rate from 1 second to 3 seconds
  • Code: Change the blink rate to "strobe" at 50 times per second.
  • Can you change it to blink at 60 times per second?
  • LED: What happens if you reverse the LED (resistor & short-leg to D13, long-leg to GND)?
  • LED: What happens if you reverse the LED but connect the long-leg to +5V?
  • Code & LED - Change the sketch to use an LED connected to D7 instead of D13

Wednesday, December 19, 2012

Common Electronic Components used with Arduino


Component:

Schematic:

Image:

Resistor, units = Ohms Ω
K = 1000, M = 1000000

Resistor values can be determined by "decoding" the color
stripes on the device. The first two colors are the value, the third stripe
is a multiplier (number of zeros to add). The fourth stripe is usually
metallic and indicates the tolerance.

Schematic 1

Resistor values

Potentiometer (adjustable / variable resistor)
Units = Ohms Ω
K = 1000, M = 1000000

Potentiometers may have a numerical value printed on the side or
bottom. Read this similar to the color stripes. In the image, you can see a
value of 103; In a color code, this would be Brown-Black-Orange = 10000 ohms
or 10K ohms.

Schematic 2

Potentiometers

Photo Resistor, units = Ohms Ω
K = 1000, M = 1000000

Schematic 3

Photo Resistor

LED (Light Emitting Diode)
The short leg connects to the ground or negative, and long leg to a positive
voltage source in your circuit.

Schematic 4

LED

Diode
The stripe on the barrel indicates the cathode and corresponds to the
"T" side of the schematic.

Schematic 4

Diode

Switch (pushbutton, toggle, momentary contact)
Other switch configurations include:
DPST - Double
pole, single throw
DPST
SPDT - Single
pole, double throw
SPDT
DPDT - Double
pole, double throw
DPDT

SPST - Single pole, single throw:
SPST
SPST

Switch

Relay
The 5-pin configuration pictured corresponds closely to the
schematic, with the 2-pin end for the (electromagnet) coil, and the 3-pin
connection for the switch.

Relay

5-pin configuration

Transistor - NPN

Transistor

NPN

Ground
The Arduino UNO modules have three pins identified as a ground connection.
This is usually connected to the negative connection of your power source as
well.

Ground

Arduino UNO


Battery
a 9v battery clip
(red=positive,
black=negative):

Battery

Battery

9v battery clip

Check out Arduino Workshop - Project 01: Blinking LED from one of our In-Store Clinics.

Stayed tuned for more Arduino workshops posted here!

For more assistance contact Technical Support here.