loading
 
 


                                                          VOTE FOR US - CLICK HERE 

Live in a household with 2 or more dogs? Tired of your dog eating the cat's food? Tired of having one skinny dog and one obese dog? 

The Texas Instruments RFABulous Puppy Food Bowl team found a solution.

Team members:
David Whitfield
Nathan Hogg
Tahsin Alim

Tools, materials, and parts

1. 
Ultrasonic Module HC-SR04 Distance Measuring Transducer Sensor
2. Texas Instruments MSP430G2 LaunchPad
3. breadboard
4. 
HC-06 Wireless Serial 4 Pin Bluetooth RF Transceiver
5. Infrared Auto Open Pet Bowl Dish Dog Cat feeder with automated lid
6. (4) n-channel mosfets
7. #22 gauge solid wire
8. (3) 1k resistors
9. 
PARALLAX RFID READ/WRITE 125 kHz
10. soldering iron
11. plyers
12. solder

13. (2) USB to miniUSB cables
14. TI CD4050B CMOS Hex Buffer
15. TI CD4066BC Quad Bilateral Switch
16. Drill and drill bits

We will hack a pre-existing automated dog bowl so that the mechanical aspect of the project is done for us. This way we don't have to worry about having access to a machine shop. We will deal only with the electrical hardware and software.

The dog bowl uses the ultrasonic sensor to detect if a dog is in range, within 40cm, and opens the lid. When the dog comes up to eat the food, the RFID tag on its collar is scanned with the RFID scanner. If the scanned tag has the right serial number, the lid remains open allowing the dog to eat the food. If the scanned tag does not have the correct serial number, the lid closes and locks the bowl for 1 minute. An Android app communicates with the dog bowl via bluetooth, allowing the user to chose between 3 modes. These modes include automatic dog detection mode, which was explained previously, open override where the lid stays open regardless of the sensor readings, and closed override where the lid remains closed. 

The RFID tag can also be scanned by the Android phone which will automatically open the app and enable bluetooth.

Step 1: Hack the Infrared Dog Bowl

The dog bowl uses infrared motion detection. This was deemed to be lacking in the aspect of interference. If the bowl were in direct sunlight or around certain fluorescent bulbs it would not work correctly. We also need a way to determine the approximate distance of an object so that the bowl will not open if a person walks by the sensor, only when a dog walks directly up to the bowl. 

Hacking the dog bowl is easy. Follow these steps to prepare the bowl.

1. The bottom of the dog bowl has 6 screws that must be removed. Flip the dog bowl upside down and remove these screws.
2. Unscrew the screws holding in the circuit board and the infrared devices. 
3. Remove the cables that connect the circuit board to the other devices on the bowl.
4. Take out the infrared module and circuit board. 
5. Use the drill to drill out the "eyes" in front of the bowl where the infrared LEDs were (this is where the ultrasonic sensor will go).


Step 2: Assemble the Circuit

The circuit consists of a buffer (used as a logic level shifter), a quad analog switch to switch between the serial ports, 4 transistors for the H-bridge, and a couple discrete components.

The circuit will allow the MSP430 to communicate with the modules and allows for the micro-controller to open and close the lid.

Next assemble the circuit on the breadboard.

Optional -A PCB can be drawn and printed so that the project is more professional and compact.

Step 3: Download the Android App for the Dogbowl

An Android app is used to chose one of the 3 modes. The default mode is  auto-dog detection.

The distance of the bluetooth communication depends on the environment and strength of the Android bluetooth hardware. In testing, the range was around 100 feet.

Simply download the app and install it on the Android phone. Open the app and chose the bluetooth device labeled "linvor." The app will say connected and it may now be used to control the dog bowl.

Each setting will switch between different dog pictures and sounds.

The android phone can also scan the RFID tag to automatically open the app and enable bluetooth (make sure the android phone has NFC communication enabled).

Step 4: Compile the Code and Download It to the MSP430

Energia was used for this project. 

The code is posted below. Simply compile the code and program it to the micro-controller


----------------------------------------------------------------------------------------------------------------.

#define READ 0x01

int count = 0;
int rval;
int dval;
int dvaltemp =1;
int runs = 0;
int dvalcount =0;
const int pingPin = P2_6;
const int pingReceive = P2_1;
const int m1 = P2_3;
const int m2 = P2_4;
const int sb = P1_5;
const int sr = P1_3;
const int ledpin = P2_5;
int rfidtagclose = 0;
int close =0;
long countt=0;
int open =0;
long duration;
long inches;
long cm;
int rfidtag = 0;
int temp=0;
int bowlopencnt =0;

char btread ='A';


void setup()
{
  Serial.begin(9600);
  pinMode(sb, OUTPUT);
   pinMode(sr, OUTPUT);
digitalWrite(sb, LOW);
digitalWrite(sr, LOW);
pinMode(m1, OUTPUT);
  pinMode(m2, OUTPUT);
  pinMode(ledpin, OUTPUT);
  pinMode(GREEN_LED, OUTPUT);

}



