Description
Ok where to start?
I am building an solar powered ESP32 Beehive Scale. The main object of this scale will be to measure the weight, measure the tempreature, humidty and airpressure.
If the weight is under a specific value the esp will send a SMS to alert someone.
Also the esp32 will establish a wifi and a http connection to send the measurements to a php skript on a server .
This skript sends the data to a database from where it can be visualized on a website.
In my circuit i have 12V which is regulated to 5V for the esp32 and the scale (HX711).
Also I regulate the 12V to 3.3Volt (BME Temperature Sensor,HX 711, Display ILI9341) and to 4.1 Volt (SIM800L GSM Modul).
To be as low as I can when it comes to powerconsumption in deepsleep I switch all Voltages i don’t need of in deepsleep by using 3 relais.( Just the 5V going direct to esp32 5V Pin will stay alive).
But that isn’t all. I want the esp32 to have a GUI Displayed on an ILI9341 with Touchscreen.
This feature will be used for the moments when pupils visit the beehive(the beehive is living on the roof of a school) to show them the actual sensor readings right now.
The code for the maintask (measuring,sending Alert sms, sending to PHP skript, going to deepsleep, being watched by a watchdog that restarts if something crazy happens) is working 100%
But here comes the problem.
I merged the normal code with the gui code(which are both working 100% on their own) but now the ESP32 dies everytime it calls void_wiegen which is my function for measure the weight.
The problem appears in the moment when in the code the weight sensor is started.
First i thought of some power related issue so i bought three nice step down converters to have the right voltages everywhere.
But the Problem continues.
Everytime when the line :
/scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN); //beginig scale hx711 connection
scale.set_scale(28633.1136); // Scalefactor of the scale*/
is called (first lines of void_wiegen) the esp32 dies.
I have changed the order of the weight measuring and the temprature measuring and the the esp stops when reaching the end of void_klima (function for collecting temperatue data), even is he is supposed to do more tasks.
How can it be that my weight function kills the esp when running with LittlevGL.
But if I run the 2 codes seperate everything is working flawless.
I am really desperate and would be so grateful if somebody of you even reads this whole text and has some nice words for me
What MCU/Processor/Board and compiler are you using?
ESP32, Wroom32, Devkit C, Arduino IDE
What do you want to achieve?
For testing purposes I would like to merge the “normal code” with my “gui code” so it displays my GUI while doing all the other tasks and then going to deepsleep to be waked up by timer.
Future goal will be to make a while loop or an if/else to seperate between GUI Mode and “normal mode”
Something like:
if wakeupsource = touchpin -> just show gui(and read from variables) and let the touchscreen be touchable. use the GUI button object( label = deepsleep) to send esp32 back to deepsleep.
else (wakeup by timer)…show no GUI, switch all 3 relais,measure weight, temperature and so on, send it to database, send alarm sms if needed and go back to deepsleep.
What have you tried so far?
I have tryed back and forth how to implement the “normal code” into “the gui code”
I made sure that it is no power related issue.
Code to reproduce
“my try of merging gui code with normal code”
Serial Monitor Log of my merging try
I have added the code to pastebin because it is a lot of code
If you want to I can add it here too.
I really hope somebody has an Idea. Thank you very much.