If your ADS1115 is being damaged, your code and register settings are not your primary concern. As long as you have it physically connected properly (proper isolation, not exceeding voltage limits of device, etc.) it may or may not behave as you expect, but it shouldn’t be damaged. However, since it IS being damaged, it is almost certainly from one of the following issues, in order of likelihood:
- You have an isolation issue. You need to make certain that everything connected to the Arduino and the ADS1115 either uses the same ground reference or is galvanically isolated from them. Based on what you have described, your solar panel is isolated from the battery, and therefore, you can’t assume the grounds are at the same absolute potential. This includes any USB cables used. If you do not isolate the Arduino from the ADS1115 measuring the solar panel voltage, then you must tie the Arduino ground reference to the negative voltage of the panel. Additionally, you must then isolate the Arduino from the battery voltage and from any USB cable you happen to be using. (We do sell USB isolators, such as - USB-ISO or BB-UH401-2KV).
Regardless of how your system is connected, it is also essential that the ground pin (Pin 3) of the ADS1115 is electrically connected to the negative terminal of the solar panel. If the Arduino is on same ground plane as the ADS1115, then only one connection, via the Arduino, is necessary.
I would instead recommend isolating the ADC from the Arduino, as I described above. This allows you to keep the Arduino ground at the same potential as your battery ground. If you choose to connect it this way, be certain to connect the ground pin of the ADS1115 (pin 3) to the negative terminal of the solar panel. The point is that you cannot connect various parts of your circuit with different ground references together without damaging something unless you galvanically isolate them.
-
Your voltage divider is not what you think it is, as PaulHutch stated. Get that wrong, and the ADS1115 will be damaged.
-
You have an ESD problem. If there is a lot of noise on the panel voltage rail, it could be damaging the ADS1115. You might want to look at mitigating this by placing a TVS at the output of the solar panel to clamp the voltage seen by your voltage divider network. If you have a scope, you could take a look at that signal and get an idea of how noisy it is.