Arduino Meets Lego: The Ultimate DIY Robotics Project

Cyrus Tabrizi, 8/29/13
IMG_4109 IMG_3677

Step 9: Bringing the Beast to Life: Installing the Electronics..

      Now we can connect all the electronics together.

      Get a breadboard of your choice and connect all the Servo pins so that each pin is by itself and is not connected to anything (see the pictures I’ve attached if you have no idea what I’m saying). Connect all the red pins of the servos to the red main on the side of your breadboard—this is the positive line and will be connected to the positive terminal of you battery. Do same with the black pins, but connect them to the black main instead—that’s ground. The third servo pin (mine are white and yellow) is your input pin. This third pin should be connected to one of your PWM digital output pins on the Arduino.
      Now you need your XBEE radio and break-out board. Carefully connect these together by gently pushing the front end of the radio in a bit, and then the back a bit. Keep alternating, pushing just a little at a time. This will keep the radio’s golden little spins from bending or breaking (they’re more fragile than something like your servo pins). Plug the board into the breadboard. To know which pins you need to connect you need to look at the surface of the radio or the breakout board. The XBEE radio should have a 1 and a 20 on one end, and the rest is numbered from 1 to 20 counterclockwise. The only pins we need are VCC, DOUT, DIN, and GND—these are pins 1, 2, 3 and 10, respectively. VCC and GND are for powering the radio; DOUT and DIN are the pins used for receiving and sending signals through the radio (DOUT is what the radio is receiving, and DIN is what you want to send through it).
      The GND pin should be connected to the same ground as everything else. The VCC or VIN (voltage in), though, should not be connected to the same positive pins that everything else is connected to, because the XBEE runs on 3.3 volts and nothing higher. Luckily, most microcontrollers have a 3.3 supply pin available so connect the VCC pin to that. If it doesn’t you’ll need to get a voltage regulator that can supply 3.3 volts. The DOUT and DIN pins should be connected to the RX and TX pins (pins 0 and 1 respectively). The RX and TX pins are what the Arduino uses for serial communication—they are the receiving and transmitting pins, respectively, so DOUT should be connected to RX, and DIN to TX.