Fish_tank lighting

My use case is very simple, i am using ESP8266 module and i have added Blynk library…

I just want to light up my fish tank in two different ways.

  1. On demand - ON / OFF
  2. Lighting up for x hrs , using some widgets ( x - can be 1 to 10 hrs)

Also once i send the command to the hardware , i also need to receive the ack from the hardware to the blynk app…

Can someone guide me with the code , i am relatively new to this …

Thanks

I think you’ve probably come to the wrong place if you want people to write your code for you. Most of the users here are happy to help people to sort-out the wrinkles with their code, but you need to make some effort to get yourself going.

There are plenty of code examples in the Sketch Builder:
https://examples.blynk.cc/?board=ESP8266&shield=ESP8266%20WiFi&example=Widgets%2FTimeInput%2FAdvancedTimeInput

You may also want to consider the hardware that you’re using. It depends on the type of lighting that you’re using, but assuming that it’s mains operated then something like a Sonoff switch that has a built-in ESP8266 and relay may be a better choice of hardware than building your own.

If you do some searching on the forum you may even find some sonoff projects that utilise the timer widget to do something similar to what you’re describing :wink:

Pete.

2 Likes

Consider this product too ( I took 10 of them and all are working good )

https://www.electrodragon.com/product/wifi-iot-relay-board-based-esp8266/

1 Like

you can try the Timer widget.

I guess you’re after something like this…

I need to add a ph reading next. It all takes time to get it right but its satisfying once everything works the way you want it.

1 Like

Folks , thanks for your feedback … i have managed to get a code which uses timer widget

#define BLYNK_PRINT Serial  
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>


char ssid[] = "Mar"; //xarxa wifi        
char pass[] = "xxxxxxxx"; //password wifi
char auth[] = "8a40cf841c4043e983ca036addb666c4"; 
BlynkTimer timer;
boolean stateled=0;
boolean prevStateled=0;

void setup()
{
  // Debug console
  Serial.begin(115200);
  pinMode(13,OUTPUT); // NODEMCU PIN D7
  Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
  timer.setInterval(300L, checkledstate);
 //  attachInterrupt(digitalPinToInterrupt(13), notifyOnled, CHANGE);
}
BLYNK_WRITE(V0)
{
    if (param.asInt()){       
        digitalWrite(13, HIGH); Blynk.virtualWrite(V13,255); Blynk.notify("led ACTIVADO");
    } else {
        digitalWrite(13, LOW);  Blynk.virtualWrite(V13,0);
    }
}
BLYNK_WRITE(V1)
{
    if (param.asInt()){       
        digitalWrite(13, HIGH); Blynk.virtualWrite(V13,255); Blynk.notify("led ACTIVADO");
    } else {
        digitalWrite(13, LOW);  Blynk.virtualWrite(V13,0);
    }
}


void loop()
{
  if (Blynk.connected())
  {
    Blynk.run();
  }
   timer.run();  
}

BLYNK_CONNECTED()
{
  Blynk.syncAll();
  
}
void checkledstate()
{
  
  stateled=digitalRead(13);
  if (stateled!=prevStateled)
  {
    if (stateled==0) Blynk.virtualWrite(V13,0); Blynk.notify("led ACTIVADO");
    if (stateled==1) Blynk.virtualWrite(V13,255); 
  }
  prevStateled=stateled;
}

however i am unable to compile it , getting the below error , i have all the latest library installed but not sure why i get this … anything i am missing here?

================================

