1

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.

asked Apr 22, 2019 at 14:46
12
  • Is MIT AppInventor something that runs locally on a device or computer on your network, or something that runs on a website somewhere? Commented Apr 22, 2019 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. Commented Apr 22, 2019 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. Commented Apr 22, 2019 at 14:59
  • 1
    did you try to access the page from a browser on the phone? Commented Apr 22, 2019 at 16:55
  • 1
    Can Yo post. aia file? Many thx in advance. Tom Commented Jul 22, 2021 at 18:41

1 Answer 1

1

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

answered Apr 23, 2019 at 8:55
1
  • 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 Commented Apr 23, 2019 at 19:54

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.