I am totally new in the world of programming so I already appologize if I ask real beginner questions.
I have a project to read and transfer a liquid level from a water tank located 800m from my house. I use home assistant and I want to display the water level in it.
I use 2 lilygo T-beam with meshtastic installed (installation from the web installer). I have already made some link test and it is fine. Right now I have an ultrasonic sensor connected on an ESP32 mini board. The ESP32 mini send the level mesured via a serial connection to one T-beam. The second T-beam is connected on my wifi with mqtt activated and the data appears in home assistant as expected. The emitting device (the one with the ultrasonic sensor) will be powered with a 18650 battery and a small 5V 1.2A solar pannel. To minimize the power consumption I want to integrate the ultrasonic directly on the T-beam. I will have to modify the meshtastic source code and integrate the sensor. I think it is a big project for a beginner. Can someone explain me how to do it? Is it the firmware I have to modify to integrate the ultrasonic sensor? I suppose I cannot directly integrate the esp32 mini arduino code in the meshtastic source code. What is the programation language of the meshtastic source code?
The sensor is a JSN-SR04T. You use one gpio as output pin to trigger the ultrasonic sensor and another gpio to read the pulse repply. The time betwenn the 2 pulses give you the distance. My idea will be to use the t-beam to generate and read the pulses. I want to make a reading every 30 minutes. The perfect world will be to have the t-beam in stand-by and wake up every 30 minutes, take the reading, sending it on meshtastic network and go back in sleep. It looks like that Arduino language is “similar” to c++ but which file from meshtastic source code should I modify to integrate the custom code?
Meshtastic works as the communication medium. But the actual ‘logic’ exists for interacting with sensor on a computer in the house.
ie connect the sensor directly to the TBeam, to minimise hardward at the battery end)
… a computer back at base, uses the other TBeam, to communiocate with the sensor, and perform the actual reading.
I have read the documentation and so far I understand the telemetry is working with I2C sensors. My ultrasonic sensor is controled by one gpio with a pulse of 50ms and another gpio read the response pulse. For non I2C sensors you need to use another mcu (which I try to avoid)
The remote hardware module is more promissing but I don’t know if it will work with such fast signal (50ms pulse IS fast). Not sure the transmission will be fast enough. I have to test. My problem is that the receiver at home is connected on my local network via wifi. I cannot plug directly an USB câble from my home assistant server. So if I cannot send the commands over wifi it will not work
The Not sure if the T-Beam itself has a multi-core ESP32? If so maybe you could run you custom code in the second core, with meshtestic in the first core.
I think the meshtastic fireware is ‘single core’, so the second would be spare. But I doubt adding a second core to the meshtastic firmware is going to be easy.
Sorry for the late reply but I wanted to be sure everything is working as expected.
So I found a solution without modifying the meshtastic code.
I use an ESP32 mini combined with an ultrasonic sensor JSN-SR04T sending the data to meshtastic via the serial interface every 15 minutes (then the ESP goes in deep sleep)
I use a T-beam without the screen (the ESP32 mini is attached at the screen position)
Meshtastic is configured in client_hidden mode with power saving activated and GPS desactivated
With this configuration I get a power consumption of 50mA. With a 3000mA 18650 battery attached I will have 40 hours of autonomy. With a 5V 1.2A solar panel attached it should work as expected.
I have only one more question concerning the power saving. Under the T-beam screen, there are 2 leds (one red and one blue). When I look the power consumption of my system I read 60mA and after 1 or 2 minutes it goes to 30mA but every minutes the 2 leds light up shortly and the power goes back to 60mA. Can someone explain me what are these 2 leds and is there a way to desactivate them (or the monitored function)?
Interesting article. So it looks like the blue led is for power. Why does it come on after a few minutes? I think it is the way meshtastic manage the power settings but changing the value change nothing. I think without modifying the code I cannot easily reduce more the power. 50mA is fine for me. It will last 40 hours on a 3000mA battery. Modifying the code is over my competences