Training an anxious puppy
This project was to help with the separation anxiety of my dog. As a COVID puppy, he was full of anxiety and stress, constantly barking when in different rooms and unable to eat or drink water when alone as well. This project aimed to create a device which would be fully configurable remotely, operate autonomously, and train better behaviors. According to many (pretty much all) dog training websites, the key is to leave the dog alone for small increments of time until the dog got used to it, reward the behavior, then slowly increase the time spent alone. This will allow the dog to get comfortable with the concept of being alone and the rewards teach it as a good behavior. As I work from home this would prove challenging unless I kept him in another room, which I was able to with the setup.
Overview
A timer was started for the pre-determined amount of time (say 5 minutes to start, moving up in 5 minute intervals). Keeping quiet for the whole duration would activate the motor to dispense treats and play a happy sound over the speaker. Any barks, which would be heard by the tuned mic, reset the timer for treats. All stats on barks, treats dispensed, and so on would be logged to a server which would also provide a front end to visualize the result so I could see improvement (hopefully) over time.
The Hardware
The hardware device was an Arduino microcontroller, a motor, a treats dispenser, mic, speaker, and a collection of treats. Power was supplied via battery to ensure no cable chewing would take place, so additional hardware was required to ensure the motor’s power draw did not affect the microcontroller. While the first prototype was done on a cardboard using old Amazon shipping boxes, the final design was 3D printed and mounted very firmly. The quality of the prototypes did affect the result so the final result had to have extra post processing done to ensure nothing failed or fell over.
The Firmware
The Arduino device had an ESP8266 module to allow for Wi-Fi connections. As a result, every event could be sent via REST protocol to a server running in the local network that would handle these events. Aside from this, I just had to add support for the mic and speaker and motor driver corresponding to how I wired the setup.
The software refers to the webserver which was a fullstack MEVN application. The backend would be listening to REST calls from the Arduino which contained info on barks, treats, and so on. It also provided a way to adjust the pre-determined amounts of time remotely without needing to enter the room, and manual commands to issue treats. The remote programming allowed for automatic increasing of the pre-determined intervals to perform the training without need of my intervention either. These results would be logged into a database and then visualized in the frontend Vue application which would plot the results so I could more easily see the progress and results. *Video to be posted very soon!