internetofhomethings / ESP8266-Arduino-Ide-Web-Server-Using-SDK-API

Supports SDK callbacks when data is received instead of polling for connections in the loop() function.
17 stars 9 forks source link

fatal error: mem_manager.h: No such file or directory #1

Open Santosh1971 opened 8 years ago

Santosh1971 commented 8 years ago

Dear Dave, I am getting following error, what to do ?I am using Arduino1.6.5

web_server.ino:19:25: fatal error: mem_manager.h: No such file or directory compilation terminated. Error compiling.

internetofhomethings commented 8 years ago

I am investigating your issue and will advise when I have an answer.

Here is what to do now: I have reviewed my SDK Web Server code (in the Eclipse IDE) and confirmed that two of the API headers are not used.

Comment out these two lines and recompile. My Arduino IDE sketch compiled without these two:

//#include "mem_manager.h" //#include "cont.h"

Regards,

Dave

Santosh1971 commented 8 years ago

it has advanced after commenting those. but now I am getting following errors

web_server.ino: In function 'void SdkWebServerrecv(void, char_, short unsigned int)': web_server:196: error: 'pvPortZalloc' was not declared in this scope web_server.ino: In function 'void SdkWebServersenddata(void, bool, char_)': web_server:315: error: 'pvPortZalloc' was not declared in this scope web_server.ino: In function 'bool SdkWebServersavedata(char, uint16)': web_server:385: error: 'pvPortZalloc' was not declared in this scope web_server:388: error: 'pvPortZalloc' was not declared in this scope web_server.ino: In function 'void SdkWebServer_parse_urlparams(char, URL_Param*)': web_server:439: error: 'pvPortZalloc' was not declared in this scope 'pvPortZalloc' was not declared in this scope

On Thu, Dec 3, 2015 at 9:32 AM, Dave notifications@github.com wrote:

I am investigating your issue and will advise when I have an answer.

Here is what to do now: I have reviewed my SDK Web Server code (in the Eclipse IDE) and confirmed that two of the API headers are not used.

Comment out these two lines and recompile. My Arduino IDE sketch compiled without these two:

//#include "mem_manager.h" //#include "cont.h"

Regards,

Dave

— Reply to this email directly or view it on GitHub https://github.com/internetofhomethings/ESP8266-Arduino-Ide-Web-Server-Using-SDK-API/issues/1#issuecomment-161509019 .

Thanks and Regards, Santosh Jha 8197239206

internetofhomethings commented 8 years ago

Here is what I have discovered:

First, I installed Arduino IDE version 1.6.5 on a different PC that was clean of any other software. With that setup, I was able to duplicate your errors.

There were two issues.

1) I forgot to include the library "webserver". It has been added to Github, This library includes the missing mem_manager.h file. Setup step 3 in the Readme.md file has been added for installation of that folder. (With this change, you can un-comment out those two header lines in the sketch or simply copy the updated version from GitHub.

2) The Arduino IDE did not find the EspressIf Library function "pvPortZalloc". This has been corrected in the sketch (GitHub version corrected) by adding the following prototype:

void * pvPortZalloc(int size);

I think that generated errors with your compile because I have the EspressIf SDK installed on my computer but you do not. But with these changes, you should be able to get a clean compile, without the SDK. I did on the clean PC and downloaded it to an ESP8266 and verified it's functionality.

Please let me know if this resolves your issues.

Santosh1971 commented 8 years ago

Hurrey! It is successfully getting compiled.. Now I will check the functions!

Thanks Dave for going extra mile to help me out!. I really appreciate it!.

Best Regards, Santosh

On Fri, Dec 4, 2015 at 6:30 AM, Dave notifications@github.com wrote:

Here is what I have discovered:

First, I installed Arduino IDE version 1.6.5 on a different PC that was clean of any other software. With that setup, I was able to duplicate your errors.

There were two issues.

1) I forgot to include the library "webserver". It has been added to Github, This library includes the missing mem_manager.h file. Setup step 3 in the Readme.md file has been added for installation of that folder. (With this change, you can un-comment out those two header lines in the sketch or simply copy the updated version from GitHub.

2) The Arduino IDE did not find the EspressIf Library function "pvPortZalloc". This has been corrected in the sketch (GitHub version corrected) by adding the following prototype:

