BlueCore Smart Grow Controller – 4-Zone Automatic Watering + PH Monitor
by vandenbrande in Circuits > Arduino
32 Views, 0 Favorites, 0 Comments
BlueCore Smart Grow Controller – 4-Zone Automatic Watering + PH Monitor
Hello world! Today i made a BlueCore Smart Grow Controller with four automatic watering zones and a water pH monitor!
This project upgrades an Elecrow / Crowtail Smart Pump Shield with my BlueCore Tech v1.0 firmware. Four soil moisture sensors control four valve channels and one shared pump. A Crowtail pH Sensor V2.0 adds a calibrated water-pH display, while one NEXT button switches between moisture, pH and system-status pages on the onboard OLED.
The moisture page keeps the flower graphics: each plant gets its own moisture percentage and dry/healthy flower. Watering continues while you browse the other pages.
The controller already has an ATmega32U4, relays, pump and valve connectors, OLED and RTC. You do not need a separate Arduino Uno or Mega. In Arduino IDE, select Arduino Leonardo.
This tutorial includes the final tested sketch and my supplied connection diagram. The physical controller PCB is an Elecrow / Crowtail product; BlueCore Tech provides the custom firmware, pH integration, calibration settings, page navigation and display interface.
Watch the demonstration, then follow the wiring, calibration and commissioning steps below. pH is monitored only: this project does not dose chemicals or regulate pH automatically. The RTC displays time; v1.0 watering is moisture-controlled, not scheduled. Keep the first watering tests supervised. User settings and calibration are stored in the sketch and changed by uploading it again.
Supplies
HARDWARE
• 1 × Elecrow / Crowtail Smart Pump Shield with integrated ATmega32U4, onboard OLED and DS1307 RTC.
• 4 × compatible Crowtail soil moisture sensors and matching cables. My build uses the capacitive sensors described in the project notes; the supplied diagram illustrates the connector locations. Calibrate the actual probes you use.
• 1 × Crowtail pH Sensor V2.0 and its pH electrode/probe.
• 1 × three-pin NEXT button module, as shown in the supplied diagram, plus suitable leads.
• 1 × compatible 12 V water pump.
• 1 × complete 12 V four-way solenoid valve assembly with its factory harness.
• Water reservoir, tubing and fittings suited to the pump and valve assembly.
• Regulated DC supply matched to the controller, pump and valves. For the illustrated 12 V pump/valves, use a suitable regulated 12 V supply. Do not exceed the controller's stated 9–12 V input range; check polarity and adequate current capacity.
• Micro-USB data cable and computer with Arduino IDE.
• Optional but recommended: RTC backup battery of the exact type specified for your board revision. Elecrow's newer v2.2 kit manual specifies CR1220, which is non-rechargeable. Do not substitute LIR2032, CR2032 or another rechargeable cell based only on size. A rechargeable cell requires a compatible battery circuit; charging support has not been verified for this build.
CALIBRATION
• Fresh pH 7.00 and pH 4.00 calibration buffers.
• Clean rinse water, separate clean containers and suitable probe-storage solution according to the electrode instructions.
• Dry and well-watered samples of the soil/substrate you actually use.
SOFTWARE
Arduino AVR Boards, U8glib and RTClib by Adafruit. Wire comes with the Arduino core. Install any dependencies requested by Library Manager.
DOWNLOADS
BlueCore_Smart_Grow_Controller.ino and Smart Pump Shield Schematic.png are supplied with this tutorial. No SD card or background-image files are needed. The flower graphics are built into the firmware. The project does not include enclosure STL files.
Understand the Controller and User Settings
Before connecting anything, identify the dedicated moisture, pump and solenoid connectors, the A4 breakout, the button header, USB and DC input using the supplied diagram. The Smart Pump Shield contains its own Leonardo-compatible controller.
Open the sketch and find USER SETTINGS near the top. This is where you adjust button polarity, each moisture sensor's DRY/WET values, watering thresholds, pH calibration, smoothing and refresh intervals. Leave the tested pin definitions unchanged.
External connections versus firmware pins:
• Moisture sockets 1–4 are read as A0, A1, A2 and A3.
• pH uses the A4 breakout.
• NEXT uses D1.
• The dedicated pump connector is controlled internally by D4.
• The single four-way valve harness is controlled internally through D6, D8, D9 and D10.
These internal relay/pump pin numbers are not instructions to connect motors to Arduino GPIO pins. D7 and the external IIC breakout are not used by the added modules in v1.0.
Manufacturer hardware reference: https://www.elecrow.com/wiki/smart-pump-shield.html
Final Connection Diagram and Four Moisture Sensors
Use the supplied Smart Pump Shield Schematic.png exactly as the physical connection reference. Disconnect USB and DC power before wiring. Match connector orientation and the printed signal/power markings; do not rely on wire colour alone.
Plug all four moisture sensors into the board's dedicated Moisture Sensor Interface:
• Sensor 1 → socket/channel 1 → A0 → watering zone 1.
• Sensor 2 → socket/channel 2 → A1 → watering zone 2.
• Sensor 3 → socket/channel 3 → A2 → watering zone 3.
• Sensor 4 → socket/channel 4 → A3 → watering zone 4.
Label the sensor leads and the matching water outlets. This makes it easy to verify that a dry plant opens the correct valve. These are plug-in sensor sockets, not loose wires to a separate Arduino.
Place the sensing area in representative soil, with the upper electronics and connectors kept dry. Follow your sensor's immersion limit. The picture is a connection guide; probe appearance can differ between sensor versions. Use calibration values appropriate to the actual probes rather than assuming every sensor has the same range.
Connect the PH Module and NEXT Button
Plug the Crowtail pH Sensor V2.0 into A4 and connect the electrode to the module's probe connector. There is one pH sensor in this build. Place its electrode in the liquid you want to measure, with the interface board and electrical connectors kept dry.
Connect the three-pin NEXT button using the enlarged 2 × 4 header detail in the supplied diagram. In that diagram's orientation:
• Button GND → header GND, top row, first position.
• Button SIGNAL → GPIO0 / D1, top row, third position.
• Button VCC → 3.3 V, bottom row, fourth position.
Match the diagram's orientation carefully: “top” and “first” are relative to that view. Do not rotate the board and count pins from memory. Check the module's own S / VCC / GND labels.
The sketch uses NEXT_BUTTON_PIN = 1 and BUTTON_ACTIVE_HIGH = true. A short press advances one page; release does not advance it again. A 50 ms debounce filters contact bounce.
If your compatible module outputs LOW when pressed, set BUTTON_ACTIVE_HIGH to false and upload again. This setting changes logic only; it does not fix incorrect wiring or add a pull-up/pull-down. The tested input uses INPUT, so the module must provide defined released and pressed levels.
Connect the Pump, Valve Harness and Tubing
Connect the pump to the dedicated Pump Interface. Connect the complete four-way solenoid valve assembly using its ONE factory harness at the Solenoid Valve Interface. Do not split it into four improvised external GPIO connections.
Route water from the reservoir to the pump inlet, then from the pump outlet to the valve assembly's inlet/distribution arrangement. Run the four controlled outlets to the four corresponding plants. Follow the inlet/outlet markings of your supplied assembly and secure the tubing so it cannot detach or spray the electronics.
The firmware can open more than one valve at once. The shared pump runs whenever at least one valve is active, so check delivery with multiple zones requesting water as well as with just one zone.
Prime and operate the pump according to its instructions. Do not run it dry. For initial electronics checks, leave pump power disconnected; reconnect only when the tubing, reservoir and controlled test containers are ready. There is no reservoir-level sensor or maximum-watering timer in this v1.0 sketch, so a dry or failed sensor can keep requesting water. Commission and calibrate under supervision.
Optional Upgrade: Automatic Water Tank Refill
I also have an older Instructables project that uses an HC-SR04 ultrasonic sensor to measure the water level in a tank.
That project can be adapted very easily to work alongside this Smart Grow Controller.
The original code measures the distance to the water surface in centimeters, but this value can easily be converted into a percentage or any other scale you prefer.
A simple if statement can then be used to control a relay connected to a refill pump.
For example:
- If the tank level drops below a chosen minimum, turn the refill pump ON.
- When the tank reaches the desired full level, turn the refill pump OFF.
This gives you a simple automatic reservoir refill system without changing the main Smart Grow Controller itself.
The ultrasonic water-level monitor can run as a separate module and handle the tank refill independently.
Power and Optional RTC Backup Battery
Use the controller's DC input and verify supply polarity before connection. The supplied connection diagram states 9–12 V DC, and the illustrated pump and valve assembly are 12 V devices. Use a correctly regulated 12 V supply with adequate current for those loads; do not exceed 12 V.
USB is used for programming. It is not a substitute for the pump/valve power supply. Elecrow's instructions call for DC power during upload; keep the pump disconnected while setting up the firmware if plumbing is not ready.
If the controller becomes abnormally hot, disconnect power immediately and check voltage, polarity and wiring. During development, excessive input voltage damaged the power section of a spare controller. Use the correct supply rather than experimenting with higher voltage.
An RTC backup battery is optional but useful: it maintains the clock when main power is removed; it does not power the pump or complete controller. Verify the exact battery type for your PCB revision before fitting it. Elecrow's newer kit manual specifies a non-rechargeable CR1220. Do not assume the holder charges a cell, and do not substitute LIR2032/CR2032 or a rechargeable type without confirmed electrical compatibility. Observe the holder polarity.
Keep water and tubing away from exposed electronics. The controller PCB is not waterproof.
Install Libraries and Select Arduino Leonardo
Install Arduino IDE, then open Boards Manager and install Arduino AVR Boards if needed. Select Tools → Board → Arduino AVR Boards → Arduino Leonardo. Do not select Uno or Mega: this controller uses ATmega32U4 hardware.
Open Library Manager and install:
1. U8glib — the library providing U8glib.h (not U8g2, which has a different API).
2. RTClib by Adafruit. Accept its required dependencies, including Adafruit BusIO if prompted.
Wire.h is supplied with the Arduino AVR core; it does not require a separate download.
Connect a data-capable USB cable and select the controller's port under Tools → Port. Port numbers differ between computers, and a Leonardo can briefly appear on a different port while uploading.
The tested onboard display constructor in this sketch is:
U8GLIB_SH1106_128X64 oled(U8G_I2C_OPT_NONE);
Keep this SH1106 selection. An SSD1306 constructor caused clipped/malformed pixels at the left and unwanted pixels at the right on this board.
Download and Upload the Final Firmware
Download BlueCore_Smart_Grow_Controller.ino. Save it inside a folder named BlueCore_Smart_Grow_Controller, then open it in Arduino IDE. If the IDE offers to create the matching folder, accept.
Read USER SETTINGS before uploading. The included moisture and pH calibration numbers are starting/test values, not universal calibration for every probe. Leave the supplied hardware mappings intact.
Select Arduino Leonardo and the correct port, then click Verify. If U8glib.h or RTClib.h is missing, install the corresponding library before retrying. Click Upload after compilation succeeds.
At setup, the sketch writes all four relay outputs and the pump LOW, reads the sensors, then applies watering logic. Therefore a dry zone can start watering during the 1.5-second BlueCore splash screen. Startup OFF does not mean the pump waits until after the splash.
Confirm the startup text BLUECORE TECH / SMART GROW / CONTROLLER / v1.0, followed by the moisture page. Keep the attached final firmware as your reference and save any calibration edits in your own working copy.
Downloads
Calibrate Each Moisture Sensor
The display maps each sensor's configured dry-to-wet ADC range to 0–100%, with values outside the range constrained to those limits. These percentages are a relative calibration scale, not a laboratory measurement of volumetric soil-water content.
Included starting values:
• Sensor 1: DRY 590, WET 360.
• Sensor 2: DRY 600, WET 360.
• Sensor 3: DRY 600, WET 360.
• Sensor 4: DRY 600, WET 360.
Calibrate one probe at a time in your actual substrate. Record a stable ADC value in the chosen dry condition and another in well-watered soil. Keep insertion depth and placement consistent and keep the electronics dry. Enter those readings in that channel's MOISTURE_n_DRY and MOISTURE_n_WET settings, then re-upload.
The finished OLED shows moisture percentages, not moisture RAW numbers. To collect raw calibration readings in a working copy, temporarily print moistureRaw[0] through moistureRaw[3] after readMoistureSensors() in loop(), with a slow reporting interval (for example once per second). Open Serial Monitor at 9600. Keep the pump disconnected during this measurement-only calibration. Remove temporary diagnostics afterward; they are not needed for normal operation.
Do not enter equal DRY and WET endpoints. Confirm the displayed percentage rises when the soil gets wetter. Recheck all four channels separately: sensor tolerances and soil placement can differ.
Understand Automatic Watering and Hysteresis
The final settings are WATER_START_PERCENT = 30 and WATER_STOP_PERCENT = 55.
For each zone independently:
• Below 30%: open that zone's valve.
• Above 55%: close that zone's valve.
• From 30% through 55%, including exactly 30 and 55: keep the current valve state.
For example, an inactive zone at 40% stays OFF. If it drops to 29%, it turns ON and keeps watering as it rises through 30%, 40% and 55%. It turns OFF once the reading exceeds 55%.
The gap between start and stop is hysteresis. It prevents rapid relay switching when a reading fluctuates around a single threshold.
The pump is ON whenever any valve is active and OFF when all valves are inactive. At boot, valve states begin OFF; a zone within the middle band stays OFF until it falls below the start threshold.
Choose thresholds for your plants and substrate after calibration. Keep the stop threshold higher than the start threshold. Check real soil response and water delivery rather than judging from percentages alone. Watering keeps running on all three OLED pages.
Calibrate PH With Two Proper Buffers
The included temporary test points are RAW 386 → pH 7.00 and RAW 456 → pH 2.50. They came from practical test liquids and assumed values. Filtered water and household cleaning vinegar are not certified pH calibration standards. Do not treat those defaults as accurate measurements for your probe.
Use fresh pH 7.00 and pH 4.00 buffers for calibration:
1. Open the pH OLED page with NEXT.
2. Put the probe in pH 7.00 buffer and wait for the RAW reading to settle.
3. Record RAW; enter it as PH_POINT_1_RAW and set PH_POINT_1_VALUE = 7.00.
4. Rinse the probe with clean water according to the electrode instructions, avoiding buffer cross-contamination.
5. Put it in pH 4.00 buffer and wait for stability.
6. Record RAW; enter it as PH_POINT_2_RAW and set PH_POINT_2_VALUE = 4.00.
7. Check that the two RAW values differ, then upload the sketch again.
8. Recheck both buffers. If readings are wrong, inspect the recorded values, probe condition and connections before trusting water measurements.
The firmware calculates slope = (pH2 − pH1) / (RAW2 − RAW1), then pH = pH1 + (RAW − RAW1) × slope. You do not need to calculate it manually. Identical RAW points would make this calculation invalid.
Measure with the electrode immersed in liquid; a reading in air is not a valid pH measurement. Rinse after acidic-liquid tests and follow the probe manufacturer's storage instructions. The controller monitors pH; it does not automatically correct it.
PH Filtering and Refresh Settings
Every pH reading uses 10 ADC samples. The firmware sorts them, discards the two lowest and two highest, and averages the middle six. This reduces the influence of short spikes.
A further smoothing stage uses PH_SMOOTHING = 0.15. Lower values react more slowly but look steadier; higher values react faster but show more variation. The code comments suggest values such as 0.10, 0.15 and 0.30. Smoothing cannot fix bad calibration, poor wiring or a faulty probe.
PH_UPDATE_MS = 500 updates pH about twice per second. DISPLAY_REFRESH_MS = 250 requests OLED refreshes about four times per second; processing and display drawing also take time. These settings are in USER SETTINGS near the top of the sketch.
After moving between liquids, wait for a genuinely stable reading rather than immediately recording the first number. The RAW value on the pH page is provided to help calibration.
Use the Three OLED Pages
Short-press NEXT to cycle Moisture → pH → System Status → Moisture. Only the press advances the page, with 50 ms debounce.
PAGE 1 — MOISTURE
Four flower graphics correspond to the four sensors, alongside their moisture percentages. The graphics indicate dry versus sufficiently wet conditions relative to the start threshold. They do not indicate valve state throughout the hysteresis band. Pump ON/OFF and the NEXT indicator are also shown.
PAGE 2 — WATER pH
A large live pH value, RAW ADC reading and two-point-calibration indication are displayed. The indication means the two-point formula is configured; it does not certify that your buffers or calibration values are accurate.
PAGE 3 — SYSTEM STATUS
Read the RTC time, pump status and four valve states. In a display such as V 1+ 2- 3- 4+, “+” means active and “−” means inactive.
Use the status page to confirm actual zone requests during testing. Switching pages does not pause automatic watering.
Set and Check the RTC
The firmware uses RTC_DS1307 from RTClib. When rtc.isrunning() reports that the clock is not running, setup initializes it with the sketch compilation date and time: __DATE__ and __TIME__.
A compatible backup battery keeps the clock running across a main-power interruption. Without backup, time retention is not guaranteed. The clock is used for the status display in this version; changing its time does not change the moisture-control thresholds.
If the clock is already running but shows the wrong time, simply re-uploading this sketch will not reset it because the adjustment is conditional. Set the clock using the RTClib DS1307 example or a temporary one-time rtc.adjust(...) in a separate working copy. During a time-setting test keep the pump disconnected. Remove any unconditional adjustment before normal operation, otherwise every restart resets the time again.
Check the computer clock before compiling. This firmware does not automatically synchronize time or apply daylight-saving changes. Verify clock retention after switching the main supply off and back on.
Commission All Four Zones
Prepare the water supply and secure outlets in safe test containers. Supervise the entire test and keep electronics dry.
1. Confirm Arduino Leonardo selection and a successful upload.
2. Check the BlueCore splash and OLED edges: no clipped or stray pixel columns.
3. Press NEXT repeatedly and verify all three pages, one change per press.
4. Check each sensor individually and verify that sockets A0/A1/A2/A3 match zones 1/2/3/4.
5. Start with the other sensors wet enough not to request water. Let one test zone drop below 30%.
6. Confirm its matching valve becomes active and the pump state shows ON. Verify that water actually exits the correct outlet.
7. Wet that sensor above 55%. Confirm the valve becomes inactive and water delivery stops.
8. If all other zones are inactive, confirm the pump switches OFF.
9. Repeat for all four channels, then test two zones requesting water together. The pump must remain ON until the last active zone is satisfied.
10. Check that page navigation does not interrupt watering.
11. Check pH RAW response in the calibration buffers and verify calibrated pH values.
12. Check the RTC, power-cycle the controller and check time retention and restart behaviour. A dry zone can request watering during the splash after the initial readings.
Do not leave the installation unattended until you have checked for leaks, correct sensor placement, reliable shutoff and sufficient water supply. v1.0 has no empty-tank detection or watering timeout.
Troubleshooting
OLED has clipped or unwanted edge pixels: retain U8GLIB_SH1106_128X64 oled(U8G_I2C_OPT_NONE); the SSD1306 constructor caused this on the tested board.
NEXT does nothing: check the supplied header detail, D1 signal, 3.3 V and GND. Check that the input is a three-pin module with defined output levels. Reversed behaviour: change BUTTON_ACTIVE_HIGH for your module.
pH is wrong but RAW changes: recalibrate with proper buffers, not the supplied temporary test-liquid assumptions. RAW does not respond: check A4, probe connection and module supply. Strange pH in air: immerse the electrode; air is not a valid pH sample.
Moisture runs backwards or sticks at 0/100%: check that channel's DRY/WET values and sensor compatibility. Values outside the chosen range are constrained. Check connectors and actual RAW readings before changing thresholds.
Pump stays ON: inspect all four valve states. Another zone may still be requesting water; a disconnected or faulty sensor can also give misleading readings. Disconnect pump power if unexpected watering continues.
Pump shows ON but no water: inspect DC supply, pump connector, priming, tubing direction and blockage. Stop rather than running the pump dry.
Clock is wrong: an already-running RTC needs an explicit time-setting procedure. Re-upload alone only initializes a stopped clock. Time is lost after power removal: verify the correct backup battery and polarity for the PCB revision.
Board gets abnormally hot: disconnect immediately and check supply voltage/polarity and wiring. Do not keep cycling power to a damaged board.
Enclosure, Downloads and Final Result
A suitable enclosure makes the finished controller easier to mount and helps separate electronics from wet tubing. Leave access to the OLED, NEXT button, USB, DC power, four moisture sockets, pH connection, pump and valve harness. Secure cables against strain and place the electronics where leaks cannot run onto them.
A 3D-printed enclosure could be used, but no STL is included. Do not assume a printed box or the exposed PCB is waterproof.
Keep a copy of your calibrated sketch and label the four sensor/valve pairs. The final result combines four-zone watering, flower graphics, three OLED pages, water-pH monitoring and RTC/status information on one controller.
Downloads: the original BlueCore_Smart_Grow_Controller.ino firmware and supplied Smart Pump Shield Schematic.png connection diagram. Use the original diagram as the wiring reference.
Hardware credit: Elecrow / Crowtail Smart Pump Shield. BlueCore Tech custom firmware and interface by Danny van den Brande. Manufacturer reference: https://www.elecrow.com/wiki/smart-pump-shield.html
Thanks for watching and building! — BlueCore Tech