Can anyone help me? I want to run a 5v water pump via a relay powered by a 9v battery and automatically controlled by a temperature sensor. I also want to use a data logger on the r3 to show my results.
If your 9V battery is of the "fire alarm battery" type, it will not
will provide sufficient current for the water pump.
You will need to use another type of power supply, perhaps 2 Li_Ion batteries in series.
Using the recommended tags, post your code, and also post the schematic of your project.
Interesting project but we are not a free design or code writing service. We will be happy help out with your design and or code but first you have to make an attempt to design it, write it, post it and explain what is not working properly.
If there is hardware it is always best to post links to technical information as there are many versions of the same or different items. Since we cannot see your project, my eyes are to weak, you need to post using the language of electronics, an annotated schematic the language of electronics, (best) or a clear picture of a drawing. Pictures never hurt. Frizzing diagrams are not considered schematics here, they are wiring diagrams.
thanks for the quick reply. Yes, I am currently experimenting with one of those 9v batteries. I plan to power the circuit from the solar-charged batteries, which are 12v 105Ah lithium leisure batteries. I am looking into step-down voltage regulators on these forum pages.
images can be loaded directly to the message in this forum, no need to create PDF and upload it.
what voltage is the output of the buck converter feeding the UNO - because it should be 7V or greater, but no more than 10v
a relay contact won't power a motor. Something wrong there.
in this instance, a single relay, you may be able to get away with powering it from the 5V of the Arduino, but normally it's a horrible practice.
About your software:
Divide and conquer. By that I mean, write codes that simply operate/reports each individual element. That will do two things; enhance your skills with the IDE and the language, and provide you with test modules you can 'fall back to' when things go awry. While the proficient members of this forum will likely skip this step almost all the time except when working with an unfamiliar element, as a newb you owe it to yourself to take baby steps.
When you have a code that exercises an element, save it with a known name and keep a notepad itemizing the codes.
"Motor driven by button"
"LED and motor driven by button"
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is conntec to the Arduino digital pin 4
#define ONE_WIRE_BUS 4
#define RELAY1 8
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature sensor
DallasTemperature sensors(&oneWire);
void setup(void) {
// Start serial communication for debugging purposes
Serial.begin(9600);
// Start up the library
pinMode(RELAY1, OUTPUT);
digitalWrite(RELAY1, HIGH);
sensors.begin();
}
void loop(void) {
// Call sensors.requestTemperatures() to issue a global temperature and Requests to all devices on the bus
sensors.requestTemperatures();
Serial.print("Celsius temperature: ");
// Why "byIndex"? You can have more than one IC on the same bus. 0 refers to the first IC on the wire
Serial.print(sensors.getTempCByIndex(0));
Serial.print(" - Fahrenheit temperature: ");
Serial.println(sensors.getTempFByIndex(0))
if (Celsius temperature >= 40) {
digitalWrite(RELAY1, HIGH);
Serial.pirntln("PUMP ON");
}
if (Celsius temperature < 40) { digitalWrite(RELAY1, LOW); }
delay(1000);
}
this is my code so far, I am a beginner to coding and am struggling to make this code work, specifically with lines 37-42. i am aiming to get the temp sensor to operate the relay but don't know how to do this. any help would be greatly appreciated.
Now, as expected, the 9v battery cannot power the pump!
I ordered a buck converter to power the uno and pump from the 12v solar-charged lithium battery.
if I'm not wrong you are cooling one of the panels 'dripping water' on its surface ( as shown in one of the photo )
do you see any measurable difference in output power when the cooler is on?
I see from the serial debug you posted that 9 seconds after switching off the pump the surface temperature skyrocketed to 49°C again so maybe a variable, but more steady, water flow could improve the temperature control ( reducing the min/max oscillation )
P.S.
I'm happy you can cool your panels to 25°C, here ( in Italy ) we have 31°C air temperature : - (