So I created this doorsensor, it's supposed to be put in a hole inside the door.
You need to drill a 20mm hole in the door and then put this baby in there.
It was made to fit a HopeRF 433mhz transmitter, a ATTINY85 chip and a microswitch and a CR123(A) battery!
Bill of materials:
- HopeRF 433mhz TX module
- ATTINY85 chip
- Microswitch (hole distance 6.5mm, I think that's default)
- CR123(A) battery
- An old battery clip you can remove the internals from to put into this model (glue them in or whatever fits your purpose)
The ATTINY85 is running RH_ASKTiny (check their github for the library) and tinysnore. This can be run on a chip running Micronucleous or just without bootloader, pick your poison! I have the data pin connected to ATTINY's pin output 4 (which is physical pin 3 next to GND) The code is below:
#include <tinysnore.h>
#include <RH_ASK.h>
#ifdef RH_HAVE_HARDWARE_SPI
#include <SPI.h>
#endif
RH_ASK driver(2000, 3, 4, 0);
void setup()
{
for(int i = 0; i < 3; i++)
pinMode(i, INPUT_PULLUP);
driver.init();
}
void loop()
{
const char *msg = "DOOROPEN";
driver.setModeTx();
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
delay(200);
driver.setModeIdle();
delay(200);
snore(8000 * 3);
}