0

I hope I am posting this question in the right section. I am making a Smart Home Project for my college semester finals. I am using an Atmega328p microcontroller along with an ESP8266 (Esp 01). The Atmega328p controls all the sensors and actuators and sends the data to Esp01 via serial communication.

I have created a web server on the Esp01 which I plan to access by creating an app using MIT App Inventor. My GET request is of the format "http://192.168.43.42/4" where the digit at the end is data I want to send to the server and the response I get from the server is of the format "12&0&34.8" where the '&' is used to separate different values.

My problem is , when I access the server from Chrome in my laptop I get the desired response but when I access it using the App , I get an error "Error 1101 :Cannot find the specified URL". The Esp01 is connecting to a hotspot from my phone and I have checked the IP assigned to the Esp01 to ensure my GET request is correct.

The code for Esp01 in Arduino IDE is here : https://gist.github.com/TheMagicSmoke/467d6227d670697464038056e22f302d

The blocks for the app made in App Inventor is below: enter image description here

enter image description here

The GET request URL when entered from Chrome in laptop returns a blank page at first but upon refreshing Chrome I get the desired response I told earlier. And in the app , I have used a timer which queries the server with the same GET request every 2 seconds. But when I open the App the error keeps on popping up. Please suggest me a solution, I have googled this without any success.

  • Is MIT AppInventor something that runs locally on a device or computer on your network, or something that runs on a website somewhere? – Majenko Apr 22 at 14:50
  • I have edited the title as it seemed misleading. What I meant is that I am accessing the server using an Android app that was created using MIT App Inventor which is a website. – user151016 Apr 22 at 14:54
  • I'm finding it hard to find any concrete information, but it looks like the "app" on your phone may just be a front-end to the MIT web servers and the code actually runs on there, not your phone - which means that the code can't get at what is inside your network - only things that are on the internet. – Majenko Apr 22 at 14:59
  • You have misunderstood. The server is a local server which has been created on the esp8266. The application on my phone is sending a GET request to that server. Both my phone and the Esp8266 are on the same WiFi network. This has nothing to do with the servers at MIT. – user151016 Apr 22 at 15:04
  • 1
    did you try to access the page from a browser on the phone? – Juraj Apr 22 at 16:55
0

I have found out the solution to this problem. The code that I had written in the Arduino IDE for the Esp8266 was not correct for handling the GET request. It only accepted data as a simple Web Server and not as a HTTP server. I am posting the modified code below .

https://gist.github.com/TheMagicSmoke/adaae1e4d92f258c88184c8690e68f08

  • so I didn't look at your code (the first version). I expected that you used the WiFiWebServer example not a sketch, which expects data 10 milliseconds after connect, else it fails – Juraj Apr 23 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.