-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Catfeeder is not coonecting with the wifi router #1
Comments
Lets see.
Looks like the "ssid" and "pass" fields are not inside the config.json file. Let's see some versions: I use: ESP8266 by ESP8266 Community version 2.5.0 Thank in advance, |
Hi Juanmcasillas/Catfeeder-Slot
thanks for coming back to me.
Unfortunately, the problem was not linked with any of this. The problem is
coming from SPIFFS. I just figured it by reading some blogs. I was using 2
MB FS with OTA 1019KB.. it was effecting the flash and unable to create a
config file. After I changed it to 3MB FS (OTA 512KB), it works perfectly
now.
Few questions I want to ask -
1. I saw that if the Esp8266 goes off the scheduler time values are gone.
Is that normal?
2. I have designed a feeder that has a screw that takes out food from
the reservoir. Instead of making it slot, I did this process. In that case
which part of the codes should change? A few suggestions might help as I
not that advanced coder like you.
3. For my screw type cat feeder, I don't need a date data(DD-MM-YY) to feed
the cat. Instead of that, I need ESP to act as a daily alarm(only time
HH:MM: SS is needed) where every day at a certain time it will trigger.
Any suggestions on how to do that?
you have done an awesome job btw.
…On Thu, 9 Jan 2020 at 18:46, Juan M. Casillas ***@***.***> wrote:
Lets see.
The config (config.json) file should look like:
{
"ssid":"WLAN_XXXX",
"pass":"XXXX",
"ip":[192,168,1,1],
"netmask":[255,255,255,0],
"gateway":[192,168,1,2],
"dns":8,8,8,8],
"dhcp":false,"ntp":"es.pool.ntp.org",
"NTPperiod":15,
"timeZone":10,
"daylight":true,
"deviceName":"CatFeeder"
}
Looks like the "ssid" and "pass" fields are not inside the config.json
file.
Also, you're using 192.168.1.1 as CatFeeder IP and 192.168.1.2 for the
router. Is this right?
Let's see some versions:
I use: ESP8266 by ESP8266 Community version 2.5.0
Arduino IDE: 1.8.10
Can you paste the compilation log, to check the errors?
Thank in advance,
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1?email_source=notifications&email_token=AIP3FRWY3TJY2UC665LO5WTQ45PI7A5CNFSM4KE2F6PKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIRFDXQ#issuecomment-572674526>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIP3FRQL76RI7FB7TREDYTTQ45PI7ANCNFSM4KE2F6PA>
.
|
I forget to mention that. You need at least 2 MB FS to get the thing works :-)
Yes, These boards doesn't include a RTC (Real Time Clock). These tiny (an cheap) devices, backup the state with a battery (usually CR 3022) and they avoid to lose the time when the microcontroller lost the power. These breakout boards are easy to integrate (usually they "speak" I2C). See for more info: I use NTP sync to keep the time "uptime". So you don't need to worry about losing the time. But if you need more robust time control, get a RTC breakout board and integrate it.
CatFeeder-Slot works in this way (pseudocode).
If you need to configure it for your needs, you have modify some code. See catfeeder.cpp void CatFeederClass::CheckScheduler(void *arg) {
// USE self instead of this
// this function is called each CatFeederClass::SCHEDULE_PERIOD (1 second)
CatFeederClass *self = reinterpret_cast<CatFeederClass *>(arg);
int programs = self->getPROGRAMS();
unsigned long mystamp,prgstamp;
String mytime = self->GetTimeStampNow();
mystamp = self->ToTimestamp(mytime);
for (int i=0; i< programs; i++) {
String sched = self->getScheduler(i);
if (sched != "") {
prgstamp = self->ToTimestamp(sched);
if (mystamp == prgstamp) {
// do things if matches
DEBUGLOG(" TICK_MATCH! #%d %s %s\n", i, mytime.c_str(), sched.c_str());
self->setLastOpen(sched.c_str());
//self->AdvanceSlot();
// CALL HERE THE CODE TO MOVE THE MOTOR:
}
}
}
} You should modify the
// calls to function Move()
// dir: 0, 1
// steps: number of steps to move
// _motor is the motor stepper implementation
// you have to call the function in this way, to avoid blocking
schedule_function(std::bind(MotorStepperClass::Move, dir, steps, _motor));
See catfeeder.cpp and change the function to this: String CatFeederClass::GetTimeStampNow() {
time_t t = now();
char *buf = (char *)malloc(1024);
sprintf(buf, "%02d:%02d:%02d", hour(t), minute(t), second(t));
String ret = buf;
free(buf);
return(ret);
} See catfeeder.cpp and the function in order to use only the hour, minute second, as these: unsigned long CatFeederClass::ToTimestamp(String d) {
// EPOCH 01/01/1970 00:00:00
// 1 hour 3600 seconds
// 1 day 86400 seconds
// 1 week 604800 seconds
// 1 month (30.44 days) 2629743 seconds
// 1 year (365.24 days) 31556926 seconds
int hour, minute, second;
sscanf(d.c_str(),"%02d:%02d:%02d", &hour, &minute, &second);
unsigned long ret;
ret = (hour * 3600) + (minute * 60) + second;
return(ret);
}
Hope it works for you :-) |
Sorry for replying to you so late. It took me long to figure out most of the codes. I have followed your steps and its kinda solve the issues. regarding the Telegram bot library. I couldn't find any code inside the catfeeder.cpp or cat feeder.h ..if I want to implement telegram bot where should I look for it in the codes. A few suggestions might help me a bit. Thanks again. :) |
Telegram bot is in very preliminary support, but you shouldn't have any problems working Also check my Universal Telegram Bot fork. Thanks in advance, |
Hi ,I copied the source files for running into telegram .It seems the the telegram bot you forked and changed for Json 6 is not compiling so far . I tried some changes and it compiles but not running the bot. I saw this in the bot.h .Do I need change bool _active =true ?? I am attaching the modified bot codes for json 6 here.May be you can look into this . protected:
|
telegram_cpp.txt these are files... sorry for copy and pasting the code..it was bad idea |
After trying to setup network the serial monitor does not show the SSID and Password. Also, it doesn't connect with my router. Before that happens it starts making the server. blow is the serial log -
191 JSON file size: 193 bytes
{
"ip": [
192,
168,
1,
1
],
"netmask": [
255,
255,
255,
0
],
"gateway": [
192,
168,
1,
2
],
"dns": [
8,
8,
8,
8
],
"dhcp": false,
"ntp": "es.pool.ntp.org",
"NTPperiod": 15,
"timeZone": 10,
"daylight": true,
"deviceName": "CatFeeder"
}Data initialized.
SSID: PASS:
NTP Server: es.pool.ntp.org
bool AsyncFSWebServer::load_config()
Failed to open secret file
void AsyncFSWebServer::configureWifi()
bcn 0
del if1
mode : sta(a0:50:b3:6a:6c:29)
Connecting to
NO DHCP - Use static connection
MAC Addr: A0:50:B3:6A:6C:29
Open http://192.168.1.1/ to manage the CatFeeder
Flash chip size: 4194304
Scketch size: 444880
Free flash space: 1650688
HTTP server started
OTA Ready
END Setup
what should I do in that case? the esp8266 SDK 2.5 doesn't compile now with the new cat slot code. I am currently using 2.6.0 SDK to solve that ..
Another question-
what version of Arduino you are using to compile your code?
The text was updated successfully, but these errors were encountered: