SMS Solar Pump Controller with ESP32 and SIM800L: Proteus Simulation: the ESP32, the SIM800L GSM module, the relay module, the 12 V solar pump, the soil sensor and the tank sensor

SMS Solar Pump Controller with ESP32 and SIM800L: Proteus Simulation

40
700
60
25
60
PCBWay

Hello friends, I hope you all are doing great. Today, I am going to share the SMS Solar Pump Controller with ESP32 and SIM800L in Proteus Simulation, the fifty-ninth project of our IoT Projects series. If you have searched for an ESP32 SIM800L project, a GSM pump controller, or a Proteus simulation of an SMS-controlled relay, here is a complete one. A solar water pump stands in a field far from any WiFi; its owner switches it on and off from any phone, with a text message or simply a missed call, and the ESP32 answers every command by SMS. When the tank runs low, the pump stops before it can run dry and the owner gets an alert; in AUTO mode a soil moisture sensor decides when to water.

GSM control is still the way many farmers run pumps in remote fields: a mobile signal reaches places that WiFi and wired internet never will, and every phone can send an SMS. In this tutorial, we will go through the circuit, see how the ESP32 talks to the SIM800L with AT commands, how an SMS arrives and how one is sent, why a missed call is a free remote control, how the soil sensor is calibrated, how the pump is protected from running dry, walk through the code, and then run the simulation: commands by SMS, a status report, an empty tank with its alert, a missed call, AUTO watering on dry and wet soil, and an unknown message. At the end, you can download the project with the sketch and every library file.

NOTICE: Our team has put a lot of effort into this project: the circuit, the code and every part in the simulation are our own work, and you get them all free. Your feedback is the fuel that keeps us going, so please tell us what you think in the comments below. And if our free projects help you, you can buy us a coffee. So, let's get started with the SMS solar pump controller with ESP32 and SIM800L in Proteus simulation:

SMS Solar Pump Controller with ESP32 and SIM800L: Proteus Simulation: the ESP32, the SIM800L GSM module, the relay module, the 12 V solar pump, the soil sensor and the tank sensor
Figure: The SMS-controlled solar pump in a Proteus simulation: the pump running after an SMS.
SMS solar pump Proteus simulation: the pump on by SMS, the tank low, AUTO watering
Figure: The working circuit in the simulation: ready, ON by SMS, the tank low, a missed call, AUTO on dry soil and off on wet soil.

What Does This SMS Pump Controller Do?

  • Takes orders by SMS: ON, OFF, AUTO and STATUS, in any case and inside any sentence, so PUMP ON or Please turn ON work too.
  • Answers every command: each SMS gets a reply with the pump, the soil moisture and the tank, so the owner knows the order was carried out.
  • Works with a missed call: a call from the owner's number toggles the pump; the ESP32 hangs up at once, so the call costs nothing.
  • Obeys only its owner: texts and calls from any other number are ignored and logged.
  • Protects the pump: a water sensor near the bottom of the tank stops the pump before it runs dry, and the owner gets an ALERT SMS; a run also stops after a set time.
  • Waters by itself in AUTO: a capacitive soil moisture sensor starts the pump when the soil is under 30 % and stops it at 45 %.
  • Shows it all on WiFi too: a dashboard on a laptop or a phone shows the pump, the mode, the soil, the tank, the signal and the last SMS in and out, with AUTO and MANUAL links.

It is a great project for learning GSM modules, AT commands, serial communication on the ESP32's second UART, relay control of a DC load, analog sensor calibration and a small web server, all in one sketch with no extra library. In the simulation, the SIM800L's pop-up panel has a virtual phone: you tap a message and it arrives at the module as a real SMS, and the replies appear as chat bubbles. The relay's pop-up shows the coil and the contact current, the pump's pop-up the flow and the head, and the two sensors' pop-ups let you empty the tank and dry or soak the soil.

Components Used in the Proteus Simulation

All the parts come from our Proteus libraries, each with its own tutorial. The project zip at the end includes every LIB and DLL file.

