This page contains some miscellaneous notes about wiring on the [KR01] robot, included specifically
so that the robot can be disassembled and reassembled without confusion about which wire goes where.

[{TableOfContents}]

!! Overview

The KR01 is currently using up most of the available GPIO pins, with a bunch being used 
by the [Mini PiTFT display|AdafruitMiniPiTFT] (which is optional). In the future we may offload the four encoder
pins to the daughterboard containing the [ItsyBitsy M4 Express]. Most IO connections are
planned to use the [I2C] bus.

We're not currently planning to use the PWM (pulse-width modulation), SPI, Serial (UART)
or other GPIO features, just digital IO.


!! I2C Bus

{{{
 ► i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- 14 15 -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- 28 -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- 74 75 -- 77   
}}}

!! GPIO Pin Usage

%%small
|| PIN                                 || PIN
| %%org 3V3 %%                         | %%red +5V %%
| __02__: SDA (I2C)                    | %%red +5V %%
| __03__: SCL (I2C)                    | %%grn GND %%
| __04__                               | __14__: TXD0
| %%grn GND %%                         | __15__: RXD0
| __17__: %%prp STATUS LED %%          | __18__: %%prp ENCODER A2 %% %%gry (PCM_CLK) %%
| __27__: %%prp ENCODER A1 %%          | %%grn GND %%
| __22__: %%prp ENCODER B1 %%          | __23__: %%prp ENCODER B2 %%
| %%org 3V3 %%                         | __24__: GPIO 24%%sup † %%
| __10__: MOSI%%sup † %%               | %%grn GND %%
| __9__: MISO%%sup † %%                | __25__: GPIO 25%%sup † %%
| __11__: SCLK%%sup † %%               | __8__: CE0%%sup † %%
| %%grn GND %%                         | __7__: CE1%%sup † %%
| %%gry ID_SD %%                       | %%gry ID_SC %%
| __5__: %%prp STARBOARD INFRARED %%   | %%grn GND %%
| __6__: %%prp CENTER INFRARED %%      | __12__: %%prp PORT INFRARED %%
| __13__: %%prp PORT BUMPER %%         | %%grn GND %%
| __19__: %%prp CENTER BUMPER %%       | __16__: %%prp PUSH BUTTON %%
| __26__: %%prp STARBOARD BUMPER %%    | __20__
| %%grn GND %%                         | __21__
%%
 
%%small
†   Used by [Adafruit 320x240 TFT Display|Adafruit320x240TFTDisplay] \\
%%
For sensor wires, wires are orange or red for port, green for starboard (just like on a boat).

Requires pins for: , , ENCODER B2


GPIO pin 20 is reserved for something, I can't remember. 

{{{
 ► pinout
,--------------------------------.
| oooooooooooooooooooo J8     +====
| 1ooooooooooooooooooo        | USB
|                             +====
|      Pi Model 3B  V1.2         |
|      +----+                 +====
| |D|  |SoC |                 | USB
| |S|  |    |                 +====
| |I|  +----+                    |
|                   |C|     +======
|                   |S|     |   Net
| pwr        |HDMI| |I||A|  +======
`-| |--------|    |----|V|-------'

Revision           : a02082
SoC                : BCM2837
RAM                : 1024Mb
Storage            : MicroSD
USB ports          : 4 (excluding power)
Ethernet ports     : 1
Wi-fi              : True
Bluetooth          : True
Camera ports (CSI) : 1
Display ports (DSI): 1

J8:
   3V3  (1) (2)  5V    
 GPIO2  (3) (4)  5V    
 GPIO3  (5) (6)  GND   
 GPIO4  (7) (8)  GPIO14
   GND  (9) (10) GPIO15
GPIO17 (11) (12) GPIO18
GPIO27 (13) (14) GND   
GPIO22 (15) (16) GPIO23
   3V3 (17) (18) GPIO24
GPIO10 (19) (20) GND   
 GPIO9 (21) (22) GPIO25
GPIO11 (23) (24) GPIO8 
   GND (25) (26) GPIO7 
 GPIO0 (27) (28) GPIO1 
 GPIO5 (29) (30) GND   
 GPIO6 (31) (32) GPIO12
GPIO13 (33) (34) GND   
GPIO19 (35) (36) GPIO16
GPIO26 (37) (38) GPIO20
   GND (39) (40) GPIO21

For further information, please refer to https://pinout.xyz/

}}}
!! Port-Front Board (with BNO05 DoF and [ItsyBitsy M4 Express])

5 pin header:
| %%red +5V %% | SCL | SDA  | NA | %%grn GND %%


!! Port-Back Board (connections to below)

| B1 (black wire) |  A1 (brown wire)
| %%red +5V %%    | %%grn GND %%
| B2              | A2

!! ItsyBitsy M4 Express & BNO055 Daughterboard
 
[{Image src='attach/KR01WiringNotes/daughterboard-02.jpg' caption='ItsyBitsy M4 Express & BNO055 Daughterboard' align='center'}]

The KR01 has a Perma-Proto board dedicated to holding an [ItsyBitsy M4 Express] and a [BNO055 9-Axis Absolute Orientation|BNO055-9AxisAbsoluteOrientationSensor] sensor. The various connections to and from the daughterboard are shown in the above photo. The two columns of cyan and magenta-coloured pins are used to explode the 5V supply, which are used for the bumper and infrared sensors.

This board is currently not functional. The BNO055 is incompatible with the Raspberry Pi, so the ItsyBitsy will be used to drive the BNO055 (and potentially poll other sensors).


----

[{Tag KR01}]