I think there are two questions to be considered here: privacy and usability.
Serial numbers can be, obviously, used as unique identifiers and when it was enabled on Pentium processors a long time ago, things didn't went well:
The Pentium III was the first x86 CPU to include a unique,
retrievable, identification number, called PSN (Processor Serial
Number). A Pentium III's PSN can be read by software through the CPUID
instruction if this feature has not been disabled through the BIOS.
On November 29, 1999, the Science and Technology Options Assessment
(STOA) Panel of the European Parliament, following their report on
electronic surveillance techniques asked parliamentary committee
members to consider legal measures that would "prevent these chips
from being installed in the computers of European citizens."
Eventually Intel decided to remove the PSN feature on Tualatin-based
Pentium IIIs, and the feature was not carried through to the Pentium 4
or Pentium M. The feature does not exist in modern Intel x86 CPUs.
As @EbGreen pointed, you can use hashing or some other transformation to deal with storing and sharing hardware serial numbers.
I'm not sure on what you call "computer serial number". If it depends on itens such as drivers, kernels, video cards, network cards and other items that can be removed or upgraded, then whenever the user does this, I suppose he/she would have to re-register or reconfigure your software, that is anti-friendly. Same thing applies to batteries. (If the computer serial will be coming from the motherboard, it is less of an issue, but motherboards can be upgraded too, although less frequently).
Note: While I was writing this answer, the OP made a comment about the software being "meant to collect data about how your battery capacity evolves over time", so it means there has to be a battery, and if the baterry is changed, the user would actually be interested in adjusting the data, so my second point is less of an issue.