void * pvPortZalloc(int size);

I think that generated errors with your compile because I have the EspressIf SDK installed on my computer but you do not. But with these changes, you should be able to get a clean compile, without the SDK. I did on the clean PC and downloaded it to an ESP8266 and verified it's functionality.

Please let me know if this resolves your issues.

— Reply to this email directly or view it on GitHub https://github.com/internetofhomethings/ESP8266-Arduino-Ide-Web-Server-Using-SDK-API/issues/1#issuecomment-161841260 .

Thanks and Regards, Santosh Jha 8197239206

Santosh1971 commented 8 years ago

the SDK API works at lightning speed!! I tested this with ESP8266-01 , LED on GPIO2. It works great!

Once again thanks Dave. Regards, Santosh

On Fri, Dec 4, 2015 at 7:59 AM, Santosh Kr. jha jha.santosh.kr@gmail.com wrote:

Hurrey! It is successfully getting compiled.. Now I will check the functions!

Thanks Dave for going extra mile to help me out!. I really appreciate it!.

Best Regards, Santosh

On Fri, Dec 4, 2015 at 6:30 AM, Dave notifications@github.com wrote:

Here is what I have discovered:

First, I installed Arduino IDE version 1.6.5 on a different PC that was clean of any other software. With that setup, I was able to duplicate your errors.

There were two issues.

1) I forgot to include the library "webserver". It has been added to Github, This library includes the missing mem_manager.h file. Setup step 3 in the Readme.md file has been added for installation of that folder. (With this change, you can un-comment out those two header lines in the sketch or simply copy the updated version from GitHub.

2) The Arduino IDE did not find the EspressIf Library function "pvPortZalloc". This has been corrected in the sketch (GitHub version corrected) by adding the following prototype:

void * pvPortZalloc(int size);

I think that generated errors with your compile because I have the EspressIf SDK installed on my computer but you do not. But with these changes, you should be able to get a clean compile, without the SDK. I did on the clean PC and downloaded it to an ESP8266 and verified it's functionality.

Please let me know if this resolves your issues.

— Reply to this email directly or view it on GitHub https://github.com/internetofhomethings/ESP8266-Arduino-Ide-Web-Server-Using-SDK-API/issues/1#issuecomment-161841260 .

Thanks and Regards, Santosh Jha 8197239206

Thanks and Regards, Santosh Jha 8197239206

saroz123 commented 8 years ago

Arduino: 1.6.6 Hourly Build 2015/07/07 05:42 (Windows 7), Board: "Arduino Pro or Pro Mini, ATmega328 (5V, 16 MHz)"

web_server.ino:11:25: fatal error: ESP8266WiFi.h: No such file or directory compilation terminated. Error compiling.

guys please help me out from this error.

internetofhomethings commented 8 years ago

The sketch is designed to work with an ESP8266, not an ATmega328 Arduino.

I am not sure if the calls to the ESP8266 SDK can be modified to work with an Arduino board.

I'll look into it and comment here Monday when I return from weekend activities.

saroz123 commented 8 years ago

Dear Dave, Thank you! Last time i forget to select the "Generic ESP826 Module" option on TOOLS.But now also having some other error. Im using Arduino-nightly 1.6.6 apps. Please share me connection circuit pins. Want to select any other thing ?

Arduino: 1.6.6 Hourly Build 2015/10/14 10:42 (Windows 7), Board: "Generic ESP8266 Module, Serial, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck"

C:\Users\Saravanan\Documents\Arduino\libraries\web_server\web_server.ino:12:30: fatal error: UtilityFunctions.h: No such file or directory

include

                          ^

compilation terminated.

exit status 1 Error compiling.

internetofhomethings commented 8 years ago

Hi Santosh,

The sketch presented was compiled using Arduino IDE 1.6.5, but I suspect it should also compile with 1.6.6.

Please note the readme.me setup step 2:

"Copy the UtilityFunctions folder to your Arduino libraries folder."

The libraries folder is normally set by the Arduino IDE to be a sub-folder of the sketch folder. From your comment, your sketch is located at:

