element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Pi Chef Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Pi Chef Design Challenge
  • More
  • Cancel
Pi Chef Design Challenge
Blog Cracked pepper sir? (Don't move) Pi Chef Challenge Blog post #5
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: crackedpepper
  • Date Created: 12 Feb 2018 10:15 AM Date Created
  • Views 782 views
  • Likes 7 likes
  • Comments 5 comments
  • pichef
Related
Recommended

Cracked pepper sir? (Don't move) Pi Chef Challenge Blog post #5

crackedpepper
crackedpepper
12 Feb 2018

This week i was planning on getting into the production of the robot arm. Unfortunately as I hadn't grabbed the 3D printer i was planning to use I couldn't get started on it.

 

I decided instead to implement motion detection to start the voice recognition software. The plan i had for the flow of control is illustrated in the following diagram.

image

After doing a bit of digging i decided that using motion would be the easiest way to implement motion detection. So i ran the install via apt. Once installed I played with motion using the default settings to make sure it was working. I had a bit of trouble here as i was trying to use the Raspberry pi camera as the source, this doesn't work out of the box but you can get it running by executing the following command (which needs to be rerun after each reboot):

sudo modprobe bcm2835-v4l2

Once i had that sorted I then got into configuring the settings. The settings can be found in /etc/motion/motion.conf, I ended up changing the following settings:

output_pictures off

ffmpeg_output_movies off

stream_port 0

on_motion_detected /usr/bin/python3 /home/pi/on_picture.py

Initially I tested using a simple script which wrote a file with the datetime it was invoked. Once i had that working i moved onto implementing the flow above.

I started off by adding the code to listen to on a socket (8888 seemed reasonable), I then changed the on_motion_detected setting to "telnet loaclhost 8888". This didn't work initially but I quickly realised that was only because telnet wasn't installed by default (sad times). I tested this using a simple script which listened to the port and wrote to a file as before. The code for this can be found below:

 

from datetime import datetime

import socket

import sys

 

#create a socket to listen on

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

 

try:

    s.bind(('', 8888))

except socket.error as msg:

    print('Bind failed. Error Code : ' + str(msg[0]) + ' Message ' + msg[1])

    sys.exit()

  

print('Socket bind complete')

 

s.listen(10)

print('Socket now listening')

 

while 1:

    #wait to accept a connection

    print("waiting for connection")

    conn, addr = s.accept()

  

    #write a file with datetime when a connection is made

    file = open("/home/pi/test.txt","w")

    file.write("called from motion detection " + str(datetime.now()) + "\n")

    file.close()

   conn.close()

Combing the motion with the voice activation wasnt too hard. The end result can be found on my github as usual.

 

*Other items of note from the week are that I actually ordered the servos I'm planning to use in the robot arm here is a link. I also picked up the 3D printer off my friend today (thanks Ed), its a Micro 3D and has a very small print bed but I think I can make it work.

  • Sign in to reply

Top Comments

  • genebren
    genebren over 7 years ago +2
    Nice work. Sometimes it takes a lot of work to get things to work, but you are making good progress. Hopefully the fun stuff (robot arm) will go smoothly. Keep up the good work! Gene
  • e14phil
    e14phil over 7 years ago +2
    only tip with the 3D printer is PRINT PRINT PRINT... again and again, just use it until you have it honed in.
  • e14phil
    e14phil over 7 years ago +1
    Looking forward to seeing the arm :-)
Parents
  • e14phil
    e14phil over 7 years ago

    Looking forward to seeing the arm :-)

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • e14phil
    e14phil over 7 years ago

    Looking forward to seeing the arm :-)

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
  • crackedpepper
    crackedpepper over 7 years ago in reply to e14phil

    looking forward to making it but at the same time I'm a little nervous, it's definitely going to be harder than my work so far

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube