Introduction: Smart Dog Play

If you want your dog to have a unique toy that was made by you - then you're looking for a Smart Dog Play!

This toy has some unique elements that you can control over them while your dog enjoys this special toy:

> Lights and Beeper control so you can see the toy when it's dark and find it with the beeper sound when it's lost.

> Train your dog to press a button of a remote controller to tell you whenever the dog wants a treat.

> With Not At Home mode you can get notification whenever your dog is on the couch while you're not at home and it warns your dog with a sound.

> Put It In a Box game where your dog needs to put the toy in a box, and at the end of the day you will be able to see the dog's score.

Supplies

- 2 Circuit Playground Express (CPX) Boards

- 6 batteries and 2 batteries cartidges

- Any kind of box

- A bottle or anything that you can put the CPX in it (which will act as the toy itself)

- A remote controller

- Smartphone

- Computer with any internet access

Step 1: Creating the Toy

While you can use almost anything, we recommend to use any kind of product that will suits your dog, so it can play with it and grab it with its mouth.

You want the toy to be able to store the CPX board and its battery cartidge. Make sure to fill the bottle with cotton or any soft product that will make sure the CPX won't get damaged, as well as to make sure that the CPX is still visible (so you can see the lights) and that you can close the toy after putting the CPX in it.

Finally, you can draw whatever you want on it to make it look special!

Step 2: Integromat

First, you need to make an Integromat account (at integromat.com). After that, make sure that you know how to use that platform at a very simple level. Once done, make a new scenario as follows:

1. Add the "Webhook" module (Custome Webhook). Name it and copy the link that you're given.

2. Connect it to a "Google Sheets" module (Add a row). You will need to connect it to a Google account and after you give it permissions, link it to one of your sheets in your Google Sheets. For the first column, add the current date and time (now variable), and the second column will contain the points for each succeful try. You can also design it however you like.

3. Make sure to schedule your scenario with the desired intervals, and turn in on whenever you want to play with your dog.

Step 3: Blynk

The Blynk is the application that lets you control over the CPX that's inside the bottle. Within it, we will create our menu.

1. Download the Blynk to your Smartphone from the AppStore/PlayStore.

2. Create a new project and add your device (Arduino MKR1000). Once done, you will receive an Auth Token - we will need that for later. After that, make sure to add the second CPX board as shown in image 2. Pay attention that each CPX board has its own Auth Token.

3. Now we start making the menu. From the Widget Box, add 3 Styled Buttons, 1 Webhook and 1 Notification.

4. Make sure that you fill the settings for each of the widgets just as shown in the images;

Beeper - V1; CPX1; Switch

Lights - V2; CPX1; Switch

Not At Home - V3; CPX1; Switch

Webhook - V5; CPX2; URL - paste the URL that you've recieved in Step 2.1; Post; text/plain

5. You can now design the menu however you like. Pay attention that when you will run the CPX code, the labels' names will be modified as in this tutorial.

Step 4: Remote Controller

You can use any remote controller that uses IR. In this step we will extract the desired details of the remote controller that we will need later on.

1. Choose the remote controller that you want.

2. Download the Infrared_Read.ino file below.

3. Connect your CPX board to the computer, open Arduino IDE and upload the file to the CPX.

4. Open the Serial Monitor. All we see in the beginning are just null details. Point your remote controller to the CPX and press a button. You should see a line with details different than 0's in your serial monitor (as shown in the image).

5. Write down the circled values in the image: the blue circle is the IR protocol, the green one is the IR value and the purple circle is the IR bits. We will use those values in the next step.

Step 5: CPX

In this step, we will upload the codes to the CPX boards. Make sure that you know which one will be act as the main CPX and which one will be inside the box.

1. Download the three files below. SDP-CPX1.ino needs to be in one library while SDP-CPX2.ino and coin.h needs to be in the same library.

2. Using Arduino IDE, edit the CPX files and enter the Auth Tokens you've received in step 3 and your Wi-Fi network's details in both files. In SDP-CPX1.ino, enter the details of your remote controller from step 4.5.

3. Now, upload SCP-CPX1 to your main CPX board and SCP-CPX2 to the second CPX board.

Step 6: Play With Your Dog!

Now, run all the things at once: The CPX boards' codes, the Blynk application and the Integromat scenario. Connect the CPX boards to the battery cartidges, put one of them in the toy and the other in the box.

You are now ready to use the Smart Dog Play! Make room for your dog's new favourite toy!