Project

General

Profile

Ethercard - client and powerdown

Added by stg20 over 4 years ago

First of all, hello

I was wondering if anyone already went through the pain I’m enjoying now and could share his knowledge.

I’d like to have ENC28J60 with Ethercard library to stay off for most of the time and once per few hours (this is done by sleep library) wake up, send with POST/GET several parameters to server and turn off again. I’ve noticed that Ethercard has already included really nice function powerDown(). I’ve measured power consumption by ENC28J60 while it’s on between 1.2-1.5W, while it’s off is 0, so it makes a small difference in a whole year, not mentioning decreased unit heat and probably increased life.

Here come my problems:
1) If in loop() I first use powerUp(), then DHCP configuration, and at last powerDown() - it doesn’t configure DHCP. When at the end I first do powerDown(), then powerUp() in the same cycle loop it works - any ideas why?
2) As far as I understand I can’t configure DHCP in setup(), but it has to be done on each wake up (ENC28J60 power on), so it goes in loop(), but to send any request everything in loop() has to be inside of

if (millis() > timer) {

}

this makes use of network configuration in loop() impossible (eg. timeout). Or is there any other way?

3) Any sensors which are putting data on Serial output in the same loop(), are preventing browseUrl() to execute completely. Example of such a sensor is DHTxx.

Please help.