Skip to content

PumpkinPi turns your Raspberry Pi into an electronic jack-o'-lantern!

License

Notifications You must be signed in to change notification settings

matthewjustice/pumpkinpi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PumpkinPi

PumpkinPi turns your Raspberry Pi into a electronic jack-o'-lantern! A Node.js application provides a web UI and API for controlling LEDs, speakers, and a motion sensor connected to a Raspberry Pi, all housed in plastic jack-o'-lantern shell. The jack-o-lantern can be controlled manually through the web, or it can automatically respond when it detects motion!

Getting Started

Here we'll cover the hardware and software needed to get going with this code.

Hardware

Parts needed:

  • Raspberry Pi
  • micro SD card
  • Motion sensor (HC-SR501 passive IR)
  • Two red LEDs
  • Current-limiting resistors (approx 220 Ω)
  • Small speakers
  • Jack-o'-lantern plastic shell
  • USB webcam

Assembling the hardware:

  • Cut LED-sized holes in the eyes of the jack-o'-lantern.
  • Cut a motion sensor-sized hole in the nose of the jack-o'-lantern.
  • Cut a hole in the back of the jack-o'-lantern for power cables.
  • Place the speakers in the bottom of the jack-o'-lantern, and run the power cable out the back hole.
  • Place the Raspberry Pi in the jack-o'-lantern, and and run its power cable out the back hole.
  • Connect the speakers to the Raspberry Pi's 3.5mm audio output jack.
  • Place the LEDs through the eyeholes, and connect their positive pins to GPIO 17 (pin 11) and GPIO 27 (pin 13) on the Raspberry Pi. Be sure to include a current-limiting resistor in series as well. Connect the other pin of the LEDs to ground.
  • Place the motion sensor in the nose hole, connecting it to 5 volts, ground, and GPIO 4 (pin 7).
  • Connect the USB webcam to a USB port on the Raspberry Pi.

PumpkinPi wiring diagram

PumpkinPi assembled

Prerequisites

  • Install Raspbian on the Raspberry Pi. Use NOOBS for an easy install process.
  • Install Node.js on the Raspberry Pi:
    $ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
    $ sudo apt-get install -y nodejs
  • To support an attached USB webcam, install fswebcam:
    $ sudo apt-get install fswebcam

Installing

On your Raspberry Pi, clone the PumpkinPi repository:

$ git clone https://github.com/matthewjustice/pumpkinpi.git

Change directories

$ cd pumpkinpi/node

Install the application

$ npm install

Start the application

$ npm start

At this point the application should be running on the Raspberry Pi on port 5000. Connect to it from a web browser on your local network using the IP address of the Raspberry Pi. For example, if your Raspberry Pi's IP is 192.168.1.123, point your web browser to http://192.168.1.123:5000.

Start on boot

You may want to configure your Raspberry Pi to run the software on boot. The forever tool can be used to ensure that the software is automatically restarted if needed, and we can use crontab to start forever on boot.

Install forever

$ sudo npm install forever -g

Edit the current crontab

$ crontab -e

Add the following line to the crontab file, then exit and save changes. Be sure to use the correct path to your bin/www file; it may differ from the example below.

@reboot export NODE_ENV=production && /usr/bin/forever start /home/pi/pumpkinpi/node/bin/www

Restart your Raspberry Pi, and the PumpkinPi software should start automatically.

API Documentation

This project makes its functionality available with a web UI and a web API. If you would prefer to use the API directly rather than use the built-in UI, see the API documentation for details.

Built With

  • Node.js - The web server platform
  • Express - The application framework
  • onoff - Used for GPIO access from Node.js
  • socket.io - Used for event notifications
  • vash - Razor syntax in views

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

About

PumpkinPi turns your Raspberry Pi into an electronic jack-o'-lantern!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published