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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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
Raspberry Pi Projects
  • Products
  • Raspberry Pi
  • Raspberry Pi Projects
  • More
  • Cancel
Raspberry Pi Projects
Blog Foginator 2000: #006 Final Assembly and Testing
  • Blog
  • Documents
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi Projects to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: CharlesGantt
  • Date Created: 31 Oct 2015 2:08 PM Date Created
  • Views 844 views
  • Likes 1 like
  • Comments 3 comments
  • raspberry
  • foginator2000
  • fog
  • sense
  • pi
  • halloween15
  • initial
  • iot
  • machine
  • raspberry_pi_projects
  • state
  • hat
  • automation
Related
Recommended

Foginator 2000: #006 Final Assembly and Testing

CharlesGantt
CharlesGantt
31 Oct 2015

image

 

Welcome back to Project: Foginator 20000! In this installment we are going begin wrapping the build up by moving everything from  the breadboard, to a prototyping PCB, and then placing it all into an enclosure. Then we will wrap everything up with a demonstration of the final code. There will be one more installment after this one, which will include actual data from Halloween night. I will also finalize the bill of materials in the final post as well.

 

 

The Parts

 

The only special parts we are using tonight is a piece of prototyping board, and a project enclosure. You will need something to cut holes into the project box. I used a dremel multitool with a cutoff wheel, drill bits, and some hand files to accomplish this. You will also need a hot glue gun, to secure the PCBs and the motion sensor.

 

MCM Part No.

Notes

Qty

Manufacturer / Description

21-16075

Prototyping Board

1

Circuit Board - 750 Holes

21-15178

Project Enclosure

1

ABS Case Gray - 5-5/8" x 3-1/8" x 1-3/16"

 

 

 

The Build

 

image

 

To get started let’s look at how the project box is laid out internally. Idealy, a 5” thick box would be used so that the Raspberry PI and Sense Hat could be placed in the enclosure as well. Unfortunately I was unable to find one large enough at Newark or MCM Electronics. So we are going to use this enclosure that is just large enough to house the rest of the electronics.

 

image

 

The inside of the project enclosure has several standoffs on one side, and just the enclosures screw standoffs on the other. I am going to use the clean side as the bottom of the box since none of my boards will align with the mounting standoffs on the other side.

 

image

 

This is the main portion of what we need to move to a prototyping PCB. The Arduino Nano, a pulldown resistor, and the LED cable connections.

 

image

 

I am again using a Protostack protoboard as I have several laying around. You can use any prototyping board you would like though. I chose to only solder the pins that I was using as well as the 5V and GND pins.

 

image

 

Here you can see that I used jumper wires to connect the GND and 5V lines on the Arduino Nano to the GND and VCC rails on the prototyping board. That is why I love these little boards from Prototstack. They are laid out like a breadboard, with five of the holes connected, and the power rails encircling everything.

 

image

 

With the power connections made, I soldered in the Neopixel strip. I am not a fan of the microphone cable I used for the connection when soldering to these boards. Their holes are designed for smaller through hole pins, but with a little finesse it fits well. You will notice that I did not solder in the Neopixel ring. I think I killed it on accident, as I could not get it to light up at all.

 

image

 

Here you can see the basic layout . Notice I notched both the Arduino protoboard and the 5V power supply board. I forgot to take pics of this process, but I used a hacksaw blade to cut them. A dremel would work too but it produces a lot of glass fiber dust that is very bad to breath. The relay sits on the right, and the PIR sensor will be placed in the top cover through a hole.

 

image

 

This enclosure needs several holes for the wiring to exit. Here you can see some of them laid out. I used a dremel tool, a drill and drill bit, and some hand files to create and clean up these holes.

 

image

 

Here’s the hole roughed out for the PIR sensor. It is important to get the sensor mounting flush with the top of the case for space concerns inside.

 

image

 

Once everything is fitting nice and tight, I used hot glue to secure the PIR sensor to the case. Note that I hot glued the jumper wires to the pins as well. This prevents them from pulling loose later.

 

image

 

Here you can see everything glued into place, and the power wire ran to the power supply. Not pictured is the dobs of glue that I used to hold all the wires that exit the case in place.

 

image

 

While it is not the most discrete motion sensing project enclosure ever made, it sure does look good once everything is closed up nice and tight.

 

image

 

Thinking ahead in case I ever wanted to reprogram the Arduino, I cut a slot that would allow me to plug in a USB cable. I made the slot oversize as the USB cables I like to keep handy, have a bit of a thicker encasement around the tip.

 

image

 

Unfortunately I was unable to fit the Raspberry Pi and Sense Hat inside this project enclosure as I had planned. I needed to keep the stack close to the peripheral boards, so I simply hot glued it to the back of the enclosure.

 

image

 

And a final shot of everything connected and ready to go! Note that the Raspberry Pi has been reoriented in this image. I forgot about the audio cable, and the original way I mounted it would not allow for it to be plugged in and the enclosure still be able to sit upright.

 

image

 

Due to a lack of time, I simply chose to mount the project enclosure on top of the fog machine using some velcro and hot glue. While this is not ideal, it does work quite well.

 

image

 

Looking at it from the back, you can see how starved for space this project is. Note the speaker. I found that for small things, blue tape on the fog machine’s surface helps hold the hot glue better.

 

image

 

Looking at the back you can see how I mounted the audio amplifier and the fog machine remote switch. Again, blue tape came in handy here to help the hot glue stick better.

 

image

 

The Final Code

 

 

I have merged all of the code together and added in some print lines that help troubleshooting any issues. To record the data, you will need to sign up for an Initial State account, and then generate a new API key for your account. You can download this code from its Github Repository which can be found here.

 

 

__author__ = 'Charles Gantt'
# This code is part of the Foginator 2000 project developed for the Halloween15 Raspberry Pi Project event at Element14.com and can be found at http://bit.ly/foginator2000


import RPi.GPIO as GPIO
import time
import sys
from sense_hat import SenseHat
from ISStreamer.Streamer import Streamer


logger = Streamer(bucket_name="Foginator2000_Data_10/23/2015", access_key="zLahwAUqKbNKv6YvuT5JuO58EiUOavDa")


sense = SenseHat()
sense.clear()
sensing = True
fog_Armed = True




GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.OUT)
GPIO.setup(17, GPIO.IN)
GPIO.setup(21, GPIO.OUT)


O = (0, 255, 0) # Green
X = (0, 0, 0) # Black


creeper_pixels = [
    O, O, O, O, O, O, O, O,
    O, O, O, O, O, O, O, O,
    O, X, X, O, O, X, X, O,
    O, X, X, O, O, X, X, O,
    O, O, O, X, X, O, O, O,
    O, O, X, X, X, X, O, O,
    O, O, X, X, X, X, O, O,
    O, O, X, O, O, X, O, O
]


black_pixels = [
    X, X, X, X, X, X, X, X,
    X, X, X, X, X, X, X, X,
    X, X, X, X, X, X, X, X,
    X, X, X, X, X, X, X, X,
    X, X, X, X, X, X, X, X,
    X, X, X, X, X, X, X, X,
    X, X, X, X, X, X, X, X,
    X, X, X, X, X, X, X, X
]


var = 0


def is_integration():
  while sensing == True:
        print "IS Start"
        temp = sense.get_temperature()
        temp = round(temp, 1)
        logger.log("Teperature C",temp)
        print "T1"
        humidity = sense.get_humidity()
        humidity = round(humidity, 1)
        logger.log("Humidity :",humidity)
        print "H1"
        pressure = sense.get_pressure()
        pressure = round(pressure, 1)
        logger.log("Pressure:",pressure)
        print "P1"
        logger.log("Trick Or Treat Event #",var)
        print "ToT Event Logged"
        sense.set_pixels(creeper_pixels)
        time.sleep(2)
        sense.set_pixels(black_pixels)
        sense.clear()
        print "IS Done"
        break


def fire_fog():
    while fog_Armed == True:
        print "Trick or Treat Event Sensed"
        print "Lights Start"
        GPIO.output(21,True)
        time.sleep(2)
        print "Relay Triggered"
        GPIO.output(4,True)
        time.sleep(10)
        print "Relay Disabled"
        GPIO.output(4,False)
        time.sleep(20)
        print "Lights Disabled"
        GPIO.output(21,False)
        is_integration()
        print "Trick or Treat Event Finished"
        time.sleep(10)
        print "Watching For Motion"
        break


while True:
    time.sleep(3)
    if GPIO.input(17)==True:
        var = var +1
        print ("var =", var)
        print "Motion Detected"
        fire_fog()
       

 

This code has been modified to run continuously while always looking for a motion trigger. To make this code run when you plug the Raspberry Pi in, you will need to set the python script to run on startup via the cron tab.

 

 

The Data

 

 

To recap, we are using the Sense Hat to record a few environmental data points including air temperature, humidity and air pressure. The Raspberry Pi then pushes that data to a remote server at Initial State, which then processes it, and displays it in nice graphs, and other visualizations. I have also added a fourth metric called “Trick or Treat Event” that simply increments by one every time a motion event is detected.  As you can see in the image below, everything seems to be working perfectly. You can check out the full stream here.

 

image

 

In the video below, you can see me walking into the room, and the sensor tripping when the fog fires. If I have some free time on Halloween before the Trick or Treaters arrive, I am going to add in another meter or so of Neopixel strips to increase the illumination.

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

That is going to wrap up this installment. I will be back in just a few days with a complete wrap up of this whole project and the results from Halloween night!

 

 

Win this Kit and Build-A-Long

 

  1. Project Introduction
  2. Fog Controller Hardware and Test
  3. Environment Sensing Coding & Testing
  4. Ambient Audio Hardware and Coding
  5. Lighting Coding and Testing
  6. Final Assembly and Testing
  • Sign in to reply
  • Former Member
    Former Member over 10 years ago

    Hi! Your projects are amazing. Do you have interests in writing a review for our new product Itead WIFI switch/? We can send you samples.

    Contact me at : emmy.yin@iteadstudio.com

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 10 years ago

    Very cool demo.

     

    DAB

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • balearicdynamics
    balearicdynamics over 10 years ago

    Compliments for the project! Can't wait to see the scenic effect the halloween night image

     

    Enrico

    • 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