Page 1 of 1
Acs712 with St7735 Display!
Posted: Sun Oct 20, 2024 6:57 pm
by jgu1
Hi all!
Yes it´s me, who need help again, hope it´s ok
Using an Arduino Mega, ST7735 display and an ACS712.
To avoid flicker as much as possible in the display I only update when Amp is changing so I use " If new <> from old write the new and update Old"
It work fine in simulation , but in real world it update all time, without changing amp? Same issue with the ILI9341 display, but working fine with a
LCD display 4X20 serial. very stable.
I have try to use all kind of capacitors over the supply, ect.
Am I doing something wrong in my examble, or is there another way I can avoid or solve the problem or "flicker during update value", please.
Thank´s in advance
Jorgen
Re: Acs712 with St7735 Display!
Posted: Sun Oct 20, 2024 7:20 pm
by mnfisher
I would guess that the current reading is fluctuating enough to cause a refresh.
Maybe check if AmpOld and Amp differ by a certain 'threshold' amount and see if that helps?
Martin
Re: Acs712 with St7735 Display!
Posted: Sun Oct 20, 2024 7:36 pm
by jgu1
Hi Martin!
Know I could count on you

Thank you.
Already tested, no matter if I ground the ACS712 or use a battery, its always update, strange?
Re: Acs712 with St7735 Display!
Posted: Sun Oct 20, 2024 8:06 pm
by mnfisher
How quickly does the sensor refresh? - maybe add a delay in the loop. It will surely help - but maybe not in the right way (1s delay == 1s refresh)
Amp and oldAmp - are floats, cormparing them for equality might not work well..
Something like abs(oldAmp - amp) > 0.1might do the trick?
Would need to be fabs (#include <math.h>) or create your own (if(x < 0) return -x)
Martin
Re: Acs712 with St7735 Display!
Posted: Mon Oct 21, 2024 5:02 am
by jgu1
“Amp and oldAmp - are floats, cormparing them for equality might not work well..”
What i also thought, I try to change to byte 0-255 for test, same.
I Will test your suggest later today, you hear, Thank’s.
Br
Jorgen
Re: Acs712 with St7735 Display!
Posted: Mon Oct 21, 2024 11:22 am
by jgu1
I placed this in an calculationbox before compare
AmpOld = (AmpOld - Amp) > 0.1 rigth or ?
But still the same

Neither the delay solve the issue.
Re: Acs712 with St7735 Display!
Posted: Mon Oct 21, 2024 11:36 am
by mnfisher
Need to check if its negative as well (> -0.1 (hence the fabs - which would need to be in a C block)) - can you print out the readings? Do they look reasonable?
Martin
Re: Acs712 with St7735 Display!
Posted: Mon Oct 21, 2024 9:19 pm
by jgu1
Hello MArtin!
Sorry take your time. When I remove the USB programming cable from the arduino it get much more stable
So this have some disturbtion on the reading. Thank you for your always helping.
Br Jorgen
Re: Acs712 with St7735 Display!
Posted: Tue Oct 22, 2024 8:09 am
by mnfisher
Sounds like an interesting (and sensitive) sensor...
Good that you are getting some readings now.
Some displays are also very 'noisy' - I had issues with an SSD1306 - which introduced a huge amount of hum into a circuit.
Martin