Feed on
Posts
Comments

The current doorbell we’re using at home is a bit old now and it can play up from time to time (it’s one where you rotate some screws to give a certain combination to link up with the transmitter). A majority of my time for the last few months have been with RC and now I’ve got some spare parts we can put to good use.

https://www.youtube.com/watch?v=r7_RbnRNwxY

My idea is to use a nRF24L01+ with an ATtiny for the transmitter and receiver, an old small video camera bought off Ebay, a 10mW 5.8GHz video transmitter, 5.8GHz receiver, 4.3″ monitor and some batteries. I have some more ideas for the next iteration of this project found at the end.

Doorbell Transmitter

doorbell_tx

So the first part is the transmitter, I could make an acrylic box with the CNC but it wouldn’t look quite as good as a proper enclosure (though I could stack the layers), a 3D printer would be perfect for this job but since I don’t have one I decided to re-use the enclosure. I took out all the electronics and lined up a button and LED on a veroboard and it fit in nicely.

// Power down the nRF24L01/MCU and wait for pin interrupt
NRF_POWERDOWN;
system_sleep();

mirf_transmit_data();
PORTB |= (1<<LED);
_delay_ms(500);
PORTB &= ~(1<<LED);

I was able to re-purpose an ATtiny and nRF24 from the Alarm system project, powered by a coin cell and have it only wake up and transmit a single byte packet when the button is pressed.

Receiver/Server

doorbell_rx

I wanted to give maximum battery life on all devices that weren’t going to be plugged in, so I made the receiver (server) side always listening for packets and plugged it into a spare USB port on my little server PC. It uses the  nRF24, ATtiny841, a speaker driven with a mosfet salvaged from a laptop and I’m using a 3.3V LDO for the nRF.

// If wake up packet received, store it
if (dataIn == SYSTEM_ON || dataIn == SYSTEM_OFF) {
	doorbellState = dataIn;
}
else if (dataIn == SYSTEM_REQUEST_STATE) { // Request of state made by camera RX
	mirf_transmit_data(doorbellState);
	
	NRF_RX_POWERUP; // Power up to receiver mode
	_delay_ms(3);
}

Once we receive a wake up packet, we store it and when the camera RX checks in, it will request for the state so we send that back straight away.

// Sound speaker
if (dataIn == SYSTEM_ON) {
	speakerState = 0;
	
	// Turn on speaker
	TCNT0 = 0;
	TCCR0B = (1<<CS02);
	OCR0A = 30;
	
	// Turn on timer 1
	TCNT1 = 0;
	TCCR1B = (1<<CS11) | (1<<CS10);
}

// Timer1 overflow, every ~0.5 seconds
ISR(TIM1_OVF_vect) {
    if (speakerState == 2) { // Change the speaker tone
        OCR0A = 40;
    }
    else if (speakerState == 4) { // Turn off speaker
        OCR0A = 0;
        TCCR0B = 0;
        PORTA &= ~(1<<speakerMosfetPin);
    }
    else if (speakerState >= 50) { // Reset doorbell state after ~25 seconds
        doorbellState = SYSTEM_OFF;
        TCCR1B = 0;
    }
    speakerState++;
}

If the system on packet is received, we turn on the speaker and timer1 changes the tones of the speaker after 2 seconds, switches it off after 4 seconds and resets the doorbell state after 25 seconds.

Camera RX

camera_rx

The camera receiver consists of an nRF24, ATtiny84, camera, 5.8GHz vTX and a 3.7V Lipo battery which is enough to power it all. We get the benefit of being able to position the camera where ever we wish (out of direct sunlight) and cover it with a plastic bag for some easy weather proofing.

NRF_POWERDOWN; // Power down the nRF24L01 and sleep for 2 seconds
watchdog_sleep(T2S);

// Check battery voltage every ~2 minute
if (batteryCheck >= 60) {
	...
	// If battery voltage below 3.5V then turn off
	if (batteryVoltage <= lowVoltageLipo)
		NRF_POWERDOWN; // Disable permanently
		system_sleep();
	...

mirf_transmit_data(); // Transmit check in packet

// Wait for packet back
NRF_RX_POWERUP; // Power up to receiver mode
mirf_flush_rx_tx(); // Flush RX and TX FIFO
mirf_CE_hi; // Start listening
...

// Packet received
if (mirf_status() & (1<<RX_DR)) {
	...
	// If wake up packet received
	if (dataIn == SYSTEM_ON) {
		PORTA |= (1<<cameraMosfet); // Turn on camera/vTX
		NRF_POWERDOWN; // Power down the nRF24L01
		
		// Sleep for 32 seconds
		watchdog_sleep(T8S);
		...
       		PORTA &= ~(1<<cameraMosfet);
	}
}

We sleep for 2 seconds and then check in with the server to receive the state, if it’s on we turn on the camera and video transmitter for about 32 seconds and then power them off which should be enough time to check who’s at the door. We’re also checking the battery voltage every 2 minutes to power off if it gets too low.

Monitor

The monitor has the 5.8GHz receiver which I built into it and is powered by a 2 or 3 cell Lipo battery and you manually have to switch it on or off.

doorbell_monitor

It’s a pretty simple system even though there are quite a few parts to it all and I was able to put this all together within a few days. It’s working well so far though the main concern at this moment is how long the video RX’s battery will last. Download nRF_Doorbell_v1.0

Some improvements that could be made for the next revision:

  • Stick an nRF / ATtiny in the monitor and have it check in with the server so it can automatically switch itself on
  • Have a switch on the monitor to manually turn the camera on or off
  • Investigate using a boost converter on the monitor so it can be powered with a 1 cell Lipo (will need to me make a custom back case for the monitor to fit everything into the case)
  • Add a PIR with nRF / ATtiny to have the camera switch on if movement is detected
  • Upgrade the camera to a better one

Leave a Reply