Ultra Simple, Ultra Small and Ultra Cheap Pet Monitor

by andrei.erdei in Circuits > Arduino

2482 Views, 10 Favorites, 0 Comments

Ultra Simple, Ultra Small and Ultra Cheap Pet Monitor

main.jpg
scheme1.png
transmitter+antenna.jpg
receiver+antenna.jpg
speaker+motor.jpg
AA_batholder.jpg
AAA_batholder.jpg
controller+socket.jpg

I do not know how many of us have met the following situation: we go for a walk with our pet companion, we let him go free and suddenly we do not see him again. Or we play in the yard of our house and they disappear. I'm sure I am not the only one that has this experience. I thought it would be good to get rid of my worries and help myself with something. That's how this Pet Monitor idea was born. I was inspired by this article.

The pet monitor is made up of two parts: a radio transmitter that attaches to the animal collar and a radio receiver that is at the pet owner. When the animal moves away from the transmitter's coverage area attached to the collar, the receiver will react with either a sound, a flash of a LED light or a vibration, and will alert the owner. I wanted my pet monitor to be as simple and cheap as possible. You can see in the picture above the monitor’s block diagram and the program’s flowchart for the component devices. I used affordable and easy to obtain components: attiny85 processor, 433 Mhz receiver and transmitter modules, miniature vibration motor, miniature speaker, battery holders.

Components needed:

ATtiny85 microcontroller 2 pieces 1.46$/piece;

8 Pin IC socket 2 pieces 0.05$/piece;

H34A 433 MHz Miniature Transmitter Module 0.96$;

H3V4F 433 MHz Miniature Receiver Module 1.69$;

High Gain 433Mhz Antennas 2 pieces 1.21$/piece;

Miniature Speaker LD-SP-U15.5/8A 1W/8Ohmi,16mm diameter 1.08$;

Model 1027 DIsk Vibration Motor 0.6$,

3xAAA Battery Holder with On/Off Switch, JST, and Belt Clip 2.95$;

3xAA Battery Holder with On/Off Switch, JST, and Belt Clip 2.95$;

Schematics, Testing, Final Sketches, Programming

Schematic_Pet-Monitor.jpg
test_1.jpg
test_2.jpg
current.jpg

The schematics are very simple, as you can see in the picture above.

For testing firstly, I used a Digispark clone then an ATtiny85 for transmitter side and an Arduino Uno on the receiver side. With the ATtiny on the transmitter side a 4 uA current consumption in the deep sleep mode can be achieved, as you can see in the photo above. After testing I finished these very simple sketches (the code is inspired by example codes from www.14core.com).

code for transmitter:

#include <RCSwitch.h>
#include <tinysnore.h>
RCSwitch rfsense = RCSwitch();

void setup() { 
pinMode(1, OUTPUT); //to transmitter module DATA pin 
pinMode(2, OUTPUT); //power for transmitter
digitalWrite(2, HIGH); //transmitter power on 
rfsense.enableTransmit(1); //data on attiny pin1
}

  void loop() {
  rfsense.send(0x2, 4); //send 4 bytes of 0x2
  digitalWrite(2, LOW); //transmitter power off
  snore(1500); // deep sleep, current consumption 4uA
  digitalWrite(2, HIGH); //transmitter power on
}

as you can see I used RCSwitch and TinySnore libraries.

code for receiver

#include <RCSwitch>
RCSwitch rfsense = RCSwitch();
unsigned long startMillis;
unsigned long currentMillis;

void setup() {
//  Serial.begin(9600);
rfsense.enableReceive(0);  // Receiver on interrupt 0 => that is pin7 #PB2, pin D2 for UNO
//  Serial.println("14CORE | RF Sniffer Test Code for Receiver");
//  Serial.println("RF Sniffer Initializing......");
delay(1000);
pinMode(0, OUTPUT); //for onboard LED pin13 for UNO 
startMillis = millis();
}

void loop() {
  if (rfsense.available()) {
    int value = rfsense.getReceivedValue();
    // Serial.print("Received 0x");
    // Serial.println(rfsense.getReceivedValue(),HEX );
    startMillis = currentMillis;
    rfsense.resetAvailable();
  }
  else {
    currentMillis = millis();
    if (currentMillis - startMillis >= 5000) {
      //Serial.println("no data");
      tone (0,1000);
      delay(250);
      noTone(0);
      tone (0,4000);
      delay(250);
      noTone(0);
      tone (0,1000);
      delay(250);
      noTone(0);
//        digitalWrite(0, HIGH); //if you want to connect a LED or a vibration motor
//        delay(250);
//        digitalWrite(0, LOW); 
//        delay(250);
//        digitalWrite(0, HIGH);
//        delay(250);
//        digitalWrite(0, LOW);
//        delay(250);
      startMillis = currentMillis;
    }
  }
}

Note: the code will not compile because off a missing library dependency. You must comment line 56 in RCSwitch.h, the line with #define RCSwitchDisableReceiving and you must use pin 7 on attiny85 for DATA in from receiver module, more to read about here.

To upload this sketches to the ATtiny85 microcontrollers, please refer to my instructable ATtiny13A/ATtiny25/ATtiny45/ATtiny85 Programming With a Programmer Board and USBasp

Of course you can use other methods, there are plenty of instructables about programming the ATtiny series of microcontrollers:

Programming the ATtiny;

Program an ATtiny With Arduino;

ATtiny Programming With Arduino;

Program ATtiny Chips With Arduino;

Programming ATtiny Micro Controllers With Arduino UNO.

Put It All Together

diss_AA.jpg
eliminate_AA.jpg
place_AA.jpg
receiver.jpg
diss_AAA.jpg
eliminate_AAA.jpg
place_AAA.jpg
transmitter.jpg

For the receiver...

  • disassemble the AA battery holder;
  • make room for the components by giving up a battery place;
  • place the components and solder them;

For the transmitter make the same steps.

The pictures above should be pretty self-explanatory.

Notes:

  • the transmitter's coverage is only about 15-20m, but with a better antenna on the receiver side, it can be improved a lot;
  • the AAA battery holder dimensions are appropriate for bigger pets but for cats or other small dogs you must use a transmitter with a CR2032 battery and the smaller battery holder of course (something like this);
  • check if in your country the 433Mhz frequency is freely usable, otherwise you may enter in legal troubles. You can buy transmitter+receiver for a freely usable frequency...

P.S.

  1. If you have any question or need some more info I will try my best to answer them.
  2. I apologize for any mistakes in my English.