void loop()
{
if( count < 40)
{
  digitalWrite(sr, HIGH);
  Serial.print("!RW");
  Serial.write(byte(READ));
  Serial.write(byte(32));

  if(Serial.available() > 0)
  {     
    rval = Serial.read();                       
      if (rval != 1)                            
       {suppressAll();}                             
  } 



if(Serial.available() > 0) {     
    rval = Serial.read();
    Serial.print("1st:");
    Serial.println(rval);
 

    }

if(Serial.available() > 0) {       
    rval = Serial.read();
    Serial.print("2nd:");
    Serial.println(rval);
      if(rval == 149)
    {
     rfidtag = 0;
    
    }
    }

if(Serial.available() > 0) {     
    rval = Serial.read();
    Serial.print("3rd:");
    Serial.println(rval, HEX);
    }

if(Serial.available() > 0) {         
    rval = Serial.read();
    Serial.print("4th:");
    Serial.println(rval, HEX);
    Serial.println("-----------------");
    } 

delay(3);
//delay (11);

}
else
{
  digitalWrite(sr, LOW);
}


if (count >45)
{
  digitalWrite(sb, HIGH);
  delay(10);
   temp = Serial.read();
   // Serial.println(temp);
   if (temp == 65 || temp == 66 || temp == 67)
   {
     btread = temp;
    // Serial.println(btread);
    
   }
     pinMode(pingPin, OUTPUT);    
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);
 
  pinMode(pingReceive, INPUT);
  duration = pulseIn(pingReceive, HIGH);
   dvaltemp = Inches(duration);
// Serial.println(dval);
delay(10);
if(dvaltemp < 15 && dvaltemp>0)
{
  dvalcount = 0;
}

 
}
else
{
  digitalWrite(sb, LOW);
}
count++;

if (count > 55)
{
  count =0;
 
}

if((btread == 'A' && dval == 1 && rfidtagclose == 0) || btread == 'C')
{
   bowlopencnt =0;
}

if(bowlopencnt<5)
{
  digitalWrite(m2, HIGH);
                         digitalWrite(m1, LOW);
                         digitalWrite(ledpin, HIGH);
}
else
{
   digitalWrite(ledpin, LOW);
                          digitalWrite(m1, HIGH);
                          digitalWrite(m2, LOW);
}

dvalcount++;
if(dvalcount <250)
{
  dval =1;
}
else
{
  dval =0;
}
if (dvalcount >300)
{
  dvalcount = 295;
}

bowlopencnt++;
if(bowlopencnt>30)
{
  bowlopencnt =20;
}


rfidtag++;
if(rfidtag < 250)
{
  rfidtagclose = 1;
  dvalcount = 290;
}
else
{
rfidtagclose = 0;
}

if (rfidtag>300)
{
  rfidtag = 310;
}

delay(3);
//Serial.println(dvaltemp);


}
long Inches(long microseconds)
{
//calculation for speed of sound
  return microseconds / 74 / 2;
}


void suppressAll()                               
{
    if(Serial.available() > 0)
    { Serial.read();
      suppressAll();
    }
}


------------------------------------------------------------------------------------------------------------


This code can be optimized for the desired application.

Step 5: Use the Bowl

Now that the code is installed on the MSP430 and the hardware is set up, the bowl will now be operable. 

After the first prototype was made, a second more optimized model was constructed. All of the electronic circuitry was implanted in the bottom of the dog bowl where the original circuit board was.

We also purchased more powerful RFID tags so that the distance of the tags to the scanner could be increased. The tags were then attached to two dog collars. The red collar has the "wrong" dog tag on it while the black collar has the "right" tag attached. The video below shows the original prototype bowl  and the 2nd prototype in action.

http://www.youtube.com/watch?v=H9_31WN-UaA


Step 6: How It Works

The MSP430 uses a UART port to communicate with both the bluetooth module and the RFID reader. The Android App is a Bluetooth client that initiates the connection. The app sends a byte of data to the bluetooth module. When the "automatic dog mode" button is pressed, an "A" is sent over the bluetooth channel. The "open override" sends a "B" over the channel and the "close override" sends a "C". 

The Ultrasonic module is sent a high pulse from the MSP430, this tells it to make an ultrasonic sound pulse. The ultrasonic sensor listens for the return echo. The time delay in the echo is used to calculate the distance of the object that reflected the signal. This is based off of the speed of sound.

Since both the bluetooth module and RFID reader communicate to the MSP430 using UART and the MSP430 only has a single UART port, the port must be split up with the switch IC. For half of the loop the MSP communicates with the bluetooth module, and for the other half of the loop, the MSP communicates to the RFID reader. 

The H-bridge allow the MSP to control the motor. The MSP cant source enough current to diretly power the motor so the transistors, configured in an h-bridge configuration, act as current amplifiers.

A significant portion of the code is to control the timing of each event.

About This Instructable

4,731views

11favorites

More by dwhitfield6:RFABulous Dog Food Bowl 
Add instructable to: