Been working on the code for a fish bowl heater to keep my Betta fish from getting too cold in the winter months, as it gets pretty cold up here.
He has a small bowl which is good for him, being solitary, and Bad for Goldfish (its true. goldfish in bowls is bad, give them room and keep em clean
)
I plan on twinning it up with my light system later but for now i'm keeping them separate.
the general idea is:
thermsistor set in the water and delivers value back on A0,
depending on the value (in this case min is 85 and max is 92, turns out to be ambient temperatures of around 21 - 24 degrees C
24C being a good temp for the fish, so that was it max
but i make sure it doesnt fall below 21 or 22, if it does, on comes the heat in the form of a pad made up of a disk of tin with a peltier heat pump under it stuck with heat transfer material, and surrounded with rubber pads the same thickness as the pump. resting on a pad of foam to make a sandwich (pics later). The bowl sits on top of this.
this is the code i cobbled together from examples i looked at:
/*
Will start and stop a peltier device in a pad under a fish bowl
depending on what the value of the thermsistor returns from
the water temprature and then display a status message
onto the LCD (2x16)
The circuit:
* LCD 1 GND
* LCD 2 VCC
* LCD 4 RS pin to digital pin 12
* LCD 6 Enable pin to digital pin 11
* LCD 11 D4 pin to digital pin 5
* LCD 12 D5 pin to digital pin 4
* LCD 13 D6 pin to digital pin 3
* LCD 14 D7 pin to digital pin 2
* LCD 3 VO pin to GND
* LCD 15 + LED
* LCD 16 - LED
* Thermsistor to +5 and A0 and A0 resistor to gnd
* LED D13
* Heatpump D10
LCD Library and code borrowed from:
http://www.arduino.cc/en/Tutorial/LiquidCrystal
*/
// include LCD library
#include <LiquidCrystal.h>
// initialize pins and initial value
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int sensorPin = 0;
int ledPin = 9;
int heatPin = 10;
int sensorValue = 0;
void setup() {
// set up the LCD, and pins
lcd.begin(16, 2);
pinMode(ledPin,OUTPUT);
pinMode(heatPin,OUTPUT);
//Blink to show startup
digitalWrite(ledPin, HIGH);
digitalWrite(heatPin, LOW);
delay(35);
digitalWrite(ledPin, LOW);
}
void loop() {
lcd.setCursor(1, 0);
lcd.print("-FishFishHeat-");
lcd.setCursor(13, 1);
lcd.print(sensorValue);
sense(); // sensor input
if (sensorValue <= 85){
heatOn(); // start heatpump
}
else {
lcd.setCursor(5, 1);
lcd.print("is OK");
}
if (sensorValue >= 92) {
heatOff(); // stop heatpump
}
// Turn on the display:
lcd.display();
delay(500);
lcd.clear();
/* // trying to havve a '*' displayed on the lcd
// while the heater is on...
if (heatPin == HIGH){
lcd.setCursor(0, 1);
lcd.print("*");
}
*/
}
void sense() { // sensor input
sensorValue = analogRead(sensorPin);
}
void heatOn() { // start heatpump
digitalWrite(ledPin, HIGH);
digitalWrite(heatPin, HIGH);
lcd.setCursor(1, 1);
lcd.print("is Min Temp");
}
void heatOff() { // stop heatpump
digitalWrite(ledPin, LOW);
digitalWrite(heatPin, LOW);
lcd.setCursor(1, 1);
lcd.print("is Max Temp");
}
what i would like to do is have the lcd display a * while the heater is active like the led is, but attempts have failed me so far.
tests are good tho, am yet to test on some actual water. thats next. ![]()
updates as i go.
