# Robot assembly

This file contains assembly instructions for building the robots and soldering the electronics.

## Components

The robot consists of the following components:
* [Adafruit Mini 3-Layer Round Robot Chassis Kit](https://www.adafruit.com/product/3244)
* [Wemos D1 mini](https://aliexpi.com/41SY)
* [Wemos D1 mini battery shield](https://aliexpi.com/sNwB)
* [Wemos D1 mini motor shield (v1.0.0)](https://aliexpi.com/wngF)
* LiPo battery

In addition you will need the following tools:
* A soldering iron
* Solder wire
* Heat shrink tube
* Some wires
* Battery connectors (female)
* Velcro tape
* Self adhesive tape
* Isolation tape
* Pin headers

For the camera based position detection of the robots you will need:
* A camera
* A printer
* Paper
* Cardboard

## Assembly instructions

#### Robot chassis
Assemble the chassis according to the instructions provided by adafruit ([see here](https://learn.adafruit.com/tri-layer-mini-round-robot-chassis-kit)).

### Soldering the electronics
1. Solder on two rows of 8 male pin headers to the D1 mini
![D1 mini](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/d1_mini_pins.jpg)

2. Solder on two rows of 8 female pin headers to the battery shield


3. Solder on two rows of 8 female pin headers to the motor shield as well as a single row of bent pins. Make sure they are soldered on the right way around.
4. In addition solder a jumper to the motor shield to connect the RTS and 3V pin. This will become important later on. Also solder the I2C bridge.

3. In the next step we connect the battery connector pins of the battery shield to the + and - pins of the motor shield. In addition we will add a connector to the motor shield where we can plug in the battery. Here is a schematic:
![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/motor_battery_stack_bb.jpg) 
*Note: I added a new connector instead of using the one already on the battery shield because the plug of my battery wouldn't fit in the on on the shield*

|First, solder two wires to the + and - pins of the battery shield and isolate them with heat shrink:   |
|--------------|---------------|
|Cut two small pieces of wire (about 4 cm), remove the isolation on both ends and cover them with a bit of solder            |   ![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/motor_batter_stack_2.jpeg)|
|Solder the first wire to the + pin of the battery shield |  ![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/motor_battery_stack_3.jpeg) |
| Solder the second wire to the - pin            |  ![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/motor_battery_stack_4.jpeg) |
| Cover both wires with small pieces of heat shrink tube           |  ![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/motor_battery_stack_5.jpeg) |
| Heat the shrink tube with a lighter  |  ![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/motor_battery_stack_6.jpeg) |
| This is how the battery shield should look like with the two wires           |  ![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/motor_battery_stack_6.5.jpeg) |


|Next, we create a connector for the female JST 2-Pin connector for pluggin in the battery: |  |
|--------------|---------------|
| Cut two small pieces of wire (about 3 cm), remove the isolation on both ends and cover them with a bit of solder  | ![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/motor_battery_stack_7.jpeg) |
| Solder the first wire to the JST connector |![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/motor_battery_stack_8.jpeg) |
| Solder the second wire to the JST connector | ![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/motor_battery_stack_9.jpeg) |
| Cover both wires with heat shrink | ![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/motor_battery_stack_10.jpeg) |
| Solder the wires to the motor shield, paying attention to the polarity *(make sure it matches the polarity of your batteries!)*  | ![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/motor_battery_stack_11.jpeg) |

| Now, stack the battery shield on top of the motor shield and solder the |  |
|---|---|
|  This is how it should look like in the end. Make sure all of the exposed wires are covered in heat shrink | ![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/motor_battery_stack_12.jpeg) ![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/motor_battery_stack_14.jpeg) |
| Now you can stack the D1 mini ontop of the battery shield | ![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/motor_battery_stack_13.jpeg) |

| Now it is time to connect the D1 mini to your computer | |
|---|---|
|Use a micro USB cable to connect the D1 mini to your computer | ![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/usb_connection.jpeg)   | 