C:\Users\Saravanan\Documents\Arduino\libraries\web_server\

Normally, you would expect the files to be located as follow:

Sketch" C:\Users\Saravanan\Documents\Arduino\web_server\

Library: C:\Users\Saravanan\Documents\Arduino\libraries\UtilityFunctions\

I suggest checking your sketch fold setting from the Arduino IDE menu "File>Preferences".

If set to C:\Users\Saravanan\Documents\Arduino, then the sketch and libraries need to be installed in the folders noted above.

The schematic ("connection circuit pins") is shown in this post:

http://wp.me/p5NRQ8-8y

Please note that the LED on GPIO16 is missing on the schematic, but is really not needed for the web server to function. However, if you want to include it, the GPIO16 to LED connection is shown as part of the schematic in this post: http://wp.me/p5NRQ8-ev.

Just one more thing; From your comment, it was not clear to me whether you are using an ESP8266 or an Arduino ATmega328. This sketch will only work with an ESP8266.

Have fun with this!

Dave

saroz123 commented 8 years ago

Dear Dave, Thank you Im using esp8266-01, can you please share me circuit diagram for ESP-01 version

internetofhomethings commented 8 years ago

esp8266-01

Attached is a schematic for an ESP8266-01. If you already have a working ESP8266-01 setup, all you would need is the LED and resistor. Since the ESP8266-01 only provides access to GPIO00 and GPIO02, you need to be aware of a few things:

  1. The web_server sketch uses GPIO16. I changed this in the attached schematic to GPIO02. This change requires the sketch line:

    define LED_IND 16

    to be revised to:

    define LED_IND 2

  2. The AIO and the GPIO used to control the AMUX are not accessible with the 8-pin ESP8266-01. The sketch should still work, but keep in mind that the analog readings when using the ESP8266-01 are internal only. But for the purposes of the web_server example, this should be irrelevant.
  3. I do not know what your flash memory size is.I am using a 4M x 8bit (32M bit) flash chip. The sketch may load and run just fine with your ESP8266-01, or it may have insufficient memory if a smaller flash chip is installed. Recommendation: Just try it and see what happens.
saroz123 commented 8 years ago

thank you

Santosh1971 commented 8 years ago

Hello Dave, How are you? Do you have plan to integrate the Webconfig features in your webserver & MQTT program to select the WiFi SSID and password on the fly? Also I am trying to connect MEGA with ESP8266-01 serially, to get more IO for my home automation project. Can you advise as to where and how to integrate the serial transmit and receive function in your Webserver example? Thanks in advance.

internetofhomethings commented 8 years ago

Hi Santosh, I am doing just great! Busy as usual.

Yes, I was planning to integrate the Webconfig features in my webserver , to select the WiFi SSID and password on the fly. Just haven't gotten around to it...yet. I expect to get those features started and working in the next few weeks (perhaps finished early next year). Kinda got side-tracked, I have been working on a triple-protocol server (it was a request). Look for that post to come out soon.

Regarding your plans to connect an Arduino MEGA to an ESP8266:

Hardware is simple as you must already know. It only requires 3 connections...

  1. MEGA Tx to ESP8266 Rx
  2. MEGA Rx to ESP8266 Tx
  3. MEGA Gnd to ESP8266 Gnd

NOTE: Some folks do not bother, but I always uses a 3.3V zener shunt from a standard serial Tx that is connected to ESP8266 Rx. See the schematic I had sent to you. This protects the ESP8266 since it is only a 3.3V device and the standard serial is 5V.

As for the software, you will likely want to access the ESP8266 using the AT command set. You might want to have a look at this post of mine:

http://wp.me/p5NRQ8-hf

Using that code on the ESP8266, you get both the AT command set accessible from the MEGA and access to the ESP8266 Web Server, with the ability to add as many custom server commands needed to read and write to all the MEGA I/O. In any event, you will need to develop a serial server in the MEGA sketch. This server would detect commands received over the serial interface to set MEGA outputs or to read and return MEGA inputs back to the ESP8266 Web Server,

And if you just want to set up a web server on the MEGA to interface with the Internet via the ESP8266 WIFI using the serial interface, without an ESP8266 server, that can also be done with just the standard AT command set the ESP8266 supports (with it's original firmware installed, or the code from the post I referenced above). Here is a simple example of how to do it:

http://blog.huntgang.com/2015/01/20/arduino-esp8266-tutorial-web-server-monitor-example/

Hope that helps.

Just curious. How many devices are you currently controlling/monitoring with your home automation system?

Santosh1971 commented 8 years ago

Looks like Large file like photos cannot be sent, again re sending

Thanks Dave for your detailed reply. Nice to know that you will be working on webconfig, which I will be using in my project. I want to do all server related activities in ESP only and will use MEGA for the local control only. like switching the light ,FAN etc. This is the electrical switch panel. Pl. find attached the photographs. currently I am controlling 4 loads and one FAN with speed up/dn control in each panel. Panel can be connected through DALI interface also( software yet to be written). I saw your dual server post, I could have used it, but it will be compiled in SDK, which I don't know. Can you make it such a way that I can compile it in Arduino IDE. Then only I can use it.

you can see the photographs here:-

https://youtu.be/zR4iCT1y3mU

On Fri, Dec 18, 2015 at 9:01 AM, Santosh Kr. jha jha.santosh.kr@gmail.com wrote:

Looks like Large file like photos cannot be sent, again re sending

Thanks Dave for your detailed reply. Nice to know that you will be working on webconfig, which I will be using in my project. I want to do all server related activities in ESP only and will use MEGA for the local control only. like switching the light ,FAN etc. This is the electrical switch panel. Pl. find attached the photographs. currently I am controlling 4 loads and one FAN with speed up/dn control in each panel. Panel can be connected through DALI interface also( software yet to be written). I saw your dual server post, I could have used it, but it will be compiled in SDK, which I don't know. Can you make it such a way that I can compile it in Arduino IDE. Then only I can use it.

you can see the photographs here:-

https://youtu.be/zR4iCT1y3mU

On Fri, Dec 18, 2015 at 8:40 AM, Santosh Kr. jha <jha.santosh.kr@gmail.com

wrote:

Looks like Large file like photos cannot be sent, again re sending

Thanks Dave for your detailed reply. Nice to know that you will be working on webconfig, which I will be using in my project. I want to do all server related activities in ESP only and will use MEGA for the local control only. like switching the light ,FAN etc. This is the electrical switch panel. Pl. find attached the photographs. currently I am controlling 4 loads and one FAN with speed up/dn control in each panel. Panel can be connected through DALI interface also( software yet to be written). I saw your dual server post, I could have used it, but it will be compiled in SDK, which I don't know. Can you make it such a way that I can compile it in Arduino IDE. Then only I can use it.

you can see the photographs here:-

https://youtu.be/zR4iCT1y3mU

On Fri, Dec 18, 2015 at 8:27 AM, Santosh Kr. jha < jha.santosh.kr@gmail.com> wrote:

Thanks Dave for your detailed reply. Nice to know that you will be working on webconfig, which I will be using in my project. I want to do all server related activities in ESP only and will use MEGA for the local control only. like switching the light ,FAN etc. This is the electrical switch panel. Pl. find attached the photographs. currently I am controlling 4 loads and one FAN with speed up/dn control in each panel. Panel can be connected through DALI interface also( software yet to be written). I saw your dual server post, I could have used it, but it will be compiled in SDK, which I don't know. Can you make it such a way that I can compile it in Arduino IDE. Then only I can use it.

On Fri, Dec 18, 2015 at 7:52 AM, Dave notifications@github.com wrote:

Hi Santosh, I am doing just great! Busy as usual.

Yes, I was planning to integrate the Webconfig features in my webserver , to select the WiFi SSID and password on the fly. Just haven't gotten around to it...yet. I expect to get those features started and working in the next few weeks (perhaps finished early next year). Kinda got side-tracked, I have been working on a triple-protocol server (it was a request). Look for that post to come out soon.

Regarding your plans to connect an Arduino MEGA to an ESP8266:

Hardware is simple as you must already know. It only requires 3 connections...

  1. MEGA Tx to ESP8266 Rx
  2. MEGA Rx to ESP8266 Tx
  3. MEGA Gnd to ESP8266 Gnd

NOTE: Some folks do not bother, but I always uses a 3.3V zener shunt from a standard serial Tx that is connected to ESP8266 Rx. See the schematic I had sent to you. This protects the ESP8266 since it is only a 3.3V device and the standard serial is 5V.

As for the software, you will likely want to access the ESP8266 using the AT command set. You might want to have a look at this post of mine:

http://wp.me/p5NRQ8-hf

Using that code on the ESP8266, you get both the AT command set accessible from the MEGA and access to the ESP8266 Web Server, with the ability to add as many custom server commands needed to read and write to all the MEGA I/O. In any event, you will need to develop a serial server in the MEGA sketch. This server would detect commands received over the serial interface to set MEGA outputs or to read and return MEGA inputs back to the ESP8266 Web Server,

And if you just want to set up a web server on the MEGA to interface with the Internet via the ESP8266 WIFI using the serial interface, without an ESP8266 server, that can also be done with just the standard AT command set the ESP8266 supports (with it's original firmware installed, or the code from the post I referenced above). Here is a simple example of how to do it:

http://blog.huntgang.com/2015/01/20/arduino-esp8266-tutorial-web-server-monitor-example/

Hope that helps.

Just curious. How many devices are you currently controlling/monitoring with your home automation system?

— Reply to this email directly or view it on GitHub https://github.com/internetofhomethings/ESP8266-Arduino-Ide-Web-Server-Using-SDK-API/issues/1#issuecomment-165648866 .

Thanks and Regards, Santosh Jha 8197239206

Thanks and Regards, Santosh Jha 8197239206

Thanks and Regards, Santosh Jha 8197239206

Thanks and Regards, Santosh Jha 8197239206

internetofhomethings commented 8 years ago

Hi Santosh, Since you want to "...do all server related activities in ESP", I put an example together for you at https://github.com/internetofhomethings/Arduino-to-ESP8266-Server

Here you will find a modified version of web_server that will interfaces with your Arduino via a serial port. I only had an Arduino nano available to test it but the Arduino sketch should also work with a MEGA. You might still be able to use SoftwareSerial, but I would take advantage of one of the hardware serial ports available on the MEGA. The SoftwareSerial does not perform well at any significant baud. I had to slow things down to 1200 baud for reliable operation. But remember, if you use a hardware serial port instead of SoftwareSerial, the ESP8266 serial link will also need to be adjusted if you increase the baud rate.

For a simple test, I put an LED on pin 4 of my nano and was able to set it on/off from a web browser as described in the readme.md file.

From this code, you should have a good idea on how to expand the server to support analog channel reads and any other sensors you might connect to your MEGA.

Santosh1971 commented 8 years ago

Thanks Dave for your efforts. I implemented the same for MEGA and it is working fine. I have yet to implement the analogue readings and fan speed parameter exchange. Now I have only webconfig remaining to complete my product. Thanks again Regards Santosh On 19 Dec 2015 09:23, "Dave" notifications@github.com wrote:

Hi Santosh, Since you want to "...do all server related activities in ESP", I put an example together for you at https://github.com/internetofhomethings/Arduino-to-ESP8266-Server

Here you will find a modified version of web_server that will interfaces with your Arduino via a serial port. I only had an Arduino nano available to test it but the Arduino sketch should also work with a MEGA. You might still be able to use SoftwareSerial, but I would take advantage of one of the hardware serial ports available on the MEGA. The SoftwareSerial does not perform well at any significant baud. I had to slow things down to 1200 baud for reliable operation. But remember, if you use a hardware serial port instead of SoftwareSerial, the ESP8266 serial link will also need to be adjusted if you increase the baud rate.

For a simple test, I put an LED on pin 4 of my nano and was able to set it on/off from a web browser as described in the readme.md file.

From this code, you should have a good idea on how to expand the server to support analog channel reads and any other sensors you might connect to your MEGA.

— Reply to this email directly or view it on GitHub https://github.com/internetofhomethings/ESP8266-Arduino-Ide-Web-Server-Using-SDK-API/issues/1#issuecomment-165943374 .