MotionEye notes

Viewed 32 times

I have a pi 3B and a relay board – “5V relay module is active LOW, meaning that LOW level will activate the relay on and HIGH level will deactivate it.” .

I have connected 5V to Vcc on the relay, ground to gnd and another pin and Pin 12 to ch1.

This setup works as the relay will turn on with movement but the relay goes straight off.

I am using motioneye to “run a command” and “run an end command” in the movement notification section.

I need the space on the SD card so didn’t want to install Python although I can if required. It also seems a bit OTT for a simple GPIO output.

My two bash scripts are below and they have bee given 755 permissions.

lightOn.sh ( run a command )


echo "18" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio18/direction
echo "0" > /sys/class/gpio/gpio18/value
# I have tried adding sleep 60s here

lightOff.sh ( run an end command )


echo "18" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio18/direction
# I have tried adding sleep 60s here
echo "1" > /sys/class/gpio/gpio18/value

I have no experience with bash and have no idea why the above will not work; I have added sleep 60s without success in different places.

Can somebody point out what I am doing wrong?

Note: If I swap the values around the relay never goes off.

 New contributor
  • Ah, I don’t know nothing of MotionEye. Let me google and see if I can help: “How does MotionEye work?” raspberrypi.org/forums/viewtopic.php?t=238708#p1458704 – tlfong01 11 hours ago
  • Thank you for your anonymous down votes and passive aggressive reply. I do have Motioneye working and have spent quite few hours trying to get the next step working. Believe me my last resort was asking a question here as I was half expecting this sort of thing. – Bonzo 2 hours ago
  • Hi @Bonzo, I am sorry to have misled you thinking that I have downvoted your question. To clarifyl, I did NOT downvote your question. Actually I have not downvoted any question or answer for the last couple of months. I think my down vote or upvote ratio in this forum is perhaps 1 to 95. Just now I upvoted your question, to convenience you that I did not downvoted you. Comments welcome. – tlfong01 53 mins ago
  • Now coming to the “passive aggressive reply”. I am not sure if my words “I don’t know nothing …” is impolite or rude. I am using these words because I know they are used by those who do not speak proper English. Actually I was an ex-refugee and only started learning alphabets A, B, C when I was eight years old. One thing I think I might have misled you may be I said I might google and see if I can help later. Unfortunately I did not carry on and because I got tied up in other answers I already started and need to spend more time to complete. / to continue, – tlfong01 45 mins ago
  • Actually my first comment is only stating a fact that I have not heard of MonionEye, and that I would google to learn more. Let me see if I can remember what I thought after reading the thread of posts I referred. My first impression is that it is a new thing worth looking deeper. I did watch the youtube video referred in the first or second post and found it interesting. Actually I noted the web link but did not recommend it in time, therefore causing the misunderstanding. – tlfong01 38 mins ago
  • One other reason that I did not answer right away is that your question is actually in two parts, the first part is on low trigger relay, second part on MotionEye. Actually low trigger relay is my favourite subject. As usual, didn’t know nothing about Arduino/Rpi relay when I joined this and another forum last year. If you search relay KY019 in this and other forums, you might find that my posted started with my fist thread is over 1,000. – tlfong01 33 mins ago
  • Ah, now I remember what I think about the MotionEye video. (1) The video is by a popular guy who made many other videos, and I rank him top 5% of all the educational video I watched. – tlfong01 20 mins ago
  • (2) I have been playing with object detection for a long while, using AI, NN, PIR etc. MotionEye is different in that it does NOT detect object, but note the difference between two frames. In a way it is much easier to implement. One last thing I notice the guy gave the MotionEye demo. I thought he was a very smart teacher because he did the following in the last few minutes. From standing position, he squashed down. It took me a couple of seconds to appreciate why he did not keep standing up earlier, … You might like to tell me why he did so, before I move on, … – tlfong01 17 mins ago
  • Sorry for all the typos, actually I was hopping among different newspaper and forums on different topics. So I might have confused you because I mixed you topic with others.:) – tlfong01 17 mins ago
  • I search my penzu diary to refresh my memory. Now I remember the funny guy making very professional video is called Christ Barnatt. I am a huge fan of him. I only recommend his video yesterday. raspberrypi.stackexchange.com/questions/106559/…. – tlfong01 8 mins ago
  • This is one of the perhaps more than 100, yes 100 answers I gave to explain the problem of low level trigger relays: raspberrypi.stackexchange.com/questions/99988/… – tlfong01 3 mins ago   Edit
  • And this is the first of my 500+ posts on KY019 relay and related topics, mainly on home automation, and follow up questions: raspberrypi.org/forums/viewtopic.php?f=37&t=77158#p1323061 – tlfong01 40 secs ago   Edit

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: