Projects / Rodent trap alert for godowns

Rodent trap alert for godowns

Beginner2 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. NANO433

    Build the trap node

    Nano, 433 MHz transmitter, reed switch and battery pack in a sealed box.

  2. NANO433

    Fix the reed switch

    Position the magnet so it is next to the reed when the trap is set and moves away when the door closes.

  3. NANO433

    Wire the receiver

    A second Nano with the receiver and a buzzer, powered from a USB adapter.

  4. NANO

    Add antennas

    A straight 17 cm wire on each module's antenna pad.

  5. NANO433

    Test

    Close the trap by hand. The receiver beeps once for trap 1, twice for trap 2, and so on.

  6. NANO

    Set the trap number

    Change TRAP_ID on each trap node (1 to 9) before uploading.

  7. NANO433

    Test range

    Walk the receiver around the store and note where it stops hearing.

In short

How do you build a rodent trap alert for godowns?

A reed switch on a cage trap sends a radio alert when it snaps shut, so traps in a grain store are checked only when needed. You need Arduino Nano × 2, Door reed switch MC-38, 433 MHz RF transmitter and receiver pair, Battery holder 4 × AA with switch, AA alkaline battery × 4, Active buzzer 5 V and Jumper wires male to male (40 pcs, 20 cm). It takes 7 steps and about 120 minutes.

Level
Beginner
Time
About 120 min
Parts
7

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
Trap node reed switchNano D2 and GNDOpen when the trap door has moved the magnet away
Trap node 433 MHz transmitter DATANano D12Radio data
Transmitter VCC and GNDNano 5V and GNDSupply
Trap node battery4 AA pack to Nano VIN and GNDPower
Receiver module DATASecond Nano D11Radio data in
Receiver VCC and GNDSecond Nano 5V and GNDSupply
Receiver buzzer + and -Second Nano D8 and GNDBeeps the trap number
Antennas17 cm of wire on each module's ANT padMuch better range

Code

Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones). Install "RadioHead" by Mike McCauley. The trap node sleeps and wakes on the pin change, sends the message three times to improve the chance it is heard, then sleeps again. The Nano's USB chip and LED still draw current, so for months of battery use a bare ATmega328P or a board without those parts. Check radio use is permitted for 433 MHz devices in your area.

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

// ===== TRAP NODE (upload to the board at the trap; set TRAP_ID on each trap) =====
#include <RH_ASK.h>
#include <SPI.h>
#include <avr/sleep.h>

RH_ASK driver(2000, 11, 12, 10);               // speed, RX pin, TX pin, PTT pin
const byte REED = 2, TRAP_ID = 3;
volatile bool fired = false;

ISR(PCINT2_vect) { fired = true; }

void setup() {
  pinMode(REED, INPUT_PULLUP);
  driver.init();
  PCICR |= _BV(PCIE2);
  PCMSK2 |= _BV(PCINT18);                      // pin change on D2
}

void loop() {
  if (fired) {
    fired = false;
    if (digitalRead(REED) == HIGH) {           // reed open: the trap has closed
      char msg[8] = "TRAP0";
      msg[4] = '0' + TRAP_ID;
      for (byte i = 0; i < 3; i++) { driver.send((uint8_t *)msg, 5); driver.waitPacketSent(); delay(300); }   // sent three times
    }
  }
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  sleep_enable(); sleep_cpu(); sleep_disable();
}

// ===== RECEIVER (upload to the second board, remove the // marks) =====
// #include <RH_ASK.h>
// #include <SPI.h>
// RH_ASK driver(2000, 11, 12, 10);
// const byte BUZZ = 8;
// void setup() { driver.init(); pinMode(BUZZ, OUTPUT); }
// void loop() {
//   uint8_t buf[8]; uint8_t len = sizeof(buf);
//   if (driver.recv(buf, &len) && len == 5 && buf[0] == 'T') {
//     byte id = buf[4] - '0';
//     for (byte i = 0; i < id; i++) { digitalWrite(BUZZ, HIGH); delay(200); digitalWrite(BUZZ, LOW); delay(200); }   // beep the trap number
//     delay(2000);
//   }
// }

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Trap closedReceiver beeps the trap number within a second
Trap set (magnet near)No message
Range in the openTens of metres with antennas
Through grain stacksShorter, so test in place

If it does not work

No message

Antenna missing, wrong data pins or the receiver is too far.

Trap node wakes randomly

The reed is bouncing. Move it or add a debounce delay.

Receiver hears noise

433 MHz receivers pick up interference. Check the length and ID before acting, as in the code.

Battery lasts days only

The Nano board draws idle current. Use a bare chip for long life.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the rodent trap alert for godowns?

Arduino Nano × 2, Door reed switch MC-38, 433 MHz RF transmitter and receiver pair, Battery holder 4 × AA with switch, AA alkaline battery × 4, Active buzzer 5 V and Jumper wires male to male (40 pcs, 20 cm).

How long does the rodent trap alert for godowns take to build?

About 120 minutes for a beginner maker, in 7 steps.

How do I know the rodent trap alert for godowns works?

Trap closed: Receiver beeps the trap number within a second. Trap set (magnet near): No message. Range in the open: Tens of metres with antennas.

No message: what should I check?

Antenna missing, wrong data pins or the receiver is too far.

Trap node wakes randomly: what should I check?

The reed is bouncing. Move it or add a debounce delay.

Receiver hears noise: what should I check?

433 MHz receivers pick up interference. Check the length and ID before acting, as in the code.

Battery lasts days only: what should I check?

The Nano board draws idle current. Use a bare chip for long life.