Sending Web requests from my Web server to my IoT device

0 votes

Let's say that I have a development board with a WiFi module connected to my electric water heater. It could be an Arduino or an RPi or an esp8266 or any such board. Now, when I return from my work, I want the water to be ready for my bath. The only thing I do is visit mywaterheater.herokuapp.com/manage/ on my smartphone and press the button named activate. Then, the development board receives a Web request from an User-agent instantly and activates the relay to turn on my water heater. Can this be done?

Let's also assume that my security issues have been taken care of and my authentication/authorization is in place. I'm guessing my development board needs to be turned into a router to listen for Web requests (GET, POST, PUT).

Jan 8, 2019 in IoT (Internet of Things) by Bharani
• 4,660 points
1,843 views

1 answer to this question.

0 votes

You need to start an HTTP server on the development board to listen for HTTP requests and you could have multiple options depending on the type of your board, like say: NodeMcu firmware for ESP8266 has built-in HTTP server; Web Server with Arduino and Ethernet Shield; Many different choices for Raspberry Pi. After the server has been enabled on your board, it will start listening for incoming requests on the specified IP and port. Assuming that your board is in your local network, you'll need to set up port forwarding to that IP:port on your router. Also, for accessing your board from the Heroku application, you'll be needing an external IP from your service provider. Next, the HTTP client must be added to your Heroku application for sending requests to your board. You'll have a lot of different options here as well. For instance, if your app is written in Python, you can use Requests library for the same. Finally, upon pressing a button on a web page served by Heroku, the HTTP client from your application sends a request to the IP address of your router. And, because of port forwarding on the router, it should reach the HTTP server on your development board.

answered Jan 8, 2019 by nirvana
• 3,130 points

Related Questions In IoT (Internet of Things)

0 votes
1 answer

Testing if messages from my Device is reaching the Azure IoT Hub?

Download the Device Explorer open source tool ...READ MORE

answered Aug 10, 2018 in IoT (Internet of Things) by DataKing99
• 8,240 points
3,408 views
0 votes
1 answer

Server connection to iot device

It depends on the kind of socket, ...READ MORE

answered Oct 3, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
1,330 views
0 votes
1 answer
0 votes
1 answer

Azure IoT: Message from cloud to device using Rest API

Firstly, If you get No content response(error ...READ MORE

answered Dec 31, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,735 views
0 votes
1 answer

Building Python Server for Secure communication with Raspberry Pi

There could be several ways to add ...READ MORE

answered Jan 11, 2019 in IoT (Internet of Things) by DataKing99
• 8,240 points
1,839 views
0 votes
1 answer

What kind of server is used by IoT?

So, IoT does not really need a ...READ MORE

answered Jan 28, 2019 in IoT (Internet of Things) by Shubham
• 13,490 points
443 views
0 votes
0 answers

Android - How to download a file from a webserver

I'm getting a kml file from a ...READ MORE

Nov 22, 2022 in Android by Edureka
• 12,690 points
518 views
0 votes
1 answer
0 votes
1 answer

Connect to external server through Socket.IO from Node.js

I think the server you're connecting to ...READ MORE

answered Nov 21, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
14,835 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP