I done this before on the 328p but it looks like the registers are different. Has anyone done this on the Attiny2313. The datasheet does say it has the bandgap VCC ref and the Analog Comparator. So this should be possible but none of the examples work. I am using Tiny Core with the Arduino IDE and it doesn't like setting ADMUX.
After setting the Analog Comparator configuration to use the Bandgap Reference for AIN0, you could adjust the voltage on AIN1 until the comparator tripped. You would need a way to provide an accurate variable voltage to AIN1.
Not really, I just need to get the voltage level. So much easier on the 328p but trying to keep cost down. I could use a voltage divider but then need ADC so then should just use the 328p as the next cheapest option with enough GPIO's.
MobileWill:
I thought about it but I need more pins for driving 10 LEDs.
So I was thinking easier to just slap a 328p at the problem lol. The answer to the universe and everything.
It's not a bad thing. All up your BoM will be around the same cost as an ATTiny with additional supporting ICs, and if you only need 8MHz it can run on the internal clock as quickly as an ATTiny85 with a few more pins for whatever your scope-creep can come up with. It's an ATTiny85 with just 20 more legs to solder is all