My battery-powered project is not working

Hello everyone,

This is my first project with an Arduino. It is a pretty straight forward plant watering project.
The project is simple in theory and i can get it working using my USB cable without any issue.
My problem is when i power the circuit with a battery the relays dont open accordantly to the measurements.
I troubleshoot the best i can the problem but i can't see what is my mistake:
I try to double check:

  • Voltage output of the battery ( 12V confirmed)
  • Voltage on the breadboard (3.27V confirmed)
  • Both ground seems to work ( i measure 3.27V between power and ground)
  • I try to use my USB cable plugged to my battery and it doesn't work either
  • I try to plug my power adapter directly on my wall socket don't work

I'm using a Arduino Uno R3 with IDE V2.1.1.
My Battery is a RockSolar RS81: Link Battery Spec
I use an adjustable power adapter: Link adapter spec set on 12V... (i tried 9V setting too)
Here the schematic:

Here a picture of my setup (sorry it's a mess, i will take some time for cable management)

Here is my code:



int readPin0 = A0;
int readPin1 = A1;
int readPin2 = A2;
int A_0 = 0;
int A_1 = 0;
int A_2 = 0;
int dig0 = 4;
int dig1 = 3;
int dig2 = 2;

void setup() {
 pinMode(dig0, OUTPUT);
 pinMode(dig1, OUTPUT);
 pinMode(dig2, OUTPUT);

 pinMode(readPin0, INPUT);
 pinMode(readPin1, INPUT);
 pinMode(readPin2, INPUT);


 Serial.begin(9600);
}

void loop() {
 A_0 = analogRead(A0);
 A_1 = analogRead(A1);
 A_2 = analogRead(A2);

 if (A_0 > 575) {
   digitalWrite(dig0, LOW);
   delay(5000);
   digitalWrite(dig0, HIGH);
   delay(15000);
 } else {
   digitalWrite(dig0, HIGH);
   }


   if (A_1 > 575) {
     digitalWrite(dig1, LOW);
     delay(5000);
     digitalWrite(dig1, HIGH);
     delay(15000);
   } else {
     digitalWrite(dig1, HIGH);
     }


     if (A_2 > 575) {
       digitalWrite(dig2, LOW);
       delay(5000);
       digitalWrite(dig2, HIGH);
       delay(15000);    
     } else {
       digitalWrite(dig2, HIGH);
       }

 



 //Graph

 Serial.print(300);
 Serial.print(",");
 Serial.print(A_0);
 Serial.print(",");
 Serial.print(A_1);
 Serial.print(",");
 Serial.print(A_2);
 Serial.print(",");
 Serial.println(800);
 Serial.print(",");
 delay(100);
 //Serial.println(A_2);

}

I really have no idea what's going on.
I've really try checking the forum and elsewhere for other issues similar to mine, but I can't find my mistake and thought you might be able to help me.
Again I am really sorry if my mistake is very obvious. This is my first project with the hardawar and language.

Thanks for the code and images. A proper schematic is required to confidently assess this circuit, vs. a Fritzing diagram. You suspect the battery supply, but you didn't show any diagram or image of how the battery is connected. In one image that shows it, the wire disappears under a mat.

Voltage on the breadboard (3.27V confirmed)

That is very sus. The UNO runs on 5.0V. Why are you trying to use the 3.3V output?

What are the strange white tubular things between the relays and plants? Water pumps? If so, how can you have connected them and also soil sensors on the same two wires? What do the red arrows mean? Or, are the soil sensors wireless? Wait, I see 4 of them on the side. So what are the four devices in the plant pots?

The battery pack has 5V USB ports. Why are you not using one, instead of 12V?

It is a pretty straight forward plant watering project.

For a first project, I tend to disagree. My first project was connecting an external LED and flashing it. :slight_smile:

Did you read the UNO specs?
"DC Current for 3.3V Pin 50 mA"
https://store-usa.arduino.cc/products/arduino-uno-rev3?selectedStore=us
How does that compare with the current consumption specs of the devices you attached to it?

1 Like

Ya that's correct

Also there is no battery to be seen in the images provided also nothing is been displayed on multimeter

1 Like

It's a battery powered portable power source, that was also linked to. Second image, lower right.

Hello aarg,
Thank you for your reply,
Here more photo regarding the power connection:



As for the other questions,
That is very sus. The UNO runs on 5.0V. Why are you trying to use the 3.3V output?
Yes, according to the schematic I have to use 3.3V. I can try the 5V output if you suggest. I mean everything seems to work perfectly when the USB cable is used. When I try the AC adapter on the wall outlet or on the battery, it doesn't work even though I measure the correct voltage with a multimeter

What are the strange white tubular things between the relays and plants? Water pumps?
*Yes the white thing is a pump, it is connectect to the relay (red) and the other wire (black) to the ground

Unfortunately I was limited in my choice of colors in this project so I know it's confusing, maybe this image will help: I.E.: P2 is the pump linked to S2 the sensor.
In total I have 3 sensors and 3 pumps.

*P0 and S0 will feed 1 plant
*P1 and S1 will feed 1 plant
*P2 and S2 will feed 1 plant

At this moment, I only have one plant to calibrate the if function, that's why you see a bunch of sensors there and a cup full of water to test the sensibility of the sensors. *


Hello aarg,
Again this is strange for me because it work with the usb cable.
I will measure the Amp and I will let you know.

Thanks for the additional images. Your power supply chain goes through far too many transformations.

Lion cells -> 120V
120V -> 12V
12V -> 5V
5V -> 3.3V

Waaay too many!!

You commented very ephemerally on the 3.3V power. You can surely keep trying stuff but it's usually mandatory to at least understand a little bit about why things work and what the exact limitations are.

"It works", is not sufficient. Because, a marginal system will work today and not tomorrow.

Please consider my advice, and begin to look at the actual current specs.

At the moment, I would bet the farm on the on board regulator(s) being red hot from the overload. Maybe not yet with one pump, but with four relays and pumps drawing power, it will probably just crash.

2 Likes

Will do, I will keep you inform.
Thank you for you input aarg

Technically, it's not a good idea to power relay coils from the 5V either. You should power the system from the USB output of the power pack, and power the relays separately from a second USB power output on the same pack.

I can't guarantee that, but it's the best suggestion I can think of for using that pack.

1 Like

Hi,
Your relay board is 5V.
Your soil sensors will work at 5V.

I suggest you use 5V.

3V3 output is not capable of supplying current to control all those relays.

USB 5V can supply sufficient to keep the 5V supplied.
The DC input uses a linear regulator to supply the 5V, the regulator may be overloaded when the relays operate.

I suggest you switch your plug pack to 5V and supply the 5V pin of the Arduino and 5V of the sensors and relays from it as well.
That way you are not relying on the internal regulator to supply all the load current.

Use your DMM to make sure your plug pack is outputting 5V before connecting.

Tom.. :smiley: :+1: :coffee: :australia:

You will also need to look at your connection layout to prevent your power circuit - relays pumps etc - from affecting your control circuit (Arduino and sensors).

Try connecting a USB cable between your UNO and one of the Rocksolar USB ports.

Hello @anon57585045 and @TomGeorge ,
I think you are both right.
I tried to increase my circuit to 5V instead of 3.3V and it work on the battery.
I can now see the LED light on the relays to be very bright, which was not the case before (slightly dimmed).

What i did:

  • Switch the adapter to 12V (contrary to what @TomGeorge suggested)
  • Switch the power output of the Arduino from pin 3.3V to pin 5V
  • Plug the adapter to battery
  • Plug the adapter to the Arduino's 12V power socket

What happen:

  • Now it does not work with USB cable connected to PC
    • When you plug in the USB cable you can hear and see from the LEDs that all the relays close twice in a split second then stay open for 1 or 2 seconds and this sequence repeats itself.
    • After a minute or so running in this state, it seems to run the program but at a very fast paste (I.E. the sensors are responding to changes but the Delay function are very quick)
    • This fast paste program execution state doesn't always happen, maybe once or twice after 5 hard resets.
  • When i connect the battery, everything work perfectly.

For now it's an easy switch between 5V and 3.3V and I can move forward with my project with that knowledge, but I'll investigate further to find out exactly what's going on and keep the community updated if something similar happens to anyone else.

From what I know in electronics, I need to rewire the circuit to be able to measure the current because it has to be in series. A colleague of mine was looking to buy an amp clamp specifically designed for 24V and lower. I think I could use it to get more information.
I will keep you in touch.

Thank you.

Yes, I tried and it didn't work.

Put the whole thing aside temporarily. Start from scratch with one plant, one pump, and mains power not battery. Make sure that everything works. Now start adding or changing one thing at a time and don't move forward with anything that doesn't work 100%.

You've simply bitten off more than you can chew.

Forget about amp clamps and stuff like that, it's not likely to provide answers without a deeper understanding of how things work.

Hello @johnerrington ,
Thank you for this input,

I'm sorry, my electronic knowledge is more than basic and i can't fully understand this diagram.

Here what i think i understand from it:

  • My load is my pumps
  • My ADC is my A0 to A5 pins
  • My PSU in my output voltage from either 3.3 or 5 V pin.
  • The top diagram is pretty much what i did in my circuit

Here what i don't understand

  • Pretty much everything in the bottom diagram
  • What is a Star point and what it look like in reality?

Can you explain me what i should see if this is a problem? Interference in sensor? Power disturbance? etc....

Thank you for your reply.

Hmmm. What was different?

my electronic knowledge is more than basic

Then failure shouldn't come as a surprise given the complexity of the project. Start with something at or slightly above your skill level, absorb that and build something. Rinse and repeat.

What is a Star point and what it look like in reality?

Questions like this, you should just research. This isn't chastisement, it's what I do myself to get answers.

It's what I did when I was a beginner. Mostly, I had nobody to advise me, and there was no internet to go to. Now there is. You can research almost any subject just by typing into Google.

If you want really high quality, insightful help here you have to step up and provide high quality documentation because that is what it takes to understand complex technical issues and bugs.

After 18 posts, we still haven't seen any complete, accurate wiring diagram. The forum posting guidelines suggest that it is almost mandatory in cases like yours.

Hello @anon57585045
Yes i agree with you this is the proper way to troubleshoot the problem and I will do it simply because I don't understand the problem fully as i want to.

For the current time, i want to go forward in the project and try to grow some fruit because the crop season is very short in Canada and i want to learn how my water input affect the crops. (one of my main objective)

Here is my plan:

  • I have a second Arduino UNO that I think has fried out due to a wrongfully socketed microcontroller and I want to try to fix it. (I want to learn how to repair boards and next personal project)
  • Once fixed, if I can, I want to redo the same circuit and try the same with my spare pump, single relay and sensor. It won't be the same because the relay board won't be exactly the same but the specs are the same.
  • If that doesn't work, I'll probably be on hold to run my project over the summer.
  • After the summer is over, I will try to investigate the problem thoroughly.
  • In the meantime, I want to know if current might be the source, so I'll investigate that way with my current setup.

I will keep this post updated for further uses.

@anon57585045
sorry aarg.

Then failure shouldn't come as a surprise given the complexity of the project. Start with something at or slightly above your skill level, absorb that and build something. Rinse and repeat.

Well failure was the main subject of this personal project. I never ask for help in this project except for this problem. I think you can grow/learn faster if you have a goal that goes beyond your usual skills/knowledge:

  • I learned how to connect pins on an Arduino and have a general idea of ​​what does what
  • I learned how amazing tinned copper wire is compared to plain copper wire in this kind of project!
  • I learned how to properly use my multimeter which I usually only use to see if there is voltage in my wall outlet
  • I learned what is the difference between a digital output/input and an analog output/input. (I already knew the concept but never experienced it.)
  • I learned to make a simple program with IDE what I never did in my life nor to program in general except at the university under Python→ Anaconda for my degree in Chemical Engineering.
  • I learned how a breadboard works even though I'm only using it as a busbar in this project.
  • I learned how the COM port works and why it can fail
  • I learned how to solder a circuit
  • I learned why cable management is essential in any project
  • I learned how power transforms
  • I learned how it really works
  • I learned that silicon is not the best way to ("potter") a circuit. I found epoxy to be better
  • etc...

Questions like this, you should just research. This isn't chastisement, it's what I do myself to get answers.
It's what I did when I was a beginner. Mostly, I had nobody to advise me, and there was no internet to go to. Now there is. You can research almost any subject just by typing into Google.

Be sure I've searched the internet as well as possible to find the problem before posting. Keep in mind my knowledge before this project was positive is red and negative is black and there is a difference between AC and DC. I knew what capacitance, resistivity/impedance, coil, etc.

I'm sure by testing i could have found the issue but i was asking because i was not sure if i made a mistake in my code or maybe someone did the same basic mistake. My goal is not to bypass knowledge opportunities, at the contrary. Please take into account that my main goal is to learn. This personal project is not for money, fame or gratitude, it is only a project to learn something.

If you want really high quality, insightful help here you have to step up and provide high quality documentation because that is what it takes to understand complex technical issues and bugs.
After 18 posts, we still haven't seen any complete, accurate wiring diagram. The forum posting guidelines suggest that it is almost mandatory in cases like yours.

If you look at the schematic shown in the first post, that's exactly how the components are linked. I will try to make a diagram that mirrors the breadboard.
Can you suggest a program to do this?.. I can look for it also.....