This is my first Arduino project. I know, door alarm is not a unique project here :), but I could not find answers to my questions.
So what I want is a system with 2 parts: the first one is running on computer that receives some signals wirelessly about door being closed or opened. Another module is obviously sending these signals when it detects that door position changes. The important thing is that the door module should be autonomous, i.e. it should work on battery and it should be able to live on a single battery for at least several months.
Now I have a prototype on my breadboard with Atmega168 programmed (I flashed it with Arduino bootloader) that tracks INT0 pin change. By default (when the door is closed) INT0 is in HIGH state and MK goes to sleep. When the door opens, the circuit from INT0 to +5V breaks and MK wakes up, sends a signal via HC-06 bluetooth and waits until the door closes again. Then it sends "closed" signal and goes to sleep again. Works fine, but not ideal. Here is what bothers me, some things I'm not sure how to fix:
- I want the door module to run on CR2032 battery (3V). Currently the module does not start from 3V battery, I guess I need to lower the clock frequency. Currently it is running from 8Mhz internal Oscillator and divide by 8 bit is on. Should I change it to 128KHz? I will need to compile the bootloader or can I still use Arduino IDE without Arduino bootloader on Atmega168? Should I maybe use another MK like ATTiny?
- The current in sleep mode is 0.5mA, that's too much. CR2032 is 240mAh, so it means the module will die in less than 480 hours, most likely twice as fast. Maybe I'm doing something wrong with INT0 pin. It is connected with 10KOhm resistor to the ground and the switch is from INT0 to +5. Should I use bigger resistor? 1MOhm maybe?
- Maybe bluetooth transceiver is not a good option? Any other suggestions? I just need to send couple of bytes and the module should not verify if receiver gets them. Bluetooth is too complex, with all the pairing, instability.
Thank you!