Deploy Arduino Red Node App on Web with Cloudflare Tunnel

arduino node red IoT demo

Here it is shown how one can easily and quickly deploy arduino red node application on the web using cloudflare tunnel. Node Red with Arduino, sensors and actuators is excellent IoT(Internet of Things) application creation platform. In the previous tutorial Node Red with Arduino Simple Example it was illustrated how Arduino and node red can be used together. In that tutorial the application was run on locally at IP address and port, 127.0.0.1:1880. 

Here the same example is used to deploy the IoT application on the web. That is make the node red build IoT application made publicly available. There are many methods that can be used to deploy red node application on the web. For example, one can deploy the application on a IoT cloud service provider such as IBM cloud, Arduino IoT cloud, AWS and others. The other way is to publish the Red Node application on a public domain name for which first a domain name and a full time hosting server are required.

Sometimes we want to publish it on the web for other to see while the IoT application is still being developed. This can be done easily without requiring one to buy a domain name and hosting server. That is the application can be made available on the web from the PC. This can be done using cloudflare tunnel. So in this red node tutorial it is demonstrated how one can simply use the cloudflare tunnel to publish the node red application on the public internet. 

To do this we have to download the clouldflare tunnel executable which can be downloaded from the following url.

https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation

You should download the appropriate executable depending on your operating system. Here the windows executable is used. 

Once downloaded, it is better to put in some new folder.


Then rename the application from cloudflared-windows-amd64 to simpler cloudflared.


Now open powershell in the same folder where you put the cloudflared tunnel application. Then type in the following command to start the tunnel. 

> .\cloudflared.exe tunnel --url localhost:1880

Then the application will create a secure tunnel from outside to your localhost at port 1880. You will be given a mapped url like

 https://andrew-lending-samsung-basin.trycloudflare.com

cloudflare tunnel for node red

 At this provided url the node red flow editor will be publicly available. To make the node red application publicly available we have to append /ui at the end of the given url as illustrated below.

https://andrew-lending-samsung-basin.trycloudflare.com/ui

But currently if you open this url the application will not show up because first we have run the node red application. To run the node red application, we open another command line interface(powershell or cmd) and type in node-red(if the node.js is installed and node-red is available globally set with environment variable).

run node red app

Before running the node red IoT application, make sure that Arduino USB is connected to the PC otherwise you might get error that there is no serial connection when you run the node-red application. 

After running the node red app, open a browser and paste in the url copied earlier into the browser bar. Then append /ui to see the Arduino IoT node red application. 

When the push button connected to the Arduino is pressed a LED is turned on and the node red application displays the state of the LED on the public url. 

arduino node red IoT demo

In this way we can quickly test and publish Arduino Node Red Internet of Things application on the web using cloudflare tunnel. The whole process described here is shown in the following video.

See other IoT application build with Red-Node as IoT framework.

- IR Proximity Sensor IoT Application

Post a Comment

Previous Post Next Post