Costa Farms – Hardware Assembly for the Adafruit Feather M0 Wifi with the Atlas Scientific pH Sensor for Remotely Monitoring pH water levels in Microsoft Azure (Article 1 of 2)


What have I been doing lately? Writing code.

In the last couple of months, I’ve been transitioning from 28 years of IT Pro work to more of a Developer focus. My new role deals in the world of sensors and C Code integrating with Microsoft Azure Services. It feels a little like going back to the “old school” of working directly with the machine language, BNC connectors and building your own computers, but on a whole different level.

This article is from some work I’ve been doing with a large Agricultural firm. They have a critical need to manage pH levels in some of their hydroponic systems for growing stronger plants. We worked with their Senior Software Developers and BI Architect to come up with a pH Sensors reading system using Microsoft Azure.

It is time consuming, costly, and difficult for growers to measure and regulate pH throughout the day and across the lifecycle of a plant.  Indeed pH levels are one of the key factors in plant health. Furthermore pH levels in the water and nutrient streams change constantly.  To increase plant health via nutrient uptake in turn promoting higher yields, pH needs to be more closely monitored and adjusted in real time.

Being a farmer myself, I have a vested interest in helping them solve real problems in today’s modern Agricultural industry.

This is the first of two articles. The first explains the setup of this new system as “Proof of Concept” as far as the building the device. The second article covers the C code and setting things up on the device.

First, let’s discuss what’s needed for getting started with the project –

Hardware -

In this article, I’ll be using a diagram to help you visualize the layout of the board and where the components are attached to the breadboard.

After the hardware is procured and assembled, you can move on to the second article to provision the software for your hardware.

Let’s get started!

Take a look below at the Fritzing diagram below, you can get the Fritzing download here.

Breadboard

Note – The Arduino on the breadboard above is not the Adafruit Feather M0 Wifi, see picture below for wiring. This is just for placement view. If you also want to know where the pin numbers are look on your breadboard and they are listed there.

Adafruitfeather

 

Adafruit Feather M0 Wifi Wiring (Below)

Board Wire Color Pin
SCL Green 40B
SDA Yellow 36A
GND Black 43X
USB Red 60Y

 

Atlas Scientific pH Sensor Wiring (Below)

Phcircuit

 

Board Wire Color Pin
RX Green 40C
TX Yellow 36A
GND (top) Black 42X
VCC Red 30Y
PRB White U Out
PGND (bottom) Black 23I

 

Additional wiring needed on Breadboard

 

Board Wire Color Pin
Resistor RX Green 41D
RX Green 40G
Resistor TX Yellow 36D
TX Yellow 36G
Power RX Red 40H
RX Red 40Y
Power TX Red 36H
TX Red 36Y

 

What it should look like!

boardfinal

Important!   Switching from UART mode to I2C mode

The best documentation for this is located on the SparkFun site under the Documents – under Datasheet.

<CR> represents a carriage return (ASCII 13). The user does not transmit the literal string “<CR>”. Commands are not case sensitive.

Transmitting the command I2C,[n] will set the EZO™ class circuit into I2C mode from UART mode. Where [n] represents any number from 1-127. The I2C address is sent in decimal ASCII form. Do not send the address in hexadecimal ASCII form.

Command syntax (Using as example an I2C ID number of 99) I2C[99]<CR>

Device response If an address > 127 is given

*ER       Indicating an error has occurred

If an address >0 and <128 is given (If the response code is enabled, the EZO™ class circuit will respond “*OK<CR>”)

*RS<CR>       The device will restart in I2C mode

The Green LED used to indicate that the device is powered and awaiting an instruction will now change to Blue.

greentoblue

Manual switching to I2C mode

<CR> represents a carriage return (ASCII 13). The user does not transmit the literal string “<CR>”. Commands are not case sensitive.

All EZO™ class circuits can be manually switched from UART mode, to I2C mode. If this is done the EZO™ class pH circuit, will set its I2C address to 99 (0x63).

  1. Cut the power to the device 2. Short the right probe pin to the TX pin 3. Power the device 4. Wait for LED to change from Green to Blue 5. Remove the short from the probe pin to the TX pin. 6. Power cycle the device 7. The device is now I2C mode.

12cmode

I2C mode

An I2C address can be any number from 1-127. If the EZO™ Class pH circuit was put into I2C mode by jumping PRB to TX, the I2C address is 99(0x63).

Once an EZO™ class device has been put into I2C mode the green power LED that was used in UART mode will now switch to a Blue LED. This indicates the device is now in I2C mode.

The I2C protocol is considerably more complex than the UART (RS-232) protocol. Atlas Scientific assumes the embedded systems engineer understands this protocol.

Communication to the EZO™ class device is controlled by the master. The EZO™

class device as an I2C slave. The slave device is not able to initiate any data transmissions.

manualgtob

Once you have completed the hardware setup it’s time to move on to the Software setup and Arduino IDE. For the next steps go to the next article on setting up the software for the Arduino.

 


Skip to main content