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
}
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?
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 ?
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.
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.
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.