The software is written for the ESP8266 microchip, produced by Espressif Systems.
More information about how to control the hardware of a ESP8266: Technical Reference
Specification of the chip: Datasheet
Atmega2560 D17/TX2 5V (no converter required >3.0V is read as high):
esp8266_B GPIO04/D2 3.3V
Atmega2560 D16/RX2 5V (with voltage divider to reduce below 3.6V):
esp8266_B GPIO05/D1 3.3V
SCL:
esp8266_A GPIO14/D5 <-> esp8266_B GPIO14/D5
SDA:
esp8266_A GPIO12/D6 <-> esp8266_B GPIO12/D6
Potentiometer (0V - 3.3V):
esp8266_A ADC0/A0
Button "Right" (normally open, connected to GND):
esp8266_A GPIO05/D1
Button "Left" (normally open, connected to GND):
esp8266_A GPIO04/D2
Button "Home" (normally open, connected to GND):
esp8266_A GPIO00/D3
LED "Error" (through resistor):
esp8266_A GPIO13/D7
LED "Ready" (through resistor):
esp8266_A GPIO15/D8
Role (master/slave) is determined by reading D7
during boot. This allows both microcontrollers to be flashed with identical software.
GND (reading: LOW):
esp8266_B GPIO13/D7
GND, through led and resistor (reading: HIGH due to internal pull-up):
esp8266_A GPIO13/D7
I²C sends data in different messages. One message can consist of multiple data frames, each consisting of exactly one byte / 8 bit.
Each data frame is followed by an acknowledgement (ACK) bit.
A 7-Bit long address is sent at the beginning of each message to indicate which device is being communicated to.
A message starts with a start symbol and ends with a stop symbol.
- Start symbol
- Address (7-Bit)
- Read-Write-Bit
- Acknowledgement bit
- Data frame
- Acknowledgement bit
.
. [Step 5 and 6 can repeat]
. - Stop symbol
Following features are not yet implemented:
- no repeated start
- no fast mode
- no master-to-master connection
The master is located on the right side and the slave on the left.