The parts of the SMS solar pump controller and their library posts
PartProteus deviceLibrary postConnection
ESP32 DevKit V1ESP32 DEVKIT V1ESP32 DevKit V1 Library for ProteusU1, ESP32_GSM_Pump.hex, TEP-WiFi 192.168.1.101
SIM800L GSM moduleSIM800LADVTEPSIM800L Library for ProteusU2, Serial2 at 9600 baud, a +4V supply
2-channel 5V relay moduleRELAY2ADVTEPRelay Module Library for ProteusRLY1, IN1 from D26 (active LOW)
12 V solar water pumpSOLARPUMPTEPSolar Water Pump Library for ProteusPU1, on the relay's NO1 contact
Capacitive soil moisture sensorCAPSOILADVTEPCapacitive Soil Moisture Sensor LibraryU3, AOUT to D34
Water sensor (the tank)WATERLEVELADVTEPWater Sensor Library for ProteusU4, S to D35
Laptop WiFi MonitorLAPTOP WIFI MONITORLaptop WiFi MonitorPC1
Mobile WiFi MonitorMOBILE WIFI MONITORMobile WiFi MonitorMOB1

Proteus Simulation of the SMS Pump: the Circuit

SMS solar pump controller Proteus simulation circuit: ESP32 DevKit V1, SIM800L GSM module, relay module, 12 V solar pump, soil and tank sensors
Figure: The complete circuit of the SMS pump on an A3 Proteus sheet.
The connections of the SMS solar pump controller
PartPinsESP32 / supply
U2 SIM800LTXD / RXDRX2 (GPIO16) / TX2 (GPIO17)
U2 SIM800LRST / RINGD4 / D5
U2 SIM800LVCC / GNDa +4V supply / GND
RLY1 relay moduleIN1 / IN2D26 / 5 V (channel 2 unused, off)
RLY1 relay moduleVCC / JD-VCCthe board's VIN (5 V)
RLY1 contactsCOM1 / NO1+12V / the pump's +
U3 soil sensorAOUT / VCCD34 / 5 V
U4 water sensorS / VCCD35 / +3.3V

The SIM800L uses the ESP32's second hardware serial port, Serial2, on GPIO16 and GPIO17, so the first port stays free for the serial monitor. The module needs 3.4 to 4.4 V, more than the ESP32's 3.3 V and less than 5 V, so it has its own +4V supply. The relay module's inputs are active LOW: D26 at 0 V switches relay K1 on, and K1's normally-open contact connects the +12V supply to the pump. The second channel's input sits on 5 V, so K2 stays off. The capacitive soil sensor runs on 5 V and gives about 2.5 V in dry air and less as the soil gets wetter; the water sensor runs on 3.3 V and gives 0 V when no water touches its traces, so its output never goes over what the ESP32's analog pins can read. The RING pin goes LOW on an incoming call or SMS; the sketch reads the caller from the module's messages instead, and RING is wired for waking a sleeping ESP32 later.

How the SMS Pump Controller Works

Talking to the SIM800L with AT Commands

A GSM module is controlled with AT commands: short text lines that start with AT and end with a carriage return, answered with OK or ERROR. The SIM800L learns the baud rate from the first AT it receives, so the sketch sends AT a few times at 9600 baud until the module answers. Then four settings: ATE0 stops the module from echoing every command back; AT+CMGF=1 selects text mode, so an SMS is plain text instead of a hex PDU; AT+CNMI=2,2,0,0,0 tells the module to send a new SMS straight to the serial port instead of only storing it on the SIM; and AT+CLIP=1 turns on caller ID, so an incoming call reports the caller's number. Finally, AT+CSQ asks for the signal quality.

How an SMS Arrives

With those settings, every new SMS appears on the serial line as two lines. The first is a header, +CMT: followed by the sender's number in quotes and the time stamp; the second is the text itself. The sketch reads the module's output character by character into a line buffer, and when a line starts with +CMT: it copies the number and remembers that the next line is the message. An incoming call shows up as RING lines and, thanks to AT+CLIP=1, a +CLIP: line with the caller's number.

How an SMS Is Sent

