Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Basic battery monitoring ideas.
#21
The serial print does not go faster that you can notice on the ESP32 since it depends on the serial port speed.
The write to Influx can go faster because the ESP have 1 core to put the handling in background meanwhile the ESP8266 need to switch forward the network handling as I said.

But that should really not be a speed issue if your code is correct. Ie make sure you fetch all data, work with it, store it. THEN when you have a set of data you send the data WHEN the wifi is read. Ie have a loop doing stuff and only jump in doing the other.

Like

While [1]
if (data_ready_to_send) send_data();

_every_xxxx_ms_run(adsasads)
_every_xxxx_ms_run(adsasads)
loop

Ie make sure to not "wait" for stuff to happen. Set a variable instead when its ready to process and then process that in the main loop. The main loop should only contain calls to functions that only runs if there is data to work with Smile

There are even prebjuilt libraries that does this work for you very well. After i started to use them i noticed a speed up and it was so much easier to code stuff that need to be taken care of timely.

Lastly. Use interupts! Smile
Korishan likes this post
The Ultimate DIY Solar and build place
YouTube / Forum system setup / My webpage  Diy Tech & Repairs

Current: 10kW Mpp Hybrid | 4kW PIP4048 | 2x PCM60x | 83kWh LiFePo4 | 10kWh 14s 18650 |  66*260W Poly
Upcoming: 14S 18650~30kWh | Automatic trip breakers, and alot more
Reply
#22
(08-07-2019, 06:26 PM)daromer Wrote: While [1]
    if (data_ready_to_send)  send_data();

  _every_xxxx_ms_run(adsasads)
    _every_xxxx_ms_run(adsasads)
loop

Ie make sure to not "wait" for stuff to happen. Set a variable instead when its ready to process and then process that in the main loop. The main loop should only contain calls to functions that only runs if there is data to work with Smile

There are even prebjuilt libraries that does this work for you very well. After i started to use them i noticed a speed up and it was so much easier to code stuff that need to be taken care of timely.

Lastly. Use interupts! Smile
OK thanks 
The serial port speed is always at 115200 baud at least that is what I use.
I will look into the While function although I am already using it during setup waiting for wifi to connect.
Interrupts I will also look at but for now the code really runs fine the way it is its. It's really not that complicated of a sketch.

Besides I am just an amature sketch writer  Tongue
I got many more years to learn the good stuff.

Wolf
Korishan likes this post
If 18 X 650 = 2200+mAh then we have power! 
May all your Cells have an IR of 75mΩ or less Smile
Last count as of 8/7/2019
Total Number of Cells Recorded and processed                 6149
Total Cells required for PowIRwall                                   2856
Total Cells ≥2200mAh, ≥80%, ≥35mΩ, ≤75mΩ, ≥4.12V   2760
For Info Google Drive
Not your average Wolf       
            Cool
Reply
#23
" I will try another ADS1115 but it's just odd it happens around the same time every night. and it's just Array1 Huh "

If it isn't causing anything weird, I'd try logging the raw output of the ads1115 and see if that's going past it's maximum value. I suspect it isn't the chip that has an issue, and it's related to something else. There are so many things that could cause that - but as you said it can't be the actual voltage. Not only would it fry the ADC - ADCs get saturated at a certain point, so they wouldn't be able to read more than a certain voltage anyways. That's what makes me wonder because the max reading of an ADC is the bit count, which then gets translated into a voltage later - so it could be the conversion method has a bug at a certain point or even the method of transmission?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)