V2 Wiring Guide - Flockbot
The new Flockbots have Arduino Megas. Below is the wiring for them. First we list tables of constraints by pin type. Then we list the final pinouts per device.
Constraints by Type
Serial
Serial | RX | TX | Note |
0 | 0 | 1 | Serial to Pi. On LCD Screen. Shared with USB |
1 | 19 | 18 | Conflict with Interrupts, don't use |
2 | 17 | 16 | |
3 | 15 | 14 | |
Note that we share the Pi with USB so we can download to the bootloader and flash the arduino from the Pi. If we can flash to the bootloader from some other serial, we'd prefer to use Serial2 (COM2) instead.
Interrupt
Interrupt | Port | Note |
0 | 2 | Used for bump Interrupt |
1 | 3 | Used for break beam Interrupt |
2 | 21 | Conflict with IIC, don't use if using IIC |
3 | 20 | Conflict with IIC, don't use if using IIC |
4 | 19 | Used for Right Wheel Watcher Interrupt |
5 | 18 | Used for Left Wheel Watcher Interrupt |
PWM
Port | Note |
2 | Used for bump sensor Interrupt. On LCD Screen |
3 | Used for break beam Interrupt. On LCD Screen |
4 | Used for Gripper. On LCD Screen |
5 | On LCD Screen |
6 | On LCD Screen |
7 | Used by LCD Screen. Unavailable. |
8 | Used by LCD Screen. Unavailable. |
9 | Used by LCD Screen. Unavailable. |
10 | Used by LCD Screen. Unavailable. |
11 | Used by LCD Screen. Unavailable. |
12 | On LCD Screen |
13 | Used by LCD Screen. Unavailable. Also tied to Mega LED. |
44 | Used for PiCam Servo |
45 | Used for Left Wheel |
46 | Used for Right Wheel |
SPI
SPI | Port | Note |
MISO | 50 | |
MOSI | 51 | |
SCK | 52 | |
SS | 53 | |
IIC
IIC | Port | Note |
SDA | 20 | Conflict with Interrupt 2, don't use if you need Interrupt 2 |
SCL | 21 | Conflict with Interrupt 3, don't use if you need Interrupt 3 |
Analog
Port | Note |
A1 | On LCD Screen |
A2 | On LCD Screen |
A3 | On LCD Screen |
A4 | On LCD Screen |
A5 | On LCD Screen |
A6 | Used for Left Diagonal IR |
A7 | Used for Left IR |
A8 | Used for Center IR |
A9 | Used for Right IR |
A10 | Used for Right Diagonal IR |
A11 | Used for Voltage Sensor |
A12 | |
A13 | |
A14 | |
A15 | |
Pinouts by Device
Device | Port | Note |
Left Diagonal IR | A6 | |
Left IR | A7 | |
Center IR | A8 | |
Right IR | A9 | |
Right Diagonal IR | A10 | |
Voltage Sensor | A11 | |
Serial to Pi RX | 0 | Serial 0. On LCD. See earlier note about how we'd prefer to use COM2 |
Serial to Pi TX | 1 | Serial 0. On LCD. See earlier note about how we'd prefer to use COM2 |
Bump Sensor | 2 | On LCD |
Break Beam Sensor | 3 | On LCD |
Gripper Servo | 4 | On LCD |
PiCam Servo | 44 | |
Left Wheel Servo | 45 | |
Right Wheel Servo | 46 | |
Wheel Watcher Left Clock | 18 | |
Wheel Watcher Left Direction | 31 | |
Wheel Watcher Left Mode | 18 | Attached to the ground pin in the clock housing |
Wheel Watcher Right Clock | 19 | |
Wheel Watcher Right Direction | 32 | |
Wheel Watcher Right Mode | 19 | Attached to the ground pin in the clock housing |
A note about the Wheel Watcher Mode
Wheel Watchers need to have their mode pin pulled down to force them into sign/magnitude (direction/clock) mode. We can do this in various ways, it's not precisely defined yet. It appears that just grounding this pin will do the trick. Haven't tested if not doing *anything* will do the trick also.