The group's tasks: browse through the data sheet for your microcontroller and compare the performance and development workflows for other architectures fablab website.
The idea is to make a system based on the ESP32 camera, to monitor my room from Telegram. The ESP32 will connect to my home's Wi-Fi, while with a bot created in the Telegram application, we can order the ESP to take photos and send them to the bot.
As I already said, we will use the ESP32 cam module, a very powerful processor, which for a super affordable cost integrates in a very small size wifi, bluetooth, camera and many more, it also has a lot of community on the internet so it is quite easy to work with it.
To use the esp32 cam with the Arduino IDE it is not necessary to install any additional board, since in the latest versions of the program it comes by default, we just have to go to the board manager and select "Al Thinker ESP32-CAM".
If you are using an old version of the IDE, you must go to the preferences section and paste this line there to be able to install the board.
https://dl.espressif.com/dl/package_esp32_index.json
With the board selected, we are going to upload an example of "Blink" to make sure that we are able to program it. Unlike other development platforms, the ESP32 CAM does not have a USB port, so we must use an adapter to program it.
The first time I tried to upload the code I couldn't, the connection with the USB adapter was not well made, it is very important to make sure of this, otherwise it will be a cause of deep frustration. This image from profetolocka the correct way to connect.
Now, before starting to make the program, it is important to have the Telegram bot ready, as it will provide us with the information necessary to carry out the program. To create the Telegram bot we will search for BotFather in the application's search bar and follow the steps below.
The first parameter to enter in the BotFather is the name of the Bot that we want to create and then it will ask you for the username of your bot, which is how it can be searched in the search bar and must end in bot. Once this is done, the new bot will automatically be created and a TOKEN will be assigned to it (that is what we must copy to use later in our code)
Once this is done, then you have to search for the IDBot in the search bar and after starting, we select the "/getid" option. This ID is the other information we need in our ESP code to be able to link it to the Telegram bot.
For the ESP32 code it is necessary to have these libraries installed that will be used to work with the Telegram bot, manage the WIFI connection more easily, etc... All of these libraries are native to Arduino except UniversalTelegramBot, and this is the link to their documentation.
The code can be downloaded at this link, it is commented but still, we are going to explain some of the most important parts. With the libraries ready, the next step is to declare the name and password of your Wi-Fi, so that the ESP can connect. Then in idChat and token, we paste the information that we saved a while ago from Telegram.
In this fragment we are indicating to the ESP the data of the Wi-Fi to which it must connect and the Telegram bot with which it must be linked.
Finally we created the bot menu, where as you can see, in addition to taking a photo, you can also ask the bot for variables such as temperature and humidity, these are random values that I generate with the "random()" function, it seemed to me good idea to put them to incorporate these readings in the future.
To check what we have done, we look for the Bot on Telegram and take the first photo. The truth is that the quality is not very good but I imagine that with a little more light the quality will improve.
Here we can see the bot working perfectly.
To finish I decided to create a pcb so that the ESP was not in the air, so that it had a support point. Additionally, I put some sensors such as a DHT20 and an LDR and 2 other microcontrollers: an Arduino nano BLE and a Raspberry Pi Pico.
For this week it is only a physical support but I intend to continue working on this system in the projects of the coming weeks. The system is a model to test different technologies, apart from the obvious by containing an arduino, an esp_cam and a raspi, the model has an I2C connection between the arduino and the raspi, and the raspi in turn communicates with the esp_cam by UART . It will surely be useful in the coming weeks.In this link is the PCB design.