i have a problem with my project, the controller goes every 2-5minutes offline, with Heartbeat timeout ,
i use: Uno R3 CH340 and ENC28J60 with new 0.4.4 blynk library and actually ENC28J60 ethernet library.
here is my code and serial log error:
/**************************************************************
* Blynk is a platform with iOS and Android apps to control
* Arduino, Raspberry Pi and the likes over the Internet.
* You can easily build graphic interfaces for all your
* projects by simply dragging and dropping widgets.
*
* Downloads, docs, tutorials: http://www.blynk.cc
* Blynk community: http://community.blynk.cc
* Social networks: http://www.fb.com/blynkapp
* http://twitter.com/blynk_app
*
* Blynk library is licensed under MIT license
* This example code is in public domain.
*
**************************************************************
*
* This example shows how to use ENC28J60 (UIPEthernet library)
* to connect your project to Blynk.
*
* For this example you need UIPEthernet library:
* https://github.com/ntruchsess/arduino_uip
*
* Typical wiring would be:
* VCC -- 5V
* GND -- GND
* CS -- D10
* SI -- D11
* SCK -- D13
* SO -- D12
* INT -- D2
*
* Feel free to apply it to any other example. It's simple!
*
**************************************************************/
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <UIPEthernet.h>
#include <BlynkSimpleUIPEthernet.h>
#include <SimpleTimer.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xyz";
int sensorPin = A3; // select the input pin for the potentiometer
WidgetBridge bridge1(V1);
SimpleTimer timer; // Create a Timer object called "timer"!
BLYNK_CONNECTED() {
bridge1.setAuthToken("xyz2"); // Place the AuthToken of the second hardware here
}
void setup()
{
Serial.begin(9600);
Blynk.begin(auth);
timer.setInterval(1000L, sendUptime); // Here you set interval (1sec) and which function to call
}
void sendUptime()
{
if (map(analogRead(sensorPin), 0, 1023, 0, 100) > 70) {
bridge1.digitalWrite(5, LOW);//rot ein 0-active
bridge1.digitalWrite(6, HIGH);//gruen aus 0-active
}
else
{
bridge1.digitalWrite(5, HIGH);//rot aus 0-active
bridge1.digitalWrite(6, LOW);//gruen ein 0-active
}
}
void loop()
{
Blynk.run();
timer.run(); // SimpleTimer is working
}
Could be several things. First thing I’m thinking is faulty hardware or bad wiring from the ENC to the Arduino. The ENC is very picky about it’s wiring, grounding and powersupply (believe me, I messed up a couple modules before I found out, lol). I’d highly recommend trying another ENC module or adding Wifi. It could also be the network cable, but that is highly unlikely. Try rebooting your router/modem, sometimes that worked for me.
I have the same problem, but I use blank Blynk example for ENC28J60. I tried with Arduino UNO + ENC28J60. Now I’m trying with Arduino Nano + ENC28J60.
Here is my output from Serial Monitor.
[1] Getting IP...
[5281] IP:172.16.230.128
[5282]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ \/ '_/
/____/_/\_, /_//_/_/\_\
/___/ v0.4.4 on Arduino Nano
[5396] Connecting to blynk-cloud.com:8442
[20483] Connecting to blynk-cloud.com:8442
[20971] Ready (ping: 51ms). // sometimes 5 minutes, 30 or 2 hours.
[1856098] Heartbeat timeout
[1859101] Connecting to blynk-cloud.com:8442
[1874144] Connecting to blynk-cloud.com:8442
[1889183] Connecting to blynk-cloud.com:8442
and so on…
I tried on several routers and on several Ethernet cables. I don’t know where might be a problem. I have to add, that while the sketch is compiling i get lots of warnings:
#warning "Not defined ENC28J60_CONTROL_CS. Use borad default SS pin setting. You can configure in 'utility/Enc28J60Network.h'."
#warning "You can configure LogObject and ACTLOGLEVEL in 'utility/logging.h'. More verbosity more memory usage."
#define ntohs(x) htons(x)
#define ntohs htons
#warning "You can configure LogObject and ACTLOGLEVEL in 'utility/logging.h'. More verbosity more memory usage."
#warning "You can configure LogObject and ACTLOGLEVEL in 'utility/logging.h'. More verbosity more memory usage."
#warning "You can configure LogObject and ACTLOGLEVEL in 'utility/logging.h'. More verbosity more memory usage."
#warning "Not defined ENC28J60_CONTROL_CS. Use borad default SS pin setting. You can configure in 'utility/Enc28J60Network.h'."
#warning "Not defined ENC28J60_CONTROL_CS. Use borad default SS pin setting. You can configure in 'utility/Enc28J60Network.h'."
#warning "You can configure LogObject and ACTLOGLEVEL in 'utility/logging.h'. More verbosity more memory usage."
#warning "Not defined ENC28J60_CONTROL_CS. Use borad default SS pin setting. You can configure in 'utility/Enc28J60Network.h'."
#warning "You can configure LogObject and ACTLOGLEVEL in 'utility/logging.h'. More verbosity more memory usage."
#warning "Not defined ENC28J60_CONTROL_CS. Use borad default SS pin setting. You can configure in 'utility/Enc28J60Network.h'."
#warning "You can configure LogObject and ACTLOGLEVEL in 'utility/logging.h'. More verbosity more memory usage."
#warning "Not defined ENC28J60_CONTROL_CS. Use borad default SS pin setting. You can configure in 'utility/Enc28J60Network.h'."
#warning "You can configure LogObject and ACTLOGLEVEL in 'utility/logging.h'. More verbosity more memory usage."
#warning "You can configure LogObject and ACTLOGLEVEL in 'utility/logging.h'. More verbosity more memory usage."
#warning "You can configure LogObject and ACTLOGLEVEL in 'utility/logging.h'. More verbosity more memory usage."
I have the latest version of Blynk library v0.4.4. I also use UIPEthernet library v1.59 for Arduino-IDE Version 1.5.5 and higher from link in the sketch. I use Arduino IDE 1.6.10.
I have problems to with Uno and enc28j60 . With other no blynk sketchs and ethercard library work ok. I think is a problem with uipethernet library. After some minuts or hours the enc hangs. A possible solution is stop and start the enc with powerOff() and powerOn() functions every 30 minuts, but my skills in C are small for do it.
I have an ENC hooked up to my Mega but it’s not something I use. Maybe a regular ENC user will take a look at the problem or perhaps I’ll set mine running to see if it hangs. I only ever run it for a few minutes for testing purposes.
No. All works ok, for a time. The problem is with enc28j60 shield. After a time hangs. The time could be minuts or hours.
Somebody is using this shield 24h/7d ? And works ok?
I use this library: https://github.com/UIPEthernet/UIPEthernet, IDE 1.8.1, blynk 0.4.4 whith a example sketch adding this function, execute every minut by simpleTimer for test it
void publishMillis()
{
unsigned long m=millis()/1000L;
Blynk.virtualWrite(V15,m);
Serial.println(m);
Enc28J60.powerOff();//leds on enc28j60 off!!
delay(100);
Enc28J60.powerOn(); leds on enc28j60 on!!
}
Is not a elegant solution but if it works…
After 2 hours working ok! Edit: don’t work!!
Normally I use nodeMcu and UNO+wiznet5100shield, but I have some boards with enc28j60 than I want use with blynk. I’m fighting for do it. Now I try another option:
void publishMillis()
{
unsigned long m=millis()/1000L;
Blynk.virtualWrite(V15,m);
Serial.println(m);
Enc28J60.init(arduino_mac);
}