Introduction: Controlled Fish Pond
In this project I will create how to monitor temperature, Switch On/Off Fish Feeder & Fish Waterpump
It's very useful for your fish pond.
Using Cayenne App for easier setup.
Step 1: Hardware Components
Arduino Board - https://goo.gl/MpCaGC
Arduino Ethernet Shield - https://goo.gl/RHUufR
Mini Servo - https://goo.gl/Ef5DBa
DS18B20 - https://goo.gl/4q88A8
Breadboard - https://goo.gl/4KybJo
Relay - https://goo.gl/x8vUnV
Transistor IRFZ44N - https://goo.gl/F6oZJa
Resistor 4.75k Ohm - https://goo.gl/Tk3Gr7
YWRobot Breadboard Module - https://goo.gl/9HBzAd
Cable Support - https://goo.gl/UnkBuc
3D Print Fish Feeder - https://goo.gl/r7fCTK
Step 2: Connections
P.S
Hacked Mini Servo to Spin 360 Degree / Continuous Rotation
Step 3: Upload Sketch
//#define CAYENNE_DEBUG // Uncomment to show debug messages
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space #include #include #include// Virtual Pin of the TMP36 widget. #define VIRTUAL_PIN 0 #define RELAY_DIGITAL_PIN 8 #define VIRTUAL_PIN_MOTOR V4
// Virtual Pin of the DS18B20 widget. #define VIRTUAL_PIN_TMP V2
// Digital pin the DS18B20 is connected to. Do not use digital pins 0 or 1 since those conflict with the use of Serial. const int tmpPin = 2;
OneWire oneWire(tmpPin); DallasTemperature sensors(&oneWire);
// motor pin int motorPin = 3;
// Cayenne authentication token. This should be obtained from the Cayenne Dashboard. char token[] = "Change Your Token";
void setup() { // set digital pin to output pinMode(RELAY_DIGITAL_PIN, OUTPUT); sensors.begin(); Serial.begin(9600); Cayenne.begin(token);
}
CAYENNE_IN(VIRTUAL_PIN) { // get value sent from dashboard int currentValue = getValue.asInt(); // 0 to 1
// assuming you wire your relay as normally open if (currentValue == 0) { digitalWrite(RELAY_DIGITAL_PIN, HIGH); } else { digitalWrite(RELAY_DIGITAL_PIN, LOW); } }
CAYENNE_IN(VIRTUAL_PIN_MOTOR) { int speed = 250; // read the integer value which should be 0 or 1 int enabled = getValue.asInt(); if (enabled == 1) { // turns on the motor at the specified speed analogWrite(motorPin, speed); } else { // turn motor off analogWrite(motorPin, 0); } }
void loop() { Cayenne.run(); }
// This function is called when the Cayenne widget requests data for the Virtual Pin. CAYENNE_OUT(VIRTUAL_PIN_TMP) { // Send the command to get temperatures. sensors.requestTemperatures(); // This command writes the temperature in Celsius to the Virtual Pin. Cayenne.celsiusWrite(VIRTUAL_PIN_TMP, sensors.getTempCByIndex(0)); // To send the temperature in Fahrenheit use the corresponding code below. //Cayenne.fahrenheitWrite(VIRTUAL_PIN, sensors.getTempFByIndex(0)); }
Step 4: Setup Cayenne Dashboard
- Add Arduino device to Cayenne connection via ethernet shield and you gived auth tokens to be listed on the website after that we add device sensor / actuators.
- Add DS18B20 with Virtual Connectivity and given sketch file / code for Temperature Sensor which directly in monitoring on dashboard web / mobile device, The DS18B20 sensor sends temperature data to the web / mobile device dashboard
- Actuator will be given a turn on and off command from the web / mobile dashboard where the Motor Switch moves the Servo on the Fish Feeder
- Relay Switch to power the water pump on the pool. Motor Switch with Virtual Connectivity and given sketch file / code to switch the servo switching using buttons in dashboard web / mobile device. Relay Switch with Virtual Connectivity and given sketch file / code for switching current on relays connected with arduino-controlled electric current using buttons on the web / mobile device dashboard
Step 5: Testing
You can subscribe to the my YouTube channel for more tutorials and projects. Subscribe for support. Thank you.
Go to my YouTube Channel - https://goo.gl/QbW5Bd