Chicken feed

wlie

Member
I have built a circuit that controls a small motor.
The motor lifts the food for my hens about 1/2 meter so that the hens can't get food.
Next morning the motor will lower the food again.
This is to avoid feeding rats at night.
The engine must run until a micro switch on a string disconnects the power to the motor.

Problem: One evening the cord broke and the motor ran continuously all night.
I have no imagination how to program this simple circuit to interrupt
the motor after eg. 1 hour if the string should break again.

Here's a bit of the simple program:
Code:
      [color=Blue]high StartMotor[/color][color=Green]; Drive until UpAktivSW = 1[/color]
[color=Black]wait6:
      [/color][color=Blue]if [/color][color=Purple]UpAktivSW [/color][color=DarkCyan]= [/color][color=Navy]0 [/color][color=Blue]then goto [/color][color=Black]wait6
      [/color][color=Blue]low StartMotor[/color]
 

AllyCat

Senior Member
Hi William,

There are many ways "to skin a cat" (or defeat a Rat) but with an M2 the simplest modification could be to use the time variable (which automatically counts seconds):

Code:
      high StartMotor    ; Drive until UpAktivSW = 1
      time = 0
wait6:
      if UpAktivSW = 0 AND time < 3600 then goto wait6
      low StartMotor
The reason for the AND is that the loop is "broken" unless both conditions are true.

For X2s, or people who dislike GOTOs, you might use:

Code:
   high StartMotor                  ; Drive until UpAktivSW = 1
   for runtime = 0 to 3600         ; runtime is a word variable
      if UpAktivSW = 1 then exit  ; Quit the FOR loop
      pause 1000		          ; 1 second delay
   next   
   low StartMotor
Cheers, Alan.
 

oracacle

Senior Member
this should work on any M2 and is a different take on allycats X2 suggestion

Code:
	high startmotor
	time = 0
	do while UpAktivSW = 0 and time < 3600
	loop
	low startmotor
 

premelec

Senior Member
And use a piece of woven steel bicycle cable instead of string... i thought rats could jump 1/2 meter too ;-0
 

oracacle

Senior Member
easily, I have seen them climb concrete walls and all sorts.
The best bet is to put the stuff in a heavy steel box - they can chew through steel but it will take a while.
 

The bear

Senior Member
@wile,
I like your sense of humour.
You could use a piece of cycle chain, as in bike.
Good luck.
Regards, bear..
 

wlie

Member
Thanks for all the good advice
..and the comments about rats - also I will increase the string and use steel.
 

inglewoodpete

Senior Member
Flexible stainless steel cable can be purchased from boating and rigging stores (in Australia, at least:)). I recently purchased 1mm diameter (breaking strain 125kg!!).
 

oracacle

Senior Member
it would have to be a farm cat. Most domesticated cats lack the skills to catch prey as large as a rat. Most cats use their front paws to hold down there prey, rats are too large and strong for this technique. Farm cats learn from their mothers to pounce with all four paws on the rat using the cats entire weight to overpower the rat so that the kill can be made.
another option would a small dog like a jack russel, they were bred for hunting and killing small prey like rabbits and rats. or you could go the ferret route but they're just a long bendy rat realy
 
Top