Sending takes three steps. The sketch sends AT+CMGS= with the phone number in quotes; the module answers with a prompt, a greater-than sign and a space, and waits for the text; the sketch sends the text and ends it with Ctrl+Z, the byte 26. The module then sends the SMS through the network and answers +CMGS: with a reference number, followed by OK. There is one trap here: the prompt has no line end. A program that reads whole lines would wait for the prompt forever, and the module would then take every following command as part of the message. So the sketch watches each character for the prompt, and if it never comes it sends ESC, the byte 27, which cancels the message.

A Missed Call as a Free Remote Control

A call that is never answered is never charged. When the owner calls, the sketch sees the +CLIP: line, sends ATH to hang up at once, toggles the pump and sends a short SMS with the new state, so the caller knows the call worked. The caller hears the line go busy. Many farmers prefer this to typing: one call starts the pump, the next one stops it.

Signal Quality: CSQ to dBm

AT+CSQ answers with a number from 0 to 31 (99 means unknown). Each step is 2 dB, starting at -113 dBm, so the signal in dBm is -113 + 2 x CSQ. For example, CSQ 22 is -113 + 44 = -69 dBm, a good signal. The sketch turns it into bars for the replies: 20 or more is 4/4, 15 to 19 is 3/4, 10 to 14 is 2/4 and below that 1/4. Under about CSQ 10 (-93 dBm) an SMS may need several tries.

Reading the Soil: a Two-Point Calibration

A capacitive soil sensor measures how much water is around its probe: wet soil raises the probe's capacitance and lowers the output voltage. The output is not a percentage by itself, so it is calibrated with two readings: the probe in dry air (2.54 V here) is 0 %, and the probe in water (1.27 V) is 100 %. Anything between is a straight line: soil % = (2.54 - V) / (2.54 - 1.27) x 100. Worked example: at 1.854 V, (2.54 - 1.854) / 1.27 x 100 = 0.686 / 1.27 x 100 = 54 %. The sketch averages 8 readings each second with analogReadMilliVolts(), which uses the ESP32's factory calibration of its converter.

Watering in AUTO: Two Thresholds

If the pump started and stopped at the same level, it would switch on and off every second as the reading wobbled around that level, which wears out the relay and the pump. So AUTO uses two levels, a hysteresis: the pump starts when the soil is under 30 % and keeps running until the soil reaches 45 %. Between the two, nothing changes.

Protecting the Pump from Running Dry

A pump that runs without water overheats and wears out its seals in minutes. The water sensor hangs near the bottom of the tank: while water covers its traces the output is well over 0.6 V, and when the water drops below them it falls towards 0 V. When the reading goes under 0.6 V, the sketch stops the pump at once, refuses to start it again, and sends the owner an ALERT. When the water comes back, the pump does not restart by itself: the owner decides. A run also stops after 60 seconds, which keeps the simulation short; in a real field this limit would be 20 or 30 minutes.

Short Replies

A standard SMS holds 160 characters, but many phones show only the first line or two in a notification. So every reply in this sketch fits in 60 characters, and percent is written as a word, which every phone shows the same.

The Arduino Code Explained

The sketch is ESP32_GSM_Pump.ino. It needs no extra library: the SIM800L is driven with AT commands on Serial2, and WiFi and WebServer are part of the ESP32 core. The settings are at the top: the owner's number, the relay's active level and the AUTO thresholds:

const char *OWNER = "+15555550191";                                 // the only number allowed to command the pump (the test phone's)
const int RELAY_ON = LOW, RELAY_OFF = HIGH;                          // the relay module's inputs are active LOW
const int SOIL_DRY = 30, SOIL_WET = 45;                             // AUTO: on under 30 %, off at 45 %

The SIM800L is on the second UART, at 9600 baud, on GPIO16 and GPIO17:

  Serial2.begin(9600, SERIAL_8N1, 16, 17);

The module is set up with four commands: no echo, text mode, new SMS straight to the serial port, and caller ID:

  bool ok = command("ATE0") && command("AT+CMGF=1") && command("AT+CNMI=2,2,0,0,0") && command("AT+CLIP=1");

The signal quality becomes bars:

signalBars = rssi == 99 ? 0 : rssi >= 20 ? 4 : rssi >= 15 ? 3 : rssi >= 10 ? 2 : 1;

