Wednesday, 27 January 2016

Servo Motor Control (In Progress)

My cat feeder design is simple - there are 4 boxes (food containers) on each side of the feeder which are spring loaded, which will open if the lid is not kept closed. So these boxes will be kept shut to keep the cat food fresh for as long as possible. They will be kept sealed by using servo motors at each box position that will prevent and stop the lids from being sprung open. This then simply requires a simple rotation on the motor to stop the lid from being kept shut. Once the servo is not rotated on the box lid, it will open and provide access to the food.

 I will also be using these motors with the raspberry pi so that all of the feeders functionality is available from the single device that will later be contacted (this may be done by having simple commands in a facade pattern call specified scripts for different functions). I have researched into directly controlling the (two) servo motors I have available to me, but it seems as if I need an additional wire to divide the pins up onto the GPIO board correctly - this would be an issue too if I was to try and connect more to control.

Furthermore I decided that I needed to research into this more and see how connecting a total of 9 servos would be possible. The first device I came across was the Ardunio which is a micro controller that can control servo's PWM (using analogWrite from the library available). Further research into the device proved some of the Arduino models but there seemed to be constraints such as requiring external PSU's when there are a lot of servos (2+ generally was suggested). This would be an issue as I require 9 and would prefer to not need more than the raspberry pi being powered - but this is still a viable option.

After looking into the Arduino I decided to look into other options, and so I came across another option called the Adafruit 16-Channel PWM / Servo HAT. This device is specifically made to power servos with the raspberry pi - the HAT aspect (Hardware Attached on Top) allows for this. The device allows for up to 16 servos to be connected meaning it would be able to operate the desired 9 for my cat feeder. The device similar to the Arduino, has a Python library (this would be beneficial for the web server aspect I plan on implementing). However, there is an issue with it as it is also likely to require an external power source (PSU). This would likely increase the cost quite a lot if using a DC plug - an alternative option provided is using 4x AA batteries. Using batteries would obviously also bring an issue of replacing them if they ran out, but as the cat feeder is not meant as a commercial product, this is not too much of a concern. If it was a commercial product I would look for a method where a PSU is not required, but most options that are inexpensive seem to require similar features of the Adafruit HAT here.

I will look further into this subject of operating the servos, but at this point I have made a small comparison between the two devices I have looked into below.


By Jonathan Grant

References:

No comments:

Post a Comment