0

I am a complete noob in this field but am trying to embark on this project to modify an old automatic pet feeder to have better control by using Raspberry Pi. Below is a picture of what is under the hood, I believe it's a motor connected to a relay. The wires go to C and NO. The grey wires on the bottom go to an on/off switch and the red and black on the left go to the power inlet. The bundle goes up to what I assume is its micro controller.

I'm trying to control the motor with the Raspberry Pi with the least amount of modification. I'm wondering whether I can route the connections going to the relay to Raspberry's GPIO, or is it not as simple as that, or is it not possible to tell just by looking at this setup.

motor and relay

  • Simplest would be to wire the Pi to a transistor (2N2222 is a cool choice), and then to wire the output of the 2N2222 to the relay. DO NOT connect the relay directly to a GPIO pin. – Gene Dela Rosa Nov 29 '16 at 8:48
0

That looks like a micro-switch rather than a relay.

I'd guess that the micro-controller is starting the motor at set times (or has some other way of initiating the event) and the motor runs until the micro-switch closes (which is done by the knobbly bits turning and pushing the arm of the micro-switch in).

C is common and NO is normally open (meaning the switch is normally open but when the arm is pushed in it closes.

You will want to check the voltage on the NO wire both when the switch is activated and when it's not to ensure it is within the range of the GPIO pins (0v-3.3v).

I'd start by driving the motor from one of the Rapberry Pi GPIO pins (via a motor driver circuit or a transistor, as the GPIO will not supply enough power). Next I'd use the micro-switch to signal to a GPIO pin (possibly via a voltage divider circuit to get the voltage in the correct range) that we have reached the desired point and stop the motor.

Good luck!!

  • Ah thank you ! I should have tried running the motor to see what would happen earlier. But the knobbly things are indeed pressing on the micro-switch's arm and thats what stops the motor, the micro controller somehow sends a signal that starts the motor. I think i should be able to avoid the micro-switch altogether, as i could control the duration the motor runs for in my script. my next step is to try to figure out which one of the wires are supposed to be connected to the output of the transistor :). thanks again. – gangof4 Nov 29 '16 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.