Arduino: 1.8.5 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Martin Charles\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Martin Charles\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Martin Charles\Documents\Arduino\libraries -fqbn=esp8266:esp8266:nodemcuv2:CpuFrequency=80,UploadSpeed=115200,FlashSize=4M3M -ide-version=10805 -build-path C:\Users\MARTIN~1\AppData\Local\Temp\arduino_build_168243 -warnings=none -build-cache C:\Users\MARTIN~1\AppData\Local\Temp\arduino_cache_993253 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.mkspiffs.path=C:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\0.1.2 -prefs=runtime.tools.esptool.path=C:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\tools\esptool\0.4.9 -prefs=runtime.tools.xtensa-lx106-elf-gcc.path=C:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2 -verbose C:\Users\Martin Charles\Downloads\LED_CONTROL_TIMERS_NOTIFICATIONS\LED_CONTROL_TIMERS_NOTIFICATIONS\LED_CONTROL_TIMERS_NOTIFICATIONS.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Martin Charles\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Martin Charles\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Martin Charles\Documents\Arduino\libraries -fqbn=esp8266:esp8266:nodemcuv2:CpuFrequency=80,UploadSpeed=115200,FlashSize=4M3M -ide-version=10805 -build-path C:\Users\MARTIN~1\AppData\Local\Temp\arduino_build_168243 -warnings=none -build-cache C:\Users\MARTIN~1\AppData\Local\Temp\arduino_cache_993253 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.mkspiffs.path=C:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\0.1.2 -prefs=runtime.tools.esptool.path=C:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\tools\esptool\0.4.9 -prefs=runtime.tools.xtensa-lx106-elf-gcc.path=C:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2 -verbose C:\Users\Martin Charles\Downloads\LED_CONTROL_TIMERS_NOTIFICATIONS\LED_CONTROL_TIMERS_NOTIFICATIONS\LED_CONTROL_TIMERS_NOTIFICATIONS.ino
Using board 'nodemcuv2' from platform in folder: C:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0
Using core 'esp8266' from platform in folder: C:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0
Detecting libraries used...
"C:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/include" "-IC:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include" "-IC:\Users\MARTIN~1\AppData\Local\Temp\arduino_build_168243/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11  -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC   -DARDUINO=10805 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_NODEMCU"  -DESP8266 "-IC:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266" "-IC:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\variants\nodemcu" "C:\Users\MARTIN~1\AppData\Local\Temp\arduino_build_168243\sketch\LED_CONTROL_TIMERS_NOTIFICATIONS.ino.cpp" -o "nul"
"C:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/include" "-IC:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include" "-IC:\Users\MARTIN~1\AppData\Local\Temp\arduino_build_168243/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11  -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC   -DARDUINO=10805 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_NODEMCU"  -DESP8266 "-IC:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266" "-IC:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\variants\nodemcu" "-IC:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src" "C:\Users\MARTIN~1\AppData\Local\Temp\arduino_build_168243\sketch\LED_CONTROL_TIMERS_NOTIFICATIONS.ino.cpp" -o "nul"
"C:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/include" "-IC:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include" "-IC:\Users\MARTIN~1\AppData\Local\Temp\arduino_build_168243/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11  -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC   -DARDUINO=10805 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_NODEMCU"  -DESP8266 "-IC:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266" "-IC:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\variants\nodemcu" "-IC:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src" "-IC:\Users\Martin Charles\Documents\Arduino\libraries\Blynk\src" "C:\Users\MARTIN~1\AppData\Local\Temp\arduino_build_168243\sketch\LED_CONTROL_TIMERS_NOTIFICATIONS.ino.cpp" -o "nul"
"C:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/include" "-IC:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include" "-IC:\Users\MARTIN~1\AppData\Local\Temp\arduino_build_168243/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11  -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC   -DARDUINO=10805 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_NODEMCU"  -DESP8266 "-IC:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266" "-IC:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\variants\nodemcu" "-IC:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src" "-IC:\Users\Martin Charles\Documents\Arduino\libraries\Blynk\src" "C:\Users\MARTIN~1\AppData\Local\Temp\arduino_build_168243\sketch\LED_CONTROL_TIMERS_NOTIFICATIONS.ino.cpp" -o "C:\Users\MARTIN~1\AppData\Local\Temp\arduino_build_168243\preproc\ctags_target_for_gcc_minus_e.cpp"
In file included from C:\Users\Martin Charles\Downloads\LED_CONTROL_TIMERS_NOTIFICATIONS\LED_CONTROL_TIMERS_NOTIFICATIONS\LED_CONTROL_TIMERS_NOTIFICATIONS.ino:6:0:

C:\Users\Martin Charles\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp8266.h:18:21: fatal error: version.h: No such file or directory

 #include <version.h>

                     ^

compilation terminated.

Using library ESP8266WiFi at version 1.0 in folder: C:\Users\Martin Charles\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi 
Using library Blynk at version 0.5.4 in folder: C:\Users\Martin Charles\Documents\Arduino\libraries\Blynk 
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

You missed formatting your posted code and serial output :stuck_out_tongue_winking_eye:

Blynk - FTFC

1 Like

