Love Note From Arduino!

KUWTP Ep. 23 | 21st August 2024 | Assembling the pet food dispenser

See how our motor turns continuously? It is very mindful, very demure, very cutesy. Hopefully you have been doom-scrolling enough tiktok and are updated on the current trend where actions are described by Gen Zs as mindful, demure and cutesy! We unboxed our brand new Arduino R4 Wifi microcontroller today and were delighted by the cute graphics displayed on the microcontroller (see middle picture for the heart displayed on the board!). Truly a random piece of information but we are easily impressed people #justagirl. Our main goal for today was to fix up our pet food dispenser and test out our newest gadget – the continuous servo motor.

While assembling our parts, we realised that the shaft printed out was of the incorrect dimensions and thus did not fit onto the blade of our servo motor. The off measurements of the 3D-printed shaft was a steep obstacle as the blades of the servo motor require a M1 screw (an extremely thin screw), and even the slightest mm off would result in us being unable to align the holes on the shaft to those on the blade of our servo motor. We are currently in the midst of editing the 3D model on Autodesk Fusion360 so stay updated to see our new prints (we are also in the process of revamping and improving on our other previously 3D parts!). Another upgrade we will be adding to our pet food dispenser would be to add a funnel-like component below the rubber turbine which slows the rate of food dispensed to reduce the occurrence of too much food being dispensed – accounting for the delay between weighing scale and stopping of motor.

After the semi-successful assembly, we whipped out our MacBooks (or laptop for the non-subscribers of the bussin’ apple ecosystem, NOT SPONSORED sadly) and got to coding! Okay, backtrack slightly as we actually had to google and figure out the connections for our servo motor to Arduino. We are truly indebted to the great power of the internet as it has provided us with ample guidance throughout this project. Referring to this blog posted on MakerGuides, we chose the most basic connection for the servo motor just to get it running. What we learnt is that the 3 wires out from the servo motor correspond to GND, 5V and Control and are assigned as black, red and white respectively. As the name suggests and intuitively, GND and 5V are power pins and Control is a signal input pin.

While coding the motor, we encountered a problem – the code to stop the motor did not work. Most forums (and even ChatGPT) advised the stop code to be “myservo.write(90)” which would supposedly return the servo motor to the neutral position and thus stop it. However, a deep dive into an thread on the Arduino forum taught us that this command would work on most servo motors, but not a continuous servo motor. This is because a continuous servo motor has no feedback mechanism within it and does not know its angular position. When the code “myservo.write(90)” is given, it rotates towards position 90 but has no means of knowing when the position has been reached so it continues to rotate. However, a work around it would be to code “myservo.detach()” instead, where we basically stop the servo signal completely thus stopping the motor immediately. The next step to take in coding would be to figure out how to control the speed of rotation. We aim to code the motor such that as the weighing scale approaches a reading close to the ideal mass of pet food, it rotates at a slower speed to allow the mass of food dispensed to be more accurate as smaller portions would be dispensed. Check out the videos below to see our (demure, mindful and cutesy) servo motor in action!

Leave a Reply

Your email address will not be published. Required fields are marked *