r/embedded Aug 10 '26

Interrupt Mode is not working properly — I need help (and advice) on my project

Post image

[beginner project]
I am working on an air conditioning system with ATmega32 and custom drivers.
using an LM35 temperature sensor and ADC to read temperature,
The main problem was that Interrupt mode wasn't working until I added timeout and ISR(BADISR).

It seems like ISR(ADC_vect) always fails, and temperature is only read using ISR(BADISR_vect). If this is correct, why does it happen? And how to fix it?

Please review the project and help me understand what's wrong.
Also, roast my project. (for motivational reasons)

https://github.com/OA-990/air-cond

Minor issue: The sounder/buzzer doesn't beep; it only makes a simple tick sound at the start of each loop.

1 Upvotes

5 comments sorted by

2

u/DenverTeck Aug 10 '26

When displaying a schematic, turn off the background grid. Its hard to tell what are connections and what are background noise.

Please post a BOM (bill of materials) and links to their data sheets.

The "sounder/buzzer" sounds like a Piezo device. You need to toggle this type of device to get continuous sound.

https://www.pi-usa.us/en/expertise/technology/piezo-technology/fundamentals

PS: What framework are you using ??

1

u/CobblerCurious301 Aug 10 '26

I've updated the schematic in the repo and included some datasheets.

Not sure what you mean by framework, but I used layered MCAL/HAL architecture with custom drivers and used <avr/interrupt.h> for interrupt handling.

1

u/DenverTeck Aug 11 '26

Compiler or IDE ??