Sorry, i have just enabled the verbose for compile … please find the error message …

i do have BlynkSimpleEsp8266.h header file as part of the library file , but still its shows the below error …

Any idea?


Arduino: 1.8.5 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"

In file included from C:\Users\Martin Charles\Downloads\LED_CONTROL_TIMERS_NOTIFICATIONS\LED_CONTROL_TIMERS_NOTIFICATIONS\LED_CONTROL_TIMERS_NOTIFICATIONS.ino:6:0:

C:\Users\Martin Charles\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp8266.h:18:21: fatal error: version.h: No such file or directory

 #include <version.h>

                     ^

compilation terminated.

exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Start by editing your previous post to correct the formatting of you code and serial output, as requested by @Gunner, then edit your last post to format your compiler error message in the same way.

Then tell us what version of the ESP core you’re using.

Pete.

Folks,

Please accept my apologies , i have just read through the community “read me” and understood about the code format and other stuff… I am interested in IoT to try few things even though i am not from coding background , so please do excuse my questions!


#define BLYNK_PRINT Serial  
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>


char ssid[] = "Mar"; //xarxa wifi        
char pass[] = "xxxxxxxx"; //password wifi
char auth[] = "8a40cf841c4043e983ca036addb666c4"; 
BlynkTimer timer;
boolean stateled=0;
boolean prevStateled=0;

void setup()
{
  // Debug console
  Serial.begin(115200);
  pinMode(13,OUTPUT); // NODEMCU PIN D7
  Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
  timer.setInterval(300L, checkledstate);
 //  attachInterrupt(digitalPinToInterrupt(13), notifyOnled, CHANGE);
}
BLYNK_WRITE(V0)
{
    if (param.asInt()){       
        digitalWrite(13, HIGH); Blynk.virtualWrite(V13,255); Blynk.notify("led ACTIVADO");
    } else {
        digitalWrite(13, LOW);  Blynk.virtualWrite(V13,0);
    }
}
BLYNK_WRITE(V1)
{
    if (param.asInt()){       
        digitalWrite(13, HIGH); Blynk.virtualWrite(V13,255); Blynk.notify("led ACTIVADO");
    } else {
        digitalWrite(13, LOW);  Blynk.virtualWrite(V13,0);
    }
}


void loop()
{
  if (Blynk.connected())
  {
    Blynk.run();
  }
   timer.run();  
}

BLYNK_CONNECTED()
{
  Blynk.syncAll();
  
}
void checkledstate()
{
  
  stateled=digitalRead(13);
  if (stateled!=prevStateled)
  {
    if (stateled==0) Blynk.virtualWrite(V13,0); Blynk.notify("led ACTIVADO");
    if (stateled==1) Blynk.virtualWrite(V13,255); 
  }
  prevStateled=stateled;
}

Compiler Error Message

Arduino: 1.8.5 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"

In file included from C:\Users\Martin Charles\Downloads\LED_CONTROL_TIMERS_NOTIFICATIONS\LED_CONTROL_TIMERS_NOTIFICATIONS\LED_CONTROL_TIMERS_NOTIFICATIONS.ino:6:0:

C:\Users\Martin Charles\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp8266.h:18:21: fatal error: version.h: No such file or directory

 #include <version.h>

                     ^

compilation terminated.

exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Using ESP8266 Core & Blynk Version v0.5.4

Esp core version and Blynk version are completely different. Can you confirm that you’re using esp core version 2.4.2?

In the Arduino IDE go to Tools / Board / Boards Manager then scroll down the list to the bottom and find the “ESP8266 by ESP8266 Community” entry and see what version of the ESP core you have installed.

If it’s anything less than 2.4.2 then click on the ESP8266 entry and click the Update button. You should then restart the Arduino IDE and try re-compiling your code, then report back here with the results.

Pete.

2 posts were split to a new topic: Im nt sure how to do,pls help me

As well as good lighting for the aquarium is also important to equip a good filtration system and air pump . There are a lot of specialized shops on goods for aquariums. I recently found a store that sells exclusive natural reefs and Coralline Algae . They are used especially when setting up a new aquarium. Coralline algae have a good effective in improving water quality by controlling minerals and nitrite levels. Naturals reefs play role in creating natural ecosystem for your pets .If you are interested ARC Reef here you can find more about these products .