You didn’t state what board you’re using, but if it’s an EnviroDIY Mayfly board or any other board with a processor operating voltage of 3.3v, then you’re not going to be able to read a 5v signal. It’ll max out reading around 3.3v, and you’ll likely damage the ADC input if you run it for very long or exceed the absolute maximum voltage of the ADC input pin. The easiest thing would be to use a voltage divider to cut your 0-5v signal into either half or 2/3, then just multiple the result by the ratio and you’ll get the full voltage. On a related topic, are you taking multiple readings and then doing an average, either with the onboard ADS or a Mayrly’s ADS1115 ? Because if you take lots of analog readings and declare the sum of the bits as an “int”, then strange things will happen when the sum is greater than 32,767 (it drops to negative -32768 and then continues until it approaches 0) so converting a really large number of bits into volts will generate a graph similar to what you posted.