This is probably Hothouse by Brian Aldiss. An abridged version was published as The Long Afternoon of Earth.
I'm going to need to quote a lot from Wikipedia, because I don't have a copy of the book and it's been over two decades since I read any of it.
the story is about a man, who is expelled from matriarchal squad to live on his own in jungle ... One woman from the group decides to go with the man. On their journey they meet some alien species, which can sit atop a human’s head and connect with their brain.
The story is set on a jungle-like Earth in the far future. When it begins, we follow the members of a small nomadic tribe. I think it was so small that "hunting party" was more accurate. The tribe was matriarchal, and was led by a woman called Lily-yo.
Walking back to the forest through "Nomansland" – the lethal interface-area between land and sea, Gren is waylaid by a "morel", a sentient fungus which attaches itself to his head and forms a symbiotic relationship. After a power-struggle, Gren leaves the tribe with his girlfriend Poyly, also taken over by the morel.
The sentient fungus was probably an evolved descendant of Earth fungi, as opposed to an alien species.
I think there are also bug species who are active only during the day, but not at night, and are suffering from attacks from species who can be active at night.
There are recognisable insect species - from Wikipedia:
the descendants of four species of social insects remain – tigerflies (evolved from wasps), tree-bees, plant-ants and termights (from termites)
Furthermore, the human protagonists are mutated (implausibly!) into creatures known as Flymen. These could fly, and I think they were Jeff-Goldblum-style insect/human hybrids.
Returning to the morel:
It's discovered that long ago, people and aliens lived constantly in this kind of symbiosis.
A Goodreads review backs this up:
Mankind entered into a contract with a parasite that gave us our intelligence in the deep past. A fungus that, when combined with another living creature, makes it smarter. With time, it moved from being a crown of spongy fungus that looked like a brain to inhabit the slowly enlarged cavity of our modern heads, until all man thought this was the natural order. When the sun aged and became deadly to the fungus, mankind fell into the state of beasts again.
As for "active during the day, but not at night" - the Earth is tidally locked to the Sun in this story, so it doesn't sound like that matches. I also couldn't find anything to match "The protagonist is helping the bug species by installing batteries on them."
However, one of the other answers mentions Alan Dean Foster's "Sentenced to Prism", and that book does have an insect or caterpillar-like species who are "at the mercy of night-roaming organosilicates" until the protagonist comes up with the idea of a battery.
I think OP is remembering Hothouse, but with some aspects of Sentenced to Prism having become mixed in with those memories.