Sending an SMS starts with AT+CMGS and the number in quotes:

  Serial2.print(F("AT+CMGS=\"")); Serial2.print(to); Serial2.println('"');

The prompt is caught character by character, because it has no line end:

      if (prompt && c == '>') return true;

Then the text, and Ctrl+Z to send it:

  Serial2.print(text); Serial2.write(26);                           // Ctrl+Z sends the message

An SMS from any other number is ignored:

  if (strcmp(from, OWNER)) { logEvent("SMS from " + String(from) + " ignored (not the owner): " + text); return; }

The text is made upper case and padded with spaces, so the commands are found as whole words anywhere in the message:

  String words = " " + text + " ";                                  // (whole words: PUMP ON, ON and LED ON all mean ON)
  if (words.indexOf(" STATUS ") >= 0) sendSms(from, status() + " Signal " + String(signalBars) + "/4");

A call is hung up first, then it toggles the pump:

  command("ATH");                                                   // hang up: a missed call costs nothing

The soil reading uses the two-point calibration, rounded and kept between 0 and 100 %:

  soil = constrain((int)((AIR_V - v) / (AIR_V - WATER_V) * 100 + 0.5), 0, 100);

AUTO uses the two thresholds, and only with water in the tank:

      if (!pumpOn && soil < SOIL_DRY && tankOk) pump(true, "AUTO: the soil at " + String(soil) + " %");
      else if (pumpOn && soil >= SOIL_WET) pump(false, "AUTO: the soil at " + String(soil) + " %");

The tank going low stops a running pump and texts the owner:

        if (pumpOn) { pump(false, "tank low"); sendSms(OWNER, "ALERT: tank low, pump stopped. Soil " + String(soil) + " percent."); }

Every start goes through one function, which refuses to start the pump on a low tank:

  if (on && !tankOk) { logEvent("pump NOT started (" + reason + "): the tank is low"); return; }

And a run that lasts too long is stopped:

    if (pumpOn && millis() - pumpSince >= RUN_MAX_MS) { pump(false, "the 60 s limit"); sendSms(OWNER, "60 s limit reached. " + status()); }

Every 30 seconds the sketch asks AT+CMGF? to check that the module is still in text mode; a module that restarted after a power dip forgets its settings, and the sketch sets it up again. The dashboard's pages are / (the dashboard), /auto and /manual (the mode) and /data (everything as JSON). Every SMS, call and pump change is printed on the serial monitor with the time.

How to Run the Proteus Simulation

  1. Download the project zip below and install the library files (the steps are under the download button).
  2. Open ESP32-GSM-Solar-Pump.pdsprj from the Proteus Simulation folder. Keep ESP32_GSM_Pump.hex and the DLL files next to it.
  3. Press Play. The SIM800L registers on the network (its pop-up shows REGISTERED - TEP MOBILE) and the ESP32 sets it up.
  4. On the SIM800L's virtual phone, tap LED ON: it arrives as an SMS containing ON, the pump runs and the reply appears as a chat bubble. Try STATUS, LED OFF, HELLO, and CALL for a missed call.
  5. On the water sensor's pop-up (U4), press Empty: the pump stops and the ALERT arrives; 20 puts 20 mm of water back.
  6. Open the Laptop or the Mobile WiFi Monitor, press AUTO, then on the soil sensor's pop-up (U3) press DRY and WET.

Simulation Results: the SMS Pump in Proteus

Here is the run that made the screenshots of this tutorial, 77 seconds of simulation: an SMS turns the pump on, a status report, the tank empties, a missed call, an SMS turns it off, AUTO watering on dry and wet soil, and an unknown message. The times are the sketch's own clock, as it printed them on the serial monitor; the parts' numbers come from their pop-ups.

The SIM800L Ready

At 3.1 s the sketch prints "SIM800L ready, signal 4/4 - waiting for SMS from +15555550191". The SIM800L's pop-up shows the module registered on its home network, TEP MOBILE, after a 2.88-second network search, with CSQ 22, which is -69 dBm, a good signal; six AT commands so far, no ERROR. The virtual phone below it, +15555550191, is the owner's. The laptop opens the dashboard: the pump OFF, the soil at 53 %, the tank sensor at 1.68 V, so there is water in the tank.

The ESP32 SMS solar pump Proteus simulation ready: the SIM800L registered, the pump off
Figure: Ready: the SIM800L registered.
SIM800L pop-up in the Proteus simulation: REGISTERED on TEP MOBILE, CSQ 22 (-69 dBm), no messages yet
Figure: The SIM800L: registered.
Laptop WiFi Monitor in the Proteus simulation: the GSM pump dashboard, the pump off, the soil at 53 %
Figure: The dashboard at the start.

ON by SMS

Tapping LED ON on the virtual phone sends an SMS with that text. At 13.2 s the sketch reads "SMS from the owner: LED ON"; the word ON is in it, so the pump starts. Relay K1 closes: its pop-up shows the coil at 68.9 mA and 821 mA through the closed NO contact. The pump's pop-up shows it pumping 556 litres an hour up 2 metres, at 12.0 V and 0.82 A (9.8 W), the motor at 4110 rpm. At 15.3 s the reply goes out: "OK. Pump ON, soil 54 percent, tank OK.", and appears on the phone as a green bubble. The SIM800L's pop-up shows how long the send took: AT+CMGS was answered with +CMGS: 1 and OK after 2024 ms.

The ESP32 SMS solar pump Proteus simulation: ON by SMS, relay K1 on and the solar pump running
Figure: The pump on by SMS.
SIM800L pop-up in the Proteus simulation: the LED ON SMS from the phone and the reply OK. Pump ON
Figure: The SMS and its reply.
Relay module pop-up in the Proteus simulation: K1 ON, IN1 LOW, the coil at 68.9 mA, 821 mA through NO
Figure: The relay: K1 on.
Solar water pump pop-up in the Proteus simulation: 556 L/h up 2 m at 12.0 V and 0.82 A
Figure: The pump: 556 L/h.

A Status Report

STATUS at 22.8 s; at 24.9 s the reply "Pump ON, soil 54 percent, tank OK. Signal 4/4". The traffic counter on the pop-up now shows 2 SMS sent and 2 received.

SIM800L pop-up in the Proteus simulation: the STATUS SMS and the reply with the pump, the soil, the tank and the signal
Figure: The STATUS reply.

The Tank Runs Low

Pressing Empty on the water sensor's pop-up drains the tank at 27.2 s: the water level 0.0 mm, the sensor's output 0 V. At 28.9 s the sketch reads 0.44 V, under its 0.6 V line: "the tank is LOW (0.44 V)", the pump OFF, and at 31.0 s the alert goes out: "ALERT: tank low, pump stopped. Soil 54 percent." With 20 mm of water back, at 38.1 s: "water in the tank again (1.18 V)", the reading rising towards 1.68 V. The pump stays off, as it should: the owner decides when to start it again.

The ESP32 SMS solar pump Proteus simulation: the tank low, the relay off and the pump stopped
Figure: The tank low: the pump stopped.
Water sensor pop-up in the Proteus simulation: the tank Empty, the water level 0.0 mm, the output 0 V
Figure: The water sensor: empty.
SIM800L pop-up in the Proteus simulation: the ALERT SMS, tank low, pump stopped
Figure: The ALERT SMS.

A Missed Call

CALL on the virtual phone calls the module. The sketch sees the caller, hangs up and toggles the pump: at 41.8 s "pump ON - missed call". The phone shows the call rejected, busy, so nothing was charged, and at 43.9 s the reply arrives: "Your call: Pump ON, soil 54 percent, tank OK." At 50.1 s LED OFF stops the pump, and at 52.2 s the reply "OK. Pump OFF, soil 54 percent, tank OK."

The ESP32 SMS solar pump Proteus simulation: a missed call from the owner turns the pump on
Figure: A missed call: the pump on.
SIM800L pop-up in the Proteus simulation: the call rejected (busy) and the reply Your call: Pump ON
Figure: The call and its reply.

AUTO Watering

