Ideation
Working on part of the electrical circuit and code from the final project, testing the Bluetooth module, and getting more familiar with how it works .
The inspiration
the cat feeder🐱🐈
Getting ready for the final project 🥋
First, I built the electrical circuit on TinkerCad to test the wiring and code, and to make sure everything worked without issues, but without using the Bluetooth module in the simulation.
Later, I was able to obtain the Bluetooth module from previous versions in TinkerCad and successfully added it to a newer version, so that the circuit looks complete and functions without any problems .
The idea of this circuit is a simulation of my final project.
In short, I am building a cat feeder. The goal is to know if the amount of food in the container is running low, so I can decide whether I need to refill it or not. This is detected using the IR sensor.
If the food level drops below a certain threshold, the sensor sends a signal and the buzzer goes off as an alarm to notify that the food is low.
The servo motor is controlled via the Bluetooth module, which allows me to adjust the amount of food dispensed and the number of feeding cycles remotely using an app or available software.
The code was programmed so that each button works as a toggle on the first press the servo rotates a certain angle to dispense food.
On the second press of the same button, it rotates back to its original position
In our circuit, let’s clarify the inputs and outputs:
Inputs:
IR sensor: to detect the amount of food remaining in the container.
Bluetooth module: to remotely control the servo motor.
Outputs:
Buzzer: to alert when the food quantity is low.
Servo motor: to rotate and dispense the food
Note:
The Bluetooth module shown in the picture was taken from an older version of Tinkercad, as the current versions of it don't support the Bluetooth module .
This code is designed to control a servo motor using different input commands, while also running a buzzer that reacts to the IR sensor.
At the start, the program includes the servo library and defines the pins for the servo, buzzer, and IR sensor. In the setup(), the servo is attached to pin 6, the buzzer is set as an output, and the IR sensor is set as an input. The servo is initialized at angle 0.
Once everything is set up, the main loop() begins.
Here, the program reads the IR sensor state:
If the IR detects a signal (HIGH), the buzzer turns ON and OFF every 3 s making a beeping sound
If there is no signal (LOW), the buzzer stays OFF.
Next, the program checks if there’s any input from the Serial Monitor (when you type numbers 1–6).
If you send 1 → the servo toggles between 180° and 0°.
If you send 2 → it toggles between 150° and 0°.
If you send 3 → it toggles between 120° and 0°.
If you send 4 → it toggles between 90° and 0°.
If you send 5 → it toggles between 60° and 0°.
If you send 6 → it toggles between 30° and 0°.
The function toggleServo() is what makes this toggle behavior possible:
If the servo is already at the chosen angle, it goes back to 0.
If the servo is not at that angle, it moves to it.
After the movement, there is a short 5 s delay so the servo has time to reach the position. Then the new position is stored as the current angle
Note:
I programmed the code so that each button works as a toggle switch, allowing better control over the amount of food dispensed. I also added multiple servo angles to give more flexibility in adjusting the portion size
Development 🪓📦⚡🔌
First we connected the 5V and GND pins to the breadboard 🔴🟤
Then we connected the IR sensor as follows:
The VCC was connected to the 5V using a red wire 🔴
The GND was connected using a brown wire 🟤
The OUT pin was connected to pin 5 on the Arduino using a yellow wire🟡
For the servo motor, I decided to keep the jumper wires in the same colors as the servo’s own wires to make the wiring process easier
The VCC was connected to the 5V using a red wire 🔴
The GND was connected using a brown wire 🟤
The Signal was connected to pin 6 on the Arduino using a Orange wire🟠
For the buzzer,
I connected the positive terminal to Pin 7 on the Arduino using a blue wire 🔵
The negative terminal was connected to GND using a gray wire 🌫️
Finally, for the Bluetooth module:
I connected the VCC to the 5V using a red wire 🔴
The GND was connected with a brown wire 🟤
The TXD pin of the module was connected to Pin 0 (RXD) on the Arduino using a blue wire 🔵
The RXD pin of the module was connected to Pin 1 (TXD) on the Arduino using a green wire🟢
Final Result 🥳✨
As this week’s task was clear and manageable, I didn’t need much feedback. However, some peers suggested adding an LCD to display the servo rotations, so I can track how many meals were given.
This week’s challenge, as it turned out, was the Bluetooth module unexpected of course 😂😂🤣
There were a couple of issues: the module kept disconnecting and freezing, which made the connection and control difficult.
Also, when trying to upload the code to the circuit, because the TXD and RXD pins were connected, the upload wouldn’t work. Even if I disconnected the wires, it still failed. The only way that worked was completely removing the Bluetooth module, uploading the code, and then reconnecting it afterward.
Finally, another issue I faced and solved with help from my peers was that the two wires connected to TXD and RXD were loose and often caused disconnections. This was also one of the reasons why the module was unstable. After replacing them, the Bluetooth module stayed connected for much longer than before.
اقفل ال Bluetooth module و افتحه تاني
This week’s experience gave me ideas that I can add to my Cat Feeder final project. I learned how to use Bluetooth with Arduino, which means I could control the feeder wirelessly and manage how much food is dispensed from a distance. I also understood the importance of stable power and a common ground when connecting multiple components, which will help me avoid the connection problems I faced this week
This week we worked on building and programming a robotic arm, which allowed me to combine mechanical design, electronics, and coding in a practical way. It was exciting to see the arm respond and perform simple tasks. Even though we didn’t win, this experience gave me valuable lessons and strong motivation to keep improving. It showed me what I need to work on, and encouraged me to develop my skills further for future projects