Loading 3D model… large boards can take a moment.
This project is V4 in the levelmeting waterput project. It uses the QDY30A level sensor with RS485 protocol because all the previous sensors broke.
This project uses the ModbusMaster library which can be installed from the Library Manager in the Arduino IDE.
Thanks lejmr for this diagram. I used it to test my sensor. It is wrong for the TX and RX pins, they should be swapped. (See below for more.) The rest is the same as in this diagram.
My adaptation: I used pin 2 on the ESP32 to connect the DE and RE pins from the MAX485 module.
See the final KiCad diagram under the waterputv4Schematics folder. Here is a screenshot in case you don't have KiCad.
This took a lot of trial and error but I got it working in the end. Some important remarks:
testcode.credentials.h file in the same folder as the final code. You need to fill this template with your own credentials.#define mySSID "xxxxx"
#define myPASSWORD "xxxxx"
#define myChannelNumber 111111
#define myWriteAPIKey "xxxxxx"
After connecting to your ESP32 using PuTTY (see IP address in Serial Monitor), you can use the following commands in the telnet console:
ping
The ESP32 will respond with pong, show the current sensor height, and display the time remaining until the next automatic data upload to ThingSpeak.
send data
Immediately triggers a sensor reading and uploads the value to ThingSpeak, regardless of the regular upload interval.
Example session:
> ping
pong
Doing a height reading...
Data at adress 4: 158
Converted height: 15.8cm
15.80
Time to next data send: 122 seconds
> send data
Sending data now...
Data at adress 4: 158
Converted height: 15.8cm
Height: 15.8cm
Uploading data to ThingSpeak...
Successful upload to ThingSpeak.
Height: 15.80 uploaded to ThingSpeak server.
If you enter an unknown command, nothing will happen. Commands are case-sensitive.
Tip:
Make sure you have connected to the correct IP address and that your ESP32 is powered and connected to WiFi.
reconnect wifi command.
No comments yet. Be the first to ask about this board.