Main Menu

Secondary Menu

Invisible Dog Trainer

Introduction: Invisible Dog Trainer

With a pressure sensor, led and speaker you can turn your Pi into an invisible dog trainer that trains your dog to get off the couch. When the dog sits on the couch, the led blinks and the dog receives the command “Get off the couch”. When the dog gets off the couch it will hear the command “Good dog”. This application was featured in the Bitreactive blog.

Step 1: Install Reactive Blocks

Step 2: Download the Couch Monitor From the Libraries

In the Eclipse editor on the left side there are two different views: the Blocks view and the Package Explorer view. Make sure you are in the blocks view and select the import button

Select the Couch Monitoring with Raspberry Pi under tutorials.

At this point you will be asked to register. This will give you immediate access to tutorials, modifiable systems and libraries.

Step 3: Understand the System

The system consists of 4 reusable building blocks. The light blue boxes are Java code. If you click on the Java code it will open up in a new window. See if you understand how the system works.

Step 4: Generate Executable Code

Right click and select build from the context menu. Choose Java SE

Step 5: Export As Runnable JAR

After the code generation the package explorer view will open with new new project marked in yellow. It should look something like this (maybe with different project name).

Right click on the exe project / Export and select the CouchMonitor Luanch configuration. Choose a name for the runnable JAR, e.g. CouchMonitor.jar

Step 6: Prepare Your Raspberry Pi

If you are new to the Raspberry Pi, you have to set it up first:

- Prepare the SD card (we have tested using NOOBS)Insert the SD card into the Raspberry Pi

- Connect the speakerConnect networkConnect the sensor (data to GPIO0, which is pin number 11)

- Connect the LED (to GPIO3, which is pin number 15)Start the Raspberry Pi by connecting the mircro USB for power supply.

- Find out the IP address of your Raspberry Pi (that is why you want a monitor connected to it at least for the first time. When started up, your Raspberry Pi will report something like: “My IP address is 10.10.15.107”.)

- We have tested with Raspbian (default login: pi, password: raspberry), which includes Java by default.

Step 7: Run the Application on Your Raspberry Pi

- Log in to the Raspberry Pi (for the default login see Step 4), either directly or remotely via ssh.

- Check if the runnable JAR file (couchmonitor.jar) has been copied to the Raspberry Pi.

- When the application is running, the LED will start blinking in case the pressure sensor is triggered and your dog will be told off: “Get off the couch!” When the dog leaves the couch, blinking will stop and the dog will be told “Good dog!”

Step 8: Extend Your Application

Maybe you want the application to remind your dog in case it stays on the couch anyway and does not leave when told so. Learn to extend your system in the Reactive Blocks tutorial