We at techiesms studios, running a Series called AR with IoT and this is the fourth episode of that series. So till now we were easily able to control our Home Appliances over internet using Augmented Reality and Internet Of Things both using touch screen buttons and virtual buttons.
Now in this episode, we will try to read data from server and display that data in the Air using Augmented Reality.
Components Required
For Hardware part of the project you’ll need
- ESP32 / NodeMCU board
- DHT11 Sensor
For Software part you’ll need
- Blynk App
- Unity Hub
Hardware Connection Diagram
IoT part of the project
For the IoT part, I have used Blynk IoT Platform. In which, I just made a simple blynk project of displaying Temperature and Humidity data using Gauge widget. Here the temperature data is stored in virtual pin V0 and humidity data is stored in virtual pin V1
After that, we have made a code in which, the temperature data from DHT11 sensors gets pushed to virtual pin V0 and Humidity data is pushed to Virtual pin V1. You can copy and paste the code from below, just change the SSID name, Password and Blynk Auth token.
/*************************************************************
Download latest Blynk library here:
https://github.com/blynkkk/blynk-library/releases/latest
Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.
Downloads, docs, tutorials: http://www.blynk.cc
Sketch generator: http://examples.blynk.cc
Blynk community: http://community.blynk.cc
Follow us: http://www.fb.com/blynkapp
Tweets by blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how value can be pushed from Arduino to
the Blynk App.
WARNING :
For this example you'll need Adafruit DHT sensor libraries:
https://github.com/adafruit/Adafruit_Sensor
https://github.com/adafruit/DHT-sensor-library
App project setup:
Value Display widget attached to V5
Value Display widget attached to V6
*************************************************************/
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
/* Fill-in your Template ID (only if using Blynk.Cloud) */
//#define BLYNK_TEMPLATE_ID "YourTemplateID"
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <DHT.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
#define DHTPIN 2 // What digital pin we're connected to
// Uncomment whatever type you're using!
#define DHTTYPE DHT11 // DHT 11
//#define DHTTYPE DHT22 // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21 // DHT 21, AM2301
DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
float h = dht.readHumidity();
float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V1, h);
Blynk.virtualWrite(V0, t);
}
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
dht.begin();
// Setup a function to be called every second
timer.setInterval(1000L, sendSensor);
}
void loop()
{
Blynk.run();
timer.run();
}
Till this step, we will be easily able to monitor sensor’s data on the Blynk App. But we want to monitor that using API so that later on we can integrate it with AR. And the good news is that, Blynk do provide us APIs.
So to get the data to virtual pin of our blynk device, the format of API is something like this.
http://blynk-cloud.com/auth_token/get/pin
For example, If I want to read data from virtual pin ‘V1’ of my blynk project, the API will be like this,
http://blynk-cloud.com/MY_AUTH_TOKEN/get/V1
So with this, we have successfully covered the IoT part of our project. Now let’s jump on to the AR part.
AR part of project
For AR, we will be using Unity Hub software on our computer. Just goto this link and download unity hub

While Setting up unity, you’ll need four things, one is the target image, second is Button Image, third is Template Image and fourth is C# Script. All the things are provided below, so you can easily download and use them



using System.Collections;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Networking;
using Vuforia;
public class click : MonoBehaviour
{
InputField field;
InputField Hum;
public VirtualButtonBehaviour Vb_on;
void Start()
{
field = GameObject.Find("TextInputField").GetComponent<InputField>();
Hum = GameObject.Find("InputField1").GetComponent<InputField>();
Vb_on.RegisterOnButtonPressed(OnButtonPressed_on);
// GameObject.Find("GetButton").GetComponent<Button>().onClick.AddListener(GetData);
}
public void OnButtonPressed_on(VirtualButtonBehaviour Vb_on)
{
GetData_tem();
GetData_hum();
Debug.Log("Click");
}
void GetData_tem() => StartCoroutine(GetData_Coroutine1());
void GetData_hum() => StartCoroutine(GetData_Coroutine());
IEnumerator GetData_Coroutine1()
{
Debug.Log("Getting Data");
field.text = "Loading...";
string uri = "http://blynk-cloud.com/vKqIp55UdG2GoZcvY3un4sPyQpoxgnG3/get/v0";
using(UnityWebRequest request = UnityWebRequest.Get(uri))
{
yield return request.SendWebRequest();
if (request.isNetworkError || request.isHttpError)
field.text = request.error;
else
{
field.text = request.downloadHandler.text;
field.text = field.text.Substring(2,2);
}
}
}
IEnumerator GetData_Coroutine()
{
Debug.Log("Getting Data");
Hum.text = "Loading...";
string uri = "http://blynk-cloud.com/vKqIp55UdG2GoZcvY3un4sPyQpoxgnG3/get/v1";
using(UnityWebRequest request = UnityWebRequest.Get(uri))
{
yield return request.SendWebRequest();
if (request.isNetworkError || request.isHttpError)
Hum.text = request.error;
else
{
Hum.text = request.downloadHandler.text;
Hum.text = Hum.text.Substring(2,2);
}
}
}
}
You need to save this code with the name, Click.cs
Full Tutorial
We have prepared a full detailed tutorial video for AR+IOT which is uploaded on YouTube. So in case you want to understand it in more clear manner, I’ll suggest you to go through this video and do let me know your feedback in comment section.
Next time I read a blog, Hopefully it won’t disappoint me as much as this particular one. After all, Yes, it was my choice to read through, nonetheless I genuinely thought you’d have something useful to say. All I hear is a bunch of whining about something you could possibly fix if you were not too busy seeking attention.
What’s up, this weekend is fastidious in support of me, because this moment i am reading this great informative paragraph here at my residence.
I was excited to discover this web site. I wanted to thank you for ones time for this wonderful read!! I definitely enjoyed every little bit of it and I have you saved as a favorite to check out new things on your site.
A big thank you for your blog article.Much thanks again.
The very next time I read a blog, I hope that it does not disappoint me just as much as this one. I mean, I know it was my choice to read, nonetheless I actually believed you’d have something helpful to say. All I hear is a bunch of complaining about something you could possibly fix if you were not too busy seeking attention.
I really enjoy the article post.Thanks Again. Fantastic.
Appreciate you sharing, great blog post. Great.
Appreciate you sharing, great article post.Much thanks again. Much obliged.
Very neat blog post.Really looking forward to read more. Fantastic.
Nice post. I learn something new and challenging on blogs I stumbleupon everyday. It will always be interesting to read content from other writers and use something from other sites.
Thanks again for the blog post.Thanks Again. Really Great.
I do agree with all of the ideas you’ve presented in your post. They’re really convincing and will definitely work. Still, the posts are very short for beginners. Could you please extend them a little from next time? Thanks for the post.
I’m amazed, I must say. Seldom do I come across a blog that’s both equally educative and engaging, and without a doubt, you’ve hit the nail on the head. The problem is something too few people are speaking intelligently about. I’m very happy I stumbled across this during my search for something relating to this.
Thank you for your article post.Really thank you! Much obliged.
It’s hard to come by well-informed people for this subject,however, you seem like you know what you’re talkingabout! Thanks
Great post about this. I’m surprised to see someone so educated in the matter. I am sure my visitors will find that very useful.
A fascinating discussion is worth comment. There’s no doubt that that you should publish more on this topic, it may not be a taboo subject but typically folks don’t talk about such issues. To the next! Kind regards.
I blog quite often and I seriously thank you for your information. Your article has really peaked my interest. I’m going to bookmark your blog and keep checking for new details about once per week. I opted in for your RSS feed too.
A round of applause for your article post.Thanks Again. Great.
I love what you guys are usually up too. This sort of clever work and exposure!Keep up the superb works guys I’ve incorporatedyou guys to my own blogroll.
I value the blog post. Want more.
Hi, after reading this remarkable post i am too glad to share my know-how here with friends.Here is my blog post :: Bionic Ultrasonic Pest Repeller
furosemide over the counter over the counter lasix at walmart Ret Mum
I loved your article.Thanks Again. Really Great.
You actually suggested it fantastically.essay customer service customer service writing ghostwriters for hire
Hi, I do think this is a great website. I stumbledupon it 😉 I will return yet again since i have book marked it. Money and freedom is the greatest way to change, may you be rich and continue to help others.
all the time i used to read smaller articles or reviews that as well clear their motive, and that is also happening with this post which I am reading now.
wow, awesome post.Really thank you!
When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get four e-mails with the same comment. Is there any way you can remove people from that service? Thanks!
Great, thanks for sharing this post.Really thank you! Really Cool.
Your mode of telling everything in this piece of writing is really pleasant, everyone be capable of easily be aware of it, Thanks a lot.
Excellent blog you’ve got here.. Itís difficult to find quality writing like yours these days. I honestly appreciate individuals like you! Take care!!
I appreciate you sharing this blog post. Will read on…
Thanks so much for the post.Really thank you! Cool.
Aw, this was an incredibly nice post. Taking a few minutes and actual effort to produce a great article… but what can I say… I procrastinate a whole lot and don’t manage to get nearly anything done.
I really liked your blog post. Awesome.
Good replies in return of this matter with firm arguments and telling the whole thing concerning that.
I think this is a real great blog post. Awesome.
Thanks a lot. An abundance of write ups.how to write essays for college thesis help assignment writer
I value the post.Thanks Again. Really Great.
Asking questions are really good thing if you are not understandinganything totally, but this paragraph provides goodunderstanding even.
I appreciate you sharing this article.Much thanks again.
A round of applause for your blog.Much thanks again. Really Great.
lihat selengkapnya
Major thanks for the post.Really thank you! Much obliged.
This website definitely has all of the information and facts I wanted concerning this subject and didn’t know who to ask.
Thanks a lot for the article post.Much thanks again. Awesome.
Good way of telling, and pleasant article toobtain facts on the topic of my presentation subject matter, which i am going to convey in academy.
online pharmacy worldwide shipping mail order pharmacy – us pharmacy
ivermectin brand stromectol for sale – stromectol liquid
Very informative article.Thanks Again. Awesome.
Looking forward to reading more. Great article post.Really thank you! Fantastic.
Really informative article.Really looking forward to read more.
I value the blog.Really thank you! Awesome.
Major thankies for the article.Much thanks again. Cool.
Awesome article post.Really thank you! Want more.
Thanks for the blog.Thanks Again. Really Great.
Sweet blog! I found it while searching on Yahoo News.Do you have any tips on how to get listed in Yahoo News? I’vebeen trying for a while but I never seem to get there!Thank you
Usually I do not learn article on blogs, however I would like to say that this write-up very compelled me to try and do so! Your writing taste has been surprised me. Thank you, quite great post.
ivermectin cream for scabies ivermectin oral solution