Hello to everyone!
First time poster, but I've been playing with Arduino and electronics for a little while now.
I'm creating a 'pet food catapult', which throws dry pet food to spread it out and delay my dog simply eating all of her food within 1 minute.
I'll attach a fritz of my electronics, plus another actual photo of the working prototype. They are different in their power sources. In the living version I'm powering it by a DC power source putting out 9v 1A.
The idea is straight forward. One 360 degree servo (Rotator) pulls down the catapult arm via fishing line, until it touches the Limit Switch (using a 10k resistor). Another servo (Trigger) then locks it down. The Rotator winds back to unwind the fishing line.
The third servo (Delivery) turns a pipe and delivers a portion into the catapult. The Trigger releases the catapult and lets the food fling across the backyard.
However, what is driving me nuts is that it isn't consistent. When it follows my code, it works beautifully.
But, then, for no apparent reason one of the motors moves in a jittery back/forth motion. Especially the Delivery servo. Sometimes the Delivery servo or the Trigger will go back to old positions from what seems like old code, or reverse the positions I've told them to be in.
E.g. Trigger has two integers in the code TRH (trigger hold) TRR (trigger release). One is at 90, other at 160. When it's working properly, it goes to those two positions. Then for no apparent reason it will switch the positions and be at the wrong position at the wrong time.
I've read that some servos, especially the cheaper ones can do weird things and be generally unreliable. Is that is what is happening?
I've also had problems in the past by just using the breadboard. Where as soldering everything into a proper perf board (PCB) has solved things. Is that what is happening?
I've replaced the switch and the Arduino, to no effect.
I've attached the Arduino code. Excuse the messiness, it's gone through various iterations and I haven't had time to clean it up and add proper notations.
The more I write, the more I realise that I'm going to need videos as well.
I've got two videos, the first is where it works, the second is where it goes nuts.
However, this sites limitation is a max of 1Mb per file. Which is a ridiculously tiny video file.
So, unfortunately, I've had to upload them to YouTube, linked below:
Working normally: Flinger - working - YouTube
Going nuts: Flinger - going nuts - YouTube
It's all driving me a bit nuts. If anyone can assist I'd be very grateful!
Food Flinger Arduino code.txt (4.12 KB)