Hello, I am doing Smart Watering System as my Final Exam, everything works as I want it, but not the sensors. I have a long program (~500 lines, I can share it later today, but right now I don’t have access to it) but for some reason, the Arduino doesn’t read values from 5 sensors, 4 are Soil Moisture (SM) and 1 is Water Level (WL). SM’s are connected to converters that come with them, and they are connected to Analog pins A0-A3. WL is also connected to the sane converter, but run through Digital pin, as I am using I2C LCD (A4 and A5 are connected with SDA and SCL pins), but that’s how I want it, as the WL is used only in to detect if there is, or is not, any water in a tank. The wiring is correct and the sensors work fine, because when I run a program that only outputs the values of sensors on LCD, everything works as intended. Did anyone experience this issue? I am using the analogRead() and digitalRead() only like 7 times in the loop() function (4x for buttons to move in menu, and 3x at a time for the sensors (only 2 SM’s are displayed at once, plus the WL needs to be read always as it switches between 2 valves, depending if there is a water in the tank or not) and I also read the code like 10+ times yesterday, but found nothing.
I don’t have a schematic right now, and I don’t have time for it as I have to show a working project next week, the schematic and other documents will be done later. It is wired correctly, as I tried the same wiring but with other ports and components off, only the sensors were turned on and displaying their values which went correctly. Basically I am using 12V 6A DC PSU to power Arduino and other 12V components, then it is run through voltage step-down to 5V on a breadboard (it is also connected to Arduino GND just in case), from which I run 5V components. Board is UNO R3. I can post the code later today, but wanted to make this thread now as someone might have had similar issue and will be able to tell right away. Also, I tested the WL converter output for Voltage in the circuit while everything was running, and it did output correct values (~3V when dry, and ~0,4V when wet), but the Arduino just wont read it… Same for SM’s, but with Analog values…
You not having a schematic is not as much a problem in getting help, it's as much a problem for YOU understanding your own circuit and knowing whether it's all wired correctly, and being able to easily check what is supposed to be wired where.
Then the best you can do now is write a simple test script that just reads those sensors and prints the data to the serial monitor. See whether that works. If that works, there's likely a problem in your main project code. If that doesn't work, there's likely a problem in your wiring.
It needs just a ten minutes to draw diagram by hand on piece of paper and put the photo in the forum...
If you don't have a time for it, I don;t think the discussion on the forum will be productive....
If you only need the schematic part of the arduino, psu, and sensors, yes, I can do that. But if you want every component in the circuit, there’s a lot to draw…
Then the problem is almost certainly in your code.
Start by stripping it down, until you get to the minimum code that still experiences the problem. If by then you still haven't found the issue, post that minimum code on the forum.