At 54.0 s the AUTO link on the laptop switches the mode: "AUTO mode (the dashboard)", and the dashboard shows Pump OFF AUTO with the soil at 54 %, well above 30 %, so the pump stays off. DRY on the soil sensor's pop-up dries the soil to 5 % water by volume, and its output rises to 2.296 V. At 56.2 s the first reading under 30 %: "pump ON - AUTO: the soil at 22 %". WET soaks the soil to 35 % water by volume, the output falls to 1.679 V, and at 62.2 s the first reading over 45 %: "pump OFF - AUTO: the soil at 63 %". The reading then settles at 68 %, as the calibration predicts: (2.54 - 1.679) / 1.27 x 100 = 68 %.

Laptop dashboard in the Proteus simulation: AUTO mode on, the pump off, the soil at 54 %
Figure: The dashboard: AUTO on.
The ESP32 SMS solar pump Proteus simulation in AUTO: the soil dry, the pump running
Figure: AUTO: dry soil, the pump on.
Capacitive soil moisture pop-up in the Proteus simulation: the DRY preset, 5 % water, the output 2.296 V
Figure: The soil sensor: dry.
The ESP32 SMS solar pump Proteus simulation in AUTO: the soil wet, the pump stopped
Figure: AUTO: wet soil, the pump off.
Capacitive soil moisture pop-up in the Proteus simulation: the WET preset, 35 % water, the output 1.679 V
Figure: The soil sensor: wet.

An Unknown Message, and the Dashboards

HELLO at 69.0 s has none of the command words, so at 71.1 s the sketch answers with the list: "Send ON, OFF, AUTO or STATUS. A missed call: ON/OFF". By the end, the SIM800L's pop-up counts 6 SMS sent and 4 received, one call, and 15 AT commands with no ERROR. The phone and the laptop show the last SMS in and out and the latest events.

SIM800L pop-up in the Proteus simulation: the HELLO SMS and the help reply with the commands
Figure: The help reply.
Mobile WiFi Monitor in the Proteus simulation: the GSM pump dashboard, AUTO, the last SMS in and out
Figure: The phone dashboard.
Laptop dashboard in the Proteus simulation: the pump off in AUTO, the soil at 68 %, the last SMS in and out
Figure: The laptop dashboard at the end.
ESP32 serial monitor in the Proteus simulation: every SMS, the call, the tank alert and the AUTO watering
Figure: The serial monitor: the whole run.
The results of the SMS solar pump simulation
WhatResult
StartSIM800L registered, CSQ 22 (-69 dBm), 4/4 at 3.1 s
ON by SMSthe pump on at 13.2 s, 556 L/h up 2 m; the reply 2.1 s later
STATUSthe reply with the pump, the soil, the tank and the signal
Tank emptythe pump stopped at 28.9 s (0.44 V), the ALERT at 31.0 s; no restart by itself
Missed callthe call hung up, the pump on at 41.8 s, the reply at 43.9 s
AUTOon at 22 % (dry), off at 63 % (wet)
Unknown SMSthe list of commands
Traffic6 SMS out, 4 in, 1 call; 15 AT commands, no ERROR
Simulation77 s of simulation

Download the Project Files

Click the button below to download SMS-Solar-Pump-Controller-ESP32-SIM800L-Proteus-Simulation-v1.0.zip (about 4.6 MB, without the source code of the models):

SMS Solar Pump Controller with ESP32 and SIM800L: Proteus Simulation V1.0
  • Proteus Simulation: ESP32-GSM-Solar-Pump.pdsprj, ESP32_GSM_Pump.hex and copies of the models.
  • Arduino Code: ESP32_GSM_Pump.ino, the sketch.
  • Proteus Library Files: the LIB files of the ESP32 DevKit V1, the SIM800L, the relay module, the solar water pump, the soil sensor, the water sensor and the two WiFi Monitors.
  • Proteus Model Files: the DLL models.
  • README.txt: the installation steps, the properties, the test results and the links to every library post.

No Proteus yet? Read How to Download and Install Proteus 7 and 8. New to libraries? Follow How to Install a New Library in Proteus.

How to Install the Project Files

  1. Close Proteus and extract the whole zip file, for example to your Desktop.
  2. Copy the files from Proteus Library Files into the LIBRARY folder of Proteus.
  3. Copy the files from Proteus Model Files into the MODELS folder.
  4. Start Proteus and open the project from the Proteus Simulation folder.

Changing the Code

Open ESP32_GSM_Pump.ino in the Arduino IDE with our TEP Boards for Proteus, choose ESP32 Dev Module (TEP Proteus), and export the compiled binary; U1's PROGRAM property names the .hex file it runs. Put your own phone number in OWNER, in the international format with the plus sign, and your sensor's readings in air and in water in AIR_V and WATER_V. On a real ESP32 the same sketch runs with the standard ESP32 board package; it needs no library from the Library Manager.

Ideas to Extend the Project

  • Add a PIN word to every command, so a spoofed caller ID cannot start the pump, and allow several owner numbers.
  • Send a daily report at sunrise, with the time from the network (AT+CCLK?).
  • Wake the ESP32 from deep sleep on the RING pin, so the controller can run from a small battery charged by the solar panel.
  • Reset the module through its RST pin if it stops answering AT.
  • Count the run time and the water pumped: the pump's pop-up shows its flow at the head of your field.
  • Add the solar battery's voltage to STATUS, and skip AUTO watering when it is low or when a rain sensor is wet.

From Simulation to Real Hardware

  • Check the network: the SIM800L works only on 2G (GSM) networks, which have been switched off in many countries. If yours has, use a 4G module such as the SIM7600 or the A7670, which take the same SMS AT commands.
  • Power the module properly: the SIM800L draws bursts of up to 2 A while it transmits. Feed it 4.0 V from a Li-ion cell or a buck converter, with a 470 to 1000 uF capacitor next to it; the ESP32's 3.3 V pin cannot supply it, and 5 V damages it.
  • Mind the logic levels: the SIM800L's serial pins work at 2.8 V; a simple resistor divider on the ESP32's TX2 line keeps them safe.
  • Size the relay: the relay's contacts must carry the pump's current with room to spare, and a diode or snubber across the motor protects them from sparks.
  • Calibrate the soil sensor in your own soil: read the voltage in air and in water, and put both in the sketch.
  • Prefer a float switch for the tank: a conductive water sensor corrodes if it is powered all the time; power it only while reading, or use a float switch.

Troubleshooting

  • NO SIM800L on the serial monitor: TXD must go to RX2 (GPIO16) and RXD come from TX2 (GPIO17), and the module needs 3.7 to 4.2 V.
  • Commands are ignored: they must come from the OWNER number; the serial monitor prints ignored (not the owner) for any other.
  • No reply SMS: the module must be registered; after AT+CMGS the sketch waits for the prompt, and FAILED: no prompt means the module refused the message.
  • The pump never runs: the tank sensor must be in water (over 0.6 V on D35), and the relay's IN1 on D26, where LOW means on.
  • The relay clicks but the pump stays still: +12V must reach COM1 and the pump's negative terminal GND.

Limitations of the Simulation

  • The GSM network and the owner's phone are simulated by the SIM800L model; its virtual phone sends four ready-made messages (LED ON, LED OFF, STATUS and HELLO) and a call.
  • Sending an SMS takes the model about 2 seconds; on a real network it takes from 2 seconds to a minute.
  • The tank, the soil and the water lifted by the pump are the models' own; the run limit is 60 seconds to keep the simulation short.
  • The network to the laptop and the phone is simulated inside Proteus.
  • The ESP32 is a product of Espressif Systems and the SIM800L a module of SIMCom; this project is not made or endorsed by them or by Labcenter.

So, that was all about the SMS Solar Pump Controller with ESP32 and SIM800L in Proteus Simulation. I hope it helps you understand how a GSM module receives and sends SMS with AT commands, why a missed call is a free remote control, how a soil sensor is calibrated, and how a controller protects a pump from running dry, all tested in a simulation before you build a real one. More IoT projects with the ESP32 and the Raspberry Pi 5 are coming in this series. If you have any questions, ask in the comments and I will help you out. Till the next tutorial, take care and have fun!


Comments

0

Join the conversation