![icon](/images/bestBig.png)
Smoke and methane detection with FireBeetle 2 ESP32-C6 and Alvik robot
Methane gas and smoke pose significant risks, especially in enclosed spaces. But what if we could deploy a smart robot that not only detects these hazards but also transmits real-time information? Enter the Alvik robot, equipped with MEMS Smoke and Methane sensors.
Methane gas leaks and smoke outbreaks can occur unexpectedly, endangering lives and property. Traditional methods of monitoring rely on human inspection, which can be slow and inefficient.
In this experimental/educational project we will send a robot to do the work for us.
![](https://dfimg.dfrobot.com/61409c2aaa9508d63a416e93/community/54f24b71648f572c9a022b71e169c09b.jpg)
Parts required
FireBeetle 2 ESP32-C6 IoT Development Board
Beetle ESP32 C6 Mini Development Board
2.0" 320x240 IPS TFT LCD Display with MicroSD Card
Fermion: MEMS Methane CH4 Gas Detection Sensor
Circuit
![](https://dfimg.dfrobot.com/61409c2aaa9508d63a416e93/community/247681e6a1f11a42b3fa66518b127359.png)
For the receiver part we will connect a GDI cable between the FireBeetle 2 ESP32-C6 IoT Development Board and the 2.0" 320x240 IPS TFT LCD Display
For the sender part we will create an Y cable to use 1 VCC and 1 GND for 2 sensors. Then we will connect A3 to the Smoke A pin and A4 to the Methane gas A pin.
Finally we will power the Beetle ESP32 C6 Mini Development Board with the VIN and GND from Alvik.
ESPNow link
We will connect the ESP32-C6 and the ESP32-C6 mini with ESPNow and for that purpose we will have to configure the MAC address in the sender code.
uint8_t broadcastAddress[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
To obtain the MAC address upload the code to the ESP32-C6 receiver and open Serial Monitor. The Mac will be printed there.
Logo screen for TFT Display
![](https://dfimg.dfrobot.com/61409c2aaa9508d63a416e93/community/381a4a3df593b4659239f0e164e83134.png)
For the logo screen I asked Copilot for a logo and then added some texts and 240x320 resize with Photopea. Finally I have converted the bmp to Arduino code with https://javl.github.io/image2cpp/ selecting Swap and Invert options.
Source code
There are 3 pieces of code in this project. MicroPython to move the robot avoiding obstacles. C++ for the Beetle ESP32 C6 Mini to read sensors and send the information to the screen device. And another C++ for the receiving screen device using Firebeetle 2 Beetle ESP32 C6.
Source code at https://github.com/ronibandini/Alvik/tree/main/smokegas
Alvik setup
Using Arduino Labs for Micrpython, connect to the Alvik COM and transfer Alvik.py Then edit main.py to include Alvik.py
For this project I wanted to explore the connection between Beetle ESP32 C6 Mini and Firebeetle 2 Beetle ESP32 C6 but it could be possible to connect the sensors directly to the Alvik’s Nano ESP32 board through Grove I2C cable and remove the C6 mini as well. I will explore this options in further projects.
Pictures
Alvik with 2 sensors mounted.
![](https://dfimg.dfrobot.com/61409c2aaa9508d63a416e93/community/c5d8cd5215cbe7969062821e4c38270a.jpg)
Receiver screen with a simple 3d printed stand.
![](https://dfimg.dfrobot.com/61409c2aaa9508d63a416e93/community/1cb2265548e9362fd1fbc8ffa321397e.jpg)
Where to go from here
One enhancement should be integrating the functions of the small beetle ESP32 with the On Board Arduino Nano ESP32. The receiver script will use microPython. Check my Remote Control for Alvik as an example.
Then, a grove cable could be used to receive sensors data.
D11 A4
D12 A5
Finally, it would be interesting changing the robot's behaviour according to sensor levels as well.
Final notes
![](https://dfimg.dfrobot.com/61409c2aaa9508d63a416e93/community/b829c72a6d649fcb933e0a45c0671afd.png)
FireBeetle 2 ESP32-C6 and Beetle ESP32 C6 Mini Development Boards are excellent choices for IoT projects. They come packed with features and offer an incredible price point. Integrating a screen is as simple as connecting a basic GDI cable. As demonstrated in this project, they are also well-suited for robotics.
![licensBg](/images/license_bg.png)