Introduction: Arduino Connections
In my previous Instructables, I have realized that many beginners does not know how to make connections between servos, sensors, etc. to the Arduino microcontroller, and require schematic diagrams to help them. However, I feel like schematic diagrams aren't the best (I'm just really lazy and don't want to make one). So this tutorial will help you know how to connect electronics to the Arduino without the need of a schematic diagram (and will help with other tutorials without schematic diagrams).
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Step 1: Know the Connections
In Arduino, many servos, sensors have three pins. They are Signal (Sig), 5 Volt (5V), and Ground (GND). If you have seen an Arduino board, you will notice that it has one 5V port and two GND ports. The 5V port is used to send power from the power source (should be connected to the Arduino) to the required source (servo, sensor, etc.). The GND port is used to close a circuit. Most projects share a common ground. You will also notice that there is a row of ports numbered 1-13. These are digital pins that are used to send signals to servos (think of servos as "smart motors"), sensors, etc.
On Parallax servos, the SIG wire is white, the GND wire is black, and the 5V wire is red. For Hi-Tec servos, the GND and 5V wires are the same colors as the Parallax servos, but the SIG wire is yellow instead.
Step 2: Step 2: Reading the Code
Now, when you don't have a schematic diagram, the best helper of telling you where to connect is, well, the code:
Servo leftservo; //Left wheel servo
Servo rightservo; //Right wheel servo
Servo scanservo; //Ping Sensor Servo
const int pingPin = 7; //Pin that the Ping sensor is attached to.
const int leftservopin = 10; //Pin number for left servo
const int rightservopin = 9; // Pin number for right servo
const int scanservopin = 6; // Pin number for scan servo
You see that I have copy and pasted the first part of the Obstacle Avoidance Robot's code onto the instructable. The first three lines are used to declare the servos. Now look at the last three lines; they are all servo pins: left servo, right servo, and the scan servo, used to rotate the Ping))) sensor. The number after the equal signs are 10, 9, and 6. Those numbers are the ports the SIG pins should be connected to. In the center, you see that its the pin number for the Ping))) sensor, so you connect the Ping))) sensor into pin 7. Also note that these are digital pins, not analog pins. You might also see that to the right it says "//Pin number for blank", so that should also give you a clue of where the connect.
I hoped this Instructable helped, and I'll be seeing you on my next Instructable!