453 Use your Arduino and ESP32/ESP8266 from your Smartphone. No Cloud! (RemoteXY)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
We all love Microcontrollers and Smartphones. Unfortunately, they do not work well together because not everybody can create Smartphone apps and connect them via Bluetooth or Wi-Fi to an ESP32. Arduinos are even more complicated because they do not offer communication. This is why I like the project I will show you today: Its name is RemoteXY. Of course, it uses the Arduino IDE! Grüezi YouTubers. Here is the guy with the Swiss accent. With a new episode and fresh ideas around sensors and microcontrollers. Remember: If you subscribe, you will always sit in the first row. The project is not new but well maintained. It runs on Android and IOS and supports Arduinos, ESP8266s and ESP32s, and even NRF51822s. And it supports Bluetooth and Wi-Fi, but also Ethernet and even USB via OTG. And very important: It does not need a cloud to work. So let’s check it out: - First, we will get an overview to understand its architecture - Then, we will create an example with an ESP32 and BLE - Next, we will use an ESP8266 with Wi-Fi instead of BLE - Finally, we will read the temperature and humidity and draw a graph on the screen of our Smartphone using an Arduino UNO and a BLE module The homepage of RemoteXY is made to attract kids. I assume they want to show that the project is easy to use. And this is the case. But how is this achieved? In three steps: After starting our first project, we must select the connection, the MCU, the communication module, and the IDE we want to use. For the connection, the most valuable possibilities are BLE and Wi-Fi because they are wireless. Ethernet and USB are “good to have” if we have particular problems to solve. Cloud is not too important to me. There, we have many other possibilities available. So I will concentrate on BLE and Wi-Fi. These two protocols match exceptionally well with Smartphones. We will start with BLE, an ESP32 board, and BLE on the chip. We can only choose supported combinations. An ESP32 with Ethernet like this board, for example, is not possible. I name our new device “YouTube1.” In the second step, we can create our user interface. Here we have three essential categories plus “decorations.” The first category is controls, where we can input something. Then we have sensors where we can measure parameters. Here we only have sensors the Smartphone provides, like a compass or an accelerometer. As we will later see, all other sensors will be attached to the MCU. The third category, the indicators, display values. One particular indicator creates sounds. Let’s drag and drop a switch to the display and “snap” it to pin 5 of the MCU. To add more “beef,” I add a compass as a sensor and an instrument to show the Smartphone's position. Because the compass has 360 degrees, I change the instrument to match. I also hide the sensor because I do not want to see it. That is all. As the third step, we create the source code for the Arduino IDE. Let’s examine the code and concentrate on setup() and loop(). Both only contain two statements. And a warning not to use delay() in the loop. Extremely simple! In setup(), we find the initialization of RemoteXY, and pin 5 is defined as “output.” In loop(), RemoteXY is executed, and pin 5 is switched according to the position of the switch. Extremely easy to understand. So we can continue. We know how to get an Arduino sketch to an ESP32. But how to get the display to the Smartphone? It is easier than you think. Let’s do the obvious. We download the sketch, open the ino file, select the ESP32dev Module, and install the RemoteXY library. Then, as usual, we compile and upload the sketch. Now the ESP32 should run. For the Smartphone, we have to download the RemoteXY app and start it. Now we have to add a new device. Because our project uses Bluetooth, we select BLE and immediately get our ESP32 with its name “YouTube1” presented. We select it, and surprise: Our display arrived on our Smartphone! How did this happen? The information about the display is in these 65 bytes. They are stored on the ESP32 and read from there when we start the Smartphone app. An excellent idea! If we change the layout, we only have to copy-paste this array and get the new positions. And if we use a second Smartphone, it also will know the layout. Let’s check if we can switch our LED. Yes, the LED connected to pin 5 can be switched from the Smartphone. Cool! And what about the compass? Here we are less successful. The instrument does not move when I turn the Smartphone. Fail! Let’s have a look at the sketch. Here we find the input and here, the output variables. As expected, we find switch_1 as input. And we find compass_1 as a variable from 0 to nearly 360 degrees. On the output, we find instrument_1. Also from 0 to 360. So we only need to program the missing link. And because all variables are part of the structure RemoteXY, we have to add this line in loop(). Now the instrument knows what to display. After uploading and restarting YouTube1, our instrument works. Problem solved. Here you see that you must buy a professional version if you want to use more than five elements in your app. The prices are here. I think this is a good way to support the project if you use it for a productive case. For me, BLE and the ESP32 this is the best way to use this app. If you want to use an ESP8266, you must use Wi-Fi because this chip does not offer BLE. Also, here, we select Wi-Fi on chip. To show a simple scenario, I use a Wemos D1 with a relay. We leave the rest of the project. Just the pin for my relay is D7. After downloading and opening the ino file with the Arduino IDE, we see the credentials of the Access Point created by the ESP8266. I change its SSID to YouTube2 and insert the same line to pass the compass reading to the instrument. Other than with BLE, we first must connect to the YouTube2 Wi-Fi network. Now we can connect the app and switch the relay as expected. The instrument also works. I like this project because it is very modular and allows us to change components without hassle. As a last scenario, we use BLE with an Arduino Uno. RemoteXY suggests using an HC-05 or an HM-10 module. Because I happen to have an HM-10 in my boxes, I connect it to pins 3 and 4 of the Arduino UNO. And with this project, I want to measure temperature and humidity using a DHT11. And because we can, we add a curve for temperature and humidity to our Smartphone screen. To do that, I install Adafruits DHT11 library and open its example file. This file suggests using pin 2 for my DHT11. This pin happens to be free on my Arduino. What a coincidence! So we quickly test if everything works. Yes, we get the values, and if I heat the sensor with hot air, the temperature rises, and the humidity falls. Now we download our RemoteXY sketch and place it in parallel on one screen. Like that, we can copy all needed lines from our DHT11 example to the RemoteXY sketch. Finally, it is here. We had to do the same as before: Replace the values in the structure RemoteXY with those measured by the DHT11. And we had to convert the float variable into an array of characters. After uploading, we can add a device called HMsoft. And here is our nice-looking app that displays temperature and humidity. To show you a trick, I use this bottle of pressured air. When turned upside down, it sprays freezing air against the DHT11. You see, the temperature falls fast. This can be used to cool hot glue, for example. Like that, it hardens very fast. As a last step, I add a frame to show you what happens if you pass the 5 elements of the free version. With the frame, we have six elements. The app still works, but only for 30 seconds. Then it stops. So today - We saw an excellent and very well-made app that connects our Smartphone to various MCUs - It is easy to use and ran stable during my tests - As a first scenario, we used BLE to connect an ESP32 - We switched an LED on the ESP32 according to the position of a switch on the display of the Smartphone - We could also read the compass of the Smartphone and display its direction. Of course, we could have used this value in our ESP32 sketch - We converted the same app to Wi-Fi to use it with an ESP8266 because this chip does not offer BLE - And we connected an HM-10 BLE module and a DHT11 temperature and humidity sensor to an Arduino UNO and wrote an app to display the values as well as a graph - During all these examples, we saw how easy it is to integrate a Smartphone into our sketches - For bigger projects, we have to buy the professional version. Which is ok if we can support the project to get updates also in the future That was all for today. As always, you find all the relevant links in the description. I hope this video was useful or at least interesting for you. If true, please consider supporting the channel to secure its future existence. Thank you! Bye
Info
Channel: Andreas Spiess
Views: 162,411
Rating: undefined out of 5
Keywords:
Id: dyEnOyQS1w8
Channel Id: undefined
Length: 12min 21sec (741 seconds)
Published: Sun Apr 16 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.