Fish hab

Hello!So i want to make a fish auto-support system. I want to make a thermostat. I'm thinking that in the code there would be a variable , temp. sensor output. And when this variable reaches a certain value(when the temp drops to 24.5 deg.C, or for the reading electrical resistance drops) it outputs some current trough pins, and this voltage goes to a system that powers the water heater in the aquarium. I am new to this, and i couldn't find anything that would help, because all the tutorials would are on thermostats that use Displays. It would be cool to do this with display, but it seems to complicated for a first project. And also, i researched a bit and i wrote a code that delays an electric signal.And that signal would power a servo, and release a bit of fish food. But how much time does the signal hold.I don't own a board, but i want to buy one very soon. Help would be greatly appreciated. Here is the code for the timer. Is it good/ how do i set electric signal time?

int commPin = 13;

void setup() { pinMode(commPin, OUTPUT); }

void loop() { digitalWrite(commPin, HIGH); delay(14400000); digitalWrite(commPin, HIGH); }

void loop()
{
  digitalWrite(commPin, HIGH);  //take pin 13 HIGH
  delay(14400000);                   //wait 4 hours whilst nothing happens
  digitalWrite(commPin, HIGH);  //leave the pin HIGH an go back and do it over again
}

Is that what the code is supposed to do ?

As I suggested recently to someone else. Read your program in English, does it make sense?

Set commPin High Wait 14400000 milliseconds Set commPin High (return to top of loop) Set commPin High Wait 14400000 milliseconds Set commPin High (return to top of loop)

Repeat forever...

Why use an arduino for this? There are thermostatic fishtank heaters out there that do just this for very little cost.

Also… Don’t make your code wait 4 hours before checking temp again. Check every second or two (veteran fishkeeper here - 4 hours is way, way too long between measurements especially for small (less than 200 litres) aquariums.

fall-apart-dave: Why use an arduino for this? There are thermostatic fishtank heaters out there that do just this for very little cost.

Also... Don't make your code wait 4 hours before checking temp again. Check every second or two (veteran fishkeeper here - 4 hours is way, way too long between measurements especially for small (less than 200 litres) aquariums.

The OP changed from a temp controller to a fish feeder midway through the post.

Sorry missed that bit.

Leave temp to the thermostatic heater.

Autofeeders are also available on timers, again very cheap.

However, if you were to develop the idea further, you could including auto-dosing of plant food, CO2, lights and other things, with the same bit of code slightly modified for each once you get it working.

A better approach would be to have the board react at certain times of the day, rather than on a timer (so referenced to a clock, feed at 8am, 1pm, 5pm and 8pm, for example). This way, you aren’t feeding the fish in the middle of the night.

fall-apart-dave: Why use an arduino for this? There are thermostatic fishtank heaters out there that do just this for very little cost.

Also... Don't make your code wait 4 hours before checking temp again. Check every second or two (veteran fishkeeper here - 4 hours is way, way too long between measurements especially for small (less than 200 litres) aquariums.

The signal would trigger a servo that would release the fish food.

UKHeliBob: void loop() {   digitalWrite(commPin, HIGH);  //take pin 13 HIGH   delay(14400000);                  //wait 4 hours whilst nothing happens   digitalWrite(commPin, HIGH);  //leave the pin HIGH an go back and do it over again }

Is that what the code is supposed to do ?

It sends a signal to a servo that releases some fish food. It does that every 4 hours.

What people have been trying to hint to you is that your program doesn't change anything. At the very beginning of loop you do this:

digitalWrite(commPin, HIGH);

That sets pin 13 high. You never set it low, so it stays high forever, or at least till you cut the power. The device being triggered will see a single rise to high on pin 13 at the start and that's it.

It sends a signal to a servo that releases some fish food. It does that every 4 hours.

Look carefully at the code.

It only ever sets commPin HIGH. It's state never changes. In any case, how does setting or changing the state of a pin cause a servo to move to release the food ? What type of servo are you using ?

Do you want the program to do anything else during the 4 hour waiting period ?