Automatic water sampler for a drone

Hi,
I am building a system which can be attached to a drone to automatically collect water samples. The system requirement is attached.
I am using a 5v servo, 2v to 6v water pump, arduino uno r3 and a 9v battery to supply power.
I attached the code, can you please tell me if the code is correct. Because when I connect the servo alone, it is working as required but when I connect pump and servo together it is not working.

include  <Servo.h>
Servo servo_test;  //name  of the  servo 
int  angle  =  0; 
int  motorPin =  A0;  //  pin that  turns  on the  motor
int  watertime  =  5;  //  how  long to water in seconds 
int  waittime  =  60;  //  how  long to wait  between watering, in minutes 
void setup() 
{ 
servo_test.attach(8);  //this  number is  the  pin which says  where  the  pin goes  to 
servo_test.write(angle);  //this  angle  represents  the  position it  has  to take 
pinMode(motorPin, OUTPUT); 
} 
void loop() 
{ 
for(angle  =  35;  angle  <180;  angle++) 
{
servo_test.write(angle);  //  will  rotate  the  servo 
delay(15); 
digitalWrite(motorPin, HIGH);  //  turn on the  motor delay(watertime*1000);  //  multiply by 1000 to translate  seconds  to milliseconds 
digitalWrite(motorPin, LOW);  //  turn off the  motor 
delay(waittime*60000);  //  multiply by 60000 to translate  minutes  to milliseconds 
} 
for(angle  =  70;  angle  <180;  angle++)
{ 
servo_test.write(angle);  //  will  rotate  the  servo 
delay(15); 
digitalWrite(motorPin, HIGH);  //  turn on the  motor 
delay(watertime*1000);  //  multiply by 1000 to translate  seconds  to milliseconds 
digitalWrite(motorPin, LOW);  //  turn off the  motor 
delay(waittime*60000);  //  multiply by 60000 to translate  minutes  to milliseconds
}

This is the system requirement. Can anyone help me ?

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

OPs project;


How are you powering your project?

Thanks.. Tom... :slight_smile:

Hi Tom,
Here is the circuit diagram. I am using 9v battery to supply power.

After the first loop, the tx light on the arduino board is on and the next loop is not being executed.

Hi,
Thanks for the circuit;
OP circuit

I am using 9v battery to supply power.

Is it one of these?

Then it will not have the capacity or the current output to do your job.

Powering the servo from the 5V of the UNO is also not good, as the onboard regulator cannot supply the current needed for the servo.

What are the specs on your pump?
You cannot power it from an I/O pin, they can only supply 40mA max.

You need to look at using bigger batteries to do your job.

Can you please tell us your electronics, programming, Arduino, hardware experience?

Tom... :slight_smile:

Yes, I am using the similar battery.
So, should I get other power source with 12v?
But the pump specifications say that it can be operated with 2v to 6v supply.
Should I used transistors to amplify the power supply to the pump ?

Hi,
What does the pump spec say, post link to data?
You will need to use a BJT or MOSFET to turn the pump ON/OFF.

But we need to now its specs....

Thanks.. Tom...

Please find the attachment for the specifications.

Hi Tom,
I was wondering if I can use a 9v Lithium battery with 1200mAh amp hour rating ? Will it supply enough power to my system?

Capacity sounds OK but why are you using a 9V batter when everything you need is 5V?

How do you plan on bringing the 9V down to 5V? (no, the Arduino can NOT power your pump or servo, and the regulator would be wasting nearly half your battery power as heat). Buck converter?

Do you need a pump, seeing from the volume of the sample?

Most of the spectrofotometers I know can use as little as 10 ml sample.

I used 3.7 V 18650 LiIon batteries. Grouping them 3 in series results in a large capacity. Still, heavy, I doubt the drone can hande.

A less conventional solution might be to use wires from the drone to the power source on the soil. This may give you as well the opportunity to send signals to the drone from surface.

This is the principle of soviet anti-tank missiles. Very effective, yet simple.

falexandru:
This is the principle of soviet anti-tank missiles. Very effective, yet simple.

...and American, and British, and French, and German....

Except . . they weren't powered by the cables, just guided.

Then why not power the drone using the cable, in this case?

The missiles were more demanding, because of high speed.

Of course, it depends of how far and how high the drone will travel. In my suggestion I assumed a short-range hobby drone. Therefore, up to 10 even 20 m distance from the observer it looks like a feasible alternative. The only point is the weight of the wires.

Pumping drains a lot of energy.

I am working on an all-terrain robot that separates the power source from the moving platform. Obviousely, it lacks autonomy. But it gains in terms of hardware to be carried.

Trade practical objectives. :-)))

Actually, to collect water samples you don't need a pump or even a servo, especially if it's one sample at a time. All you need is a small container suspended under the drone. Drop that in the water body to sample, it fills by itself, and you're good to go. Maybe add a little mechanism to open and close the container, but even that can be done by the container touching the water (have the container sink, little float to the lid to pull it open).

I do not think the Arduino Uno can handle the power of the (180 mA) pump. The pump works on 3.7 V very well, according to its posted specifications.

The type of battery to use is then limited by:

  • Voltage above 3 V - to operate the pump
  • weight - the maximum load the drone can carry

Alternatively, a small container may suffice (no pumping).

To debug the code (if the code is the cause of the problem, which I doubt):

  • comment each section out of the two (servo and pump), one by one.
  • check correct working
  • un-comment

There is a command in A IDE to comment-uncomment.

Myself I would not do this check by supplying power directly from the Uno.

Another problem - which I encountered many times - is the lack of the common ground. Check whether there is a correct common ground for all your components. Sometime is not that easy to spot.