# Microprocessor
The Wi-Fi Pool Kit is controlled using an Adafruit Feather HUZZAH32 as its CPU. The HUZZAH is programmed using
the Arduino IDE and uses an onboard ESP32 as its Wi-Fi transmitter.

![ESP2 Board](1.png)

# PCB
The overall design of the PCB is quite simple. The CPU is powered and programmed through the panel-mount USB
connector. The CPUs USB pin supplies the board's power bus with 5V.

![Pool Kit PCB](2.png)

# Communication protocol
The CPU communicates with all peripheral sensors using the I2C data protocol. All data lines are directly connected
to the CPUs I2C port. Using a different data protocol with this circuit board is not possible.

It is important to keep in mind that all Atlas Scientific components default to UART mode. When adding a new 
Atlas Scientific component to the kit, it must first be put into I2C mode.

Adding additional components of the same type, such as an additional pH or ORP sensor, is not hard to do. As
mentioned above, you must set the device to I2C mode, and you must make sure that its I2C address is not the same 
as the already existing components.

The next table lists the default I2C address of Atlas Scientific components commonly added to this kit.

![I2C addresses](3.png)

# Setting up the Wi-Fi Pool Kit
The Atlas-Scientific Wi-Fi Pool Kit has been designed to upload sensor data to the ThingSpeak website, a free, 
cloud-based data acquisition and visualization platform. You will be required to set up a free account with ThingSpeak 
to upload and visualize the data. With a free account, you can upload data once every 15 seconds.

## Setup a ThingSpeak account
Because the sensor data is stored/viewed on the ThingSpeak website, you will need to setup a ThingSpeak account. 
Create your ThingSpeak account by using the next link: _https://thingspeak.com/login_

![Set up an account](4.png)

## Create a channel
Your data is uploaded to ThingSpeak through a ‘Channel.’ Select **New Channel**:

![Select a new channel](5.png)

To finish this step, Scroll to the bottom of the page and click **Save Channel**.

## Get ThingSpeak API keys
After you saved your channel settings, you will be redirected to your channel page. Click on **API keys**.

![Keys1](6.png)

![Keys2](7.png)

Be sure to save your **Channel ID** and **Write API Key** because we are going to need them in the 
next steps.

## Arduino IDE libraries
You will have to make sure you have the correct path for the ESP32 Library.

In the Arduino IDE, go to **File > Preferences**.

Locate the **Additional Boards Manager URLS** text box.

![Additional boards 1](8.png)

Make sure this URL is in the text box:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

Then, click **OK**.

Now, in the Arduino IDE go to **Tools > Board > Boards Manager**.

![Boards manager 1](9.png)

![Boards manager 2](10.png)

In the search bar of the Boards Manager, lookup **esp32**.
Update to the most recent version if you do not already have it.

## ThingSpeak library for Arduino
Now, you have to use the next link to download the ThingSpeak library, which lets us sending data to this platform: 

_https://www.arduinolibraries.info/libraries/thing-speak_

It is important you **do not unzip** the downloaded file.

You will have to import this _.zip_ file to the Arduino IDE. To import the file, in the IDE go to:
**Sketch > Include Library > Add .ZIP Library**

![ThingSpeak ZIP](11.png)

And pick the corresponding file you just downloaded.

## EZO I2C Library
Use the next link to download the modules for I2C communication between the devices of the board:
https://github.com/Atlas-Scientific/Ezo_I2c_lib

![EZO ZIP](12.png)

Again, it is important you **do not unzip** the downloaded file. One more time, you have to import this file 
to the Arduino IDE by following the same instructions: **Sketch > Include Library > Add .ZIP Library**

