I have been working on a miniature temperature sensing module which buzzes once the temperature crosses a threshold using ATtiny85, lm35 and a pico buzzer. When I power the whole circuit using an arduino board and take readings of the temperature sensor, they are consistent. But when I try to take the readings after powering the whole thing using 2xcr2016 3V coin cells, the readings are erratic. How do I solve this issue?
Coin cells have ultra high series resistance - any loads greater than 10mA or even less will make them sag significantly. They are intended to power ultra-low power circuits like Real Time Clocks, watchdogs, battery monitoring, and keep volatile memory intact during power failures.
The AT tiny when running at significant clock speeds will be sapping up to or more than 10mA, plus the sensors and other circuitry will be causing havoc to your little coin cells. They will be sagging a lot during sampling periods, and may cause brownouts on your AT Tiny.
Get a better power source, add many more capacitors (low and high values to cover all bases), and use an oscilloscope on the VCC rail to see visibly how it sags, and then you will understand.
If you ran the AT Tiny at 32kHz or a few hundred kHz at most, it may work at a low enough power level to use the coin cells. It will just be slow.