Introduction: Dog Bowl 2.0

Some pet owners aren’t home throughout the day to feed their dogs when they need to be fed. This means that either the person has to leave work during the day to feed their dog or the dog just doesn’t get fed throughout the day. We created a design that will lift and lower the dog’s food bowl at certain points throughout the day so that it is fed at the correct times without the dog owner having to leave work.

Supplies

Step 1: How to Assemble, Download, and Connect

  • On the CPX, the tan cord is connected to the black cord, the white cord is connected to the cream cord, and the black cord is connected to the red cord. The black cord is connected to The VOUT port on the CPX, the tan cord is connected to the GND port, and the white cord is connected to the A2.
  • You can either use MakeCode or CircuitPython.
  • We used Thingiverse as inspiration for our 3D design.
  • You can use the 3D printed parts to create the design.
  • Use hot glue on the lid to connect the CPX, hold for 15 seconds, in case it doesn't stick.
  • https://www.tinkercad.com/things/fP802SQU95J-frantic-duup
  1. Imports:
  • time: Provides functions to work with time, like sleep() for pausing execution.
  • board: Provides an abstraction for hardware pin names.
  • pwmio: Allows PWM (Pulse Width Modulation) output.
  • servo from adafruit_motor: Allows control of servos.
  • cp from adafruit_circuitplayground: Provides access to Circuit Playground Express functionality.
  1. Initialization:
  • It sets up PWM output on pin A2 of the Circuit Playground Express with a frequency of 50Hz.
  • Initializes a continuous servo motor object (my_servo) using the PWM output.
  1. Main Loop:
  • The loop continually runs.
  • It sets the NeoPixels (LEDs) on the Circuit Playground Express to red ((50, 0, 0)).
  • It plays two tones (262 Hz and 294 Hz) for 1 second each using the built-in speaker.
  • It then performs a sequence of movements:
  1. Forward: Sets the servo to rotate in one direction (throttle = 1.0) for 2 seconds.
  2. Stop: Stops the servo (throttle = 0.0) for 2 seconds.
  3. Reverse: Sets the servo to rotate in the opposite direction (throttle = -1.0) for 2 seconds.
  4. Stop: Stops the servo again for 4 seconds.

Step 2: Printing Example

Step 3: CircuitPython Coding Example

  • Follow these instructions to install CircuitPython onto your CPX: https://learn.adafruit.com/welcome-to-circuitpython/installing-circuitpython
  • Connect your CPX to your computer and save code.py onto it
  • The provided code will:
  • Cause the motor to rotate clockwise when button A is pressed
  • Cause the motor to rotate counter-clockwise when button B is pressed
  • Light up when you shake it