Naughty or Nice Machine

Similar documents
Adafruit AMG8833 8x8 Thermal Camera Sensor

Adafruit CCS811 Air Quality Sensor

Adafruit VL53L0X Time of Flight Micro-LIDAR Distance Sensor Breakout

Adafruit APDS9960 breakout

Adafruit DRV2605 Haptic Controller Breakout

Adafruit MCP9808 Precision I2C Temperature Sensor Guide

Adafruit Capacitive Touch Sensor Breakouts

Adafruit Color Sensors

Adafruit MPRLS Ported Pressure Sensor Breakout

Adafruit TPL5110 Power Timer Breakout

i2c/spi LCD Backpack Created by lady ada Last updated on :11:04 PM UTC

Adafruit PowerBoost 500 Shield

3D Printed Camera LED Ring

Adafruit 8x16 LED Matrix FeatherWing

Adafruit GPIO Expander Bonnet for Raspberry Pi Created by Kattni Rembor. Last updated on :12:47 PM UTC

Solar Boost Bag. Created by Becky Stern. Last updated on :44:55 PM UTC

NeoMatrix 8x8 Word Clock

Adafruit Si5351 Clock Generator Breakout

Large Pi-based Thermometer and Clock

Adafruit Pi Cobbler Kit

Adafruit 1.27" and 1.5" Color OLED Breakout Board

Monochrome OLED Breakouts

Adabot Operation Game

Adafruit Mini TFT with Joystick Featherwing

Adafruit TPL5111 Reset Enable Timer Breakout

Adafruit DRV2605 Haptic Controller Breakout

Adafruit Si7021 Temperature + Humidity Sensor

Adafruit MMA8451 Accelerometer Breakout

Adafruit ATWINC1500 WiFi Breakout

Adafruit I2C FRAM Breakout

Raspberry Pi Selfie Bot

MCP Bit DAC Tutorial

Reindeer Mask with Animated Eyes

Adafruit AM2320 Sensor

Feather Weather Lamp. Created by Ruiz Brothers. Last updated on :54:26 PM UTC

Arduino Lesson 6. Digital Inputs

PyPortal NeoPixel Color Picker Created by Kattni Rembor. Last updated on :42:41 PM UTC

Portable Apple Watch Charger

MCP Bit DAC Tutorial

Adafruit MMA8451 Accelerometer Breakout

Adafruit SGP30 TVOC/eCO2 Gas Sensor

Adafruit MMA8451 Accelerometer Breakout

Adafruit IO Basics: Servo

Trellis 3D Printed Enclosure

Joy Featherwing. Created by Dean Miller. Last updated on :03:07 PM UTC

FLORA TV-B-Gone. Created by Becky Stern. Last updated on :32:57 PM UTC

Adafruit Mini TFT " 160x80

Neon LED Signs. Created by John Park. Last updated on :11:09 PM UTC

Adafruit IO Basics: Digital Output

Adafruit HUZZAH32 - ESP32 Feather

NeoPixel Bike Light. Created by Ruiz Brothers. Last updated on :43:46 PM UTC

Light-Up Angler Fish Embroidery

Adafruit PCF8523 Real Time Clock

Adafruit 8x16 LED Matrix FeatherWing

Bike Wheel POV Display

Trinket-Powered Conference Room Occupancy Display

Grove - LED Bar. Introduction. Features

Coffee Detonator: The TNT Plunger Grinder

Guardian Shield+ Zelda Breath of the Wild

IS31FL x9 Charlieplexed PWM LED Driver

Milk Jug Glow Skull. Created by John Park. Last updated on :28:36 PM UTC

Adafruit AS channel Visible Light Sensor

LED Breath Stats Mask

Introducing Adafruit Trellis

Bluetooth Controlled NeoPixel Headphones

Adafruit WINC1500 WiFi Shield for Arduino

1.8" TFT Display Breakout and Shield

Prophet 600 GliGli mod

FLORA and GEMMA ICSP. Created by Becky Stern. Last updated on :42:16 PM UTC

RGB LCD Shield. Created by lady ada. Last updated on :48:40 PM UTC

Adafruit GPS Hat in Windows IoT Core

Bunny Ears with MakeCode

NeoPixel Ring Bangle Bracelet

PyPortal View Master Created by Ruiz Brothers. Last updated on :51:28 AM UTC

Adafruit 3.5" 480x320 TFT FeatherWing

Adafruit IO Basics: Analog Input

Adafruit IO Basics: Digital Input

Adafruit 2.4" TFT FeatherWing

Grove - 4-Digit Display

Adafruit IO Basics: Color

Pushrod Garage. Created by John Park. Last updated on :07:30 PM UTC

Fiddy - the FTDI Clip

Celebration Spectacles

MiniPOV4 - DIY Full-Color Persistence of Vision & Light-Painting Kit

Clockwork Goggles. Created by John Park. Last updated on :03:10 PM UTC

Adafruit 3.5" 480x320 TFT FeatherWing

Toy Car Speed Timer. Created by Kirby Griese. Last updated on :13:49 PM UTC

14-Segment Alpha-numeric LED FeatherWing

Flora Brake Light Backpack

Fiddy - the FTDI Clip

Adafruit 7-Segment LED FeatherWings

0.96" mini Color OLED

Trinket NeoPixel LED Longboard

MLX90393 Wide-Range 3-Axis Magnetometer

Adafruit Feather 32u4 Basic Proto

Adafruit DS3231 Precision RTC Breakout

TSL2561 Luminosity Sensor

Getting Started with FLORA

Jewel Hair Stick. Created by Leslie Birch. Last updated on :47:17 PM UTC

Circuit Playground Digital Input

Transcription:

Naughty or Nice Machine Created by Brian Corteil Last updated on 2018-08-22 03:45:31 PM UTC

Guide Contents Guide Contents Overview It knows if you have been Naughty or Nice! Make It! Parts The Case The LCD screen Neopixel Sticks Hacked Car USB Adaapter The Switches Preparing your Raspberry Pi Preparing your Arduino Putting It All together How To Take a Reading 2 3 3 4 4 5 5 6 6 7 8 10 11 13 Adafruit Industries https://learn.adafruit.com/naughty-or-nice-machine Page 2 of 14

Overview It knows if you have been Naughty or Nice! The Naughty or Nice machine is simply a bit of fun for the holidays. The machine works by taking a photo of the hand placed on the bottom plate. Using the opencv python computer vision library to count the number of red colour pixels, and display the result on the LCD screen. A little showmanship is used to entrain people while they are waiting for the results of the test. I created the Naughty or Nice machine for Christmas 2013, first of all I thought about hacking our Christmas tree, but everyone hacks their Christmas tree, then I had the idea for a Naughty or Nice meter, checked online and found that Ben Heck had beat me too that idea, sometime later I had the idea about making the meter interactive, and the idea for the Naughty or Nice machine was born. The Naughty or Nice machine is built around the Raspberry Pi camera module, a Raspberry Pi model A, Adafrut USB/serial LCD screen and an Arduino driving RGB LEDs, Adafruit Neopixels. The project is cased in a frame made with Makerbeam and laser cut Perspex panels. Adafruit Industries https://learn.adafruit.com/naughty-or-nice-machine Page 3 of 14

Make It! Warning: This build involves soldering and high voltages If you're new to soldering have a look at this guide https://learn.adafruit.com/adafruit-guide-excellent-soldering (https://adafru.it/dri) The cable between the LV panel and it s transformer plus the EL panel itself has a high potential (high voltage between 60 VAC to 120 VAC) be careful not to damage the cable and panel when installing it, see the Adafruit EL guide for details https://learn.adafruit.com/el-wire (https://adafru.it/ced) Parts Raspberry Pi Raspberry Pi camera module Adafruit USB/serial LCD display 2 x Adafruit Neopixel bars Arduino Uno RGB LED Arduino Shield - by Re-Innovation Adafruit blue EL panel plus power transformer buck converter or hacked car 12V to USB converter 12Vdc PSU 2 amps or more 12V 2.1mm barrel socket 0.1 plug and sockets plus cable or you could use jumpers as required RGB LED strip short USB to micro USB lead stripbroad 2 x 10K resistors surface mount or through the hole 2 x 1K resistors or surface mount or through the hole 2 x push buttons Adafruit Industries https://learn.adafruit.com/naughty-or-nice-machine Page 4 of 14

The Case I used Makerbeam for the frame and laser cut Perspex panels for the sides. You can use almost anything, from a cardboard box, wooden box or a fake ginger bread house, for your frame. The case should be at least 200mm high with a base large enough to fit a hand in. The Raspberry Pi is mounted on the top panel with the camera looking down and the Arduino is mount under the panel. The EL panel is mounted between the bottom panel and the base. The LCD screen Solder together and test the USB/serial LCD kit, following the instructions here Adafruit Industries https://learn.adafruit.com/naughty-or-nice-machine Page 5 of 14

https://learn.adafruit.com/usb-plus-serial-backpack (https://adafru.it/cee) Neopixel Sticks Solder the two neopixal bars together, making sure that the power and data connections are same as in the photo. Solder 3 wires, to the 5v, 0v and data in connections, they need to be longer enough to connect to the Arduino. Hacked Car USB Adaapter Hack the car USB adapter, by removing the case and plug. Solder cables to the plug connection points, you removed, Adafruit Industries https://learn.adafruit.com/naughty-or-nice-machine Page 6 of 14

the centre pin is 12v and the side plates are ground (0v) The Switches I used stripbroad and service mount resistors for the switches in this build, you can do the same or use through hole resistors. The copper has to be removed behind the 1K resistor. Adafruit Industries https://learn.adafruit.com/naughty-or-nice-machine Page 7 of 14

Preparing your Raspberry Pi It is best to use the latest version of Raspbian you can find the latest version on the Raspberry Pi website, follow the instutions there. I personally like the noobs install method. When you have installed Raspbian, when your Raspberry Pi starts for the first time, the config apt starts, select advanced options and enable the i2c option, then enable the camera module, exit and make sure Raspbian is up to date by entering the following at the command line. Your Raspberry PI will need to be connected to the internet to do this and to download the required software and modules. sudo apt-get update sudo apt-get upgrade Install the picamera python module, if you are using the latest version of Raspbian the picamera module is already installed. For instructions follow this guide on the Raspberry Pi website by following this link. http://www.raspberrypi.org/learning/python-picamera-setup/ (https://adafru.it/eh7) install the opencv python module by entering the following at the command line sudo apt-get install libopencv-dev sudo apt-get install python-opencv download the bootup program plus the control program for the Raspberry Pi to your home folder from git. enter the follow at the command line wget https://github.com/corteil/norn_4/archive/master.zip unzip master.zip cd master cp NN-0-04-4.1.py ~/NN-0-04-4.1.py cp NN-0-04-4.1.py ~/run.py cd ~ Adafruit Industries https://learn.adafruit.com/naughty-or-nice-machine Page 8 of 14

sudo rm -r NorN_4-master/ rm master.zip Next we need to modify the rc.local file to start running run.py when the Raspberry Pi starts up. first of all we need to make a backup of the file, enter the following at the command line. sudo cp etc/rc.local etc/rc.local.old if you need to restore the old file enter enter the following at the command line sudo cp etc/rc.local.old etc/rc.local Now to modify the rc.local file by entering at the command line. sudo nano /etc/rc.local and adding the following before "exit O" python /home/pi/run.py and save by holding ctrl O, press enter to accept and then ctrl X to exit follow the guide on the hobbytronics website to disable the console on the serial port. http://www.hobbytronics.co.uk/raspberry-pi-serial-port (https://adafru.it/eh8) Adafruit Industries https://learn.adafruit.com/naughty-or-nice-machine Page 9 of 14

Preparing your Arduino Install Arduino and add the Adafruit libraries for the Adafruit_WS2801.h and Adafruit_NeoPixel.h for Arduino. you can find them at https://github.com/adafruit If you are new to the world of Arduinos, I would suggest that you follow the first few guides by Simon Monk on the learn.adafruit.com starting with the first lession. https://learn.adafruit.com/category/learn-arduino (https://adafru.it/bqz) next upload NorN_4.ino sketch to your Arduino using your normal method. You can download sketch from here https://github.com/corteil/norn_4 (https://adafru.it/eh9) install the RGB strip sheild, contect the RGB strips to the sheild and NeoPixel sticks. you will not be able to test until the Arduino and Raspberry Pi are conected together. NOTE: you could use just a NeoPixel strip instead of the RGB sheild and RGB strip, the Arduino sketch would required adjusting if this was done. Connect the Arduino SDA and SCL lines to the Raspberry Pi plus connect grounds of both devices together. Arduino A4 A5 GND ---> ---> ---> Raspberry Pi 3 5 GND Adafruit Industries https://learn.adafruit.com/naughty-or-nice-machine Page 10 of 14

Putting It All together Build your case, fixing the Raspberry PI, Arduino, LCD display, Neopixals plus the RGB strip in place. The EL panel is installed behind the transparent blue base in my case, this is to protect it, take care with the power connections, making sure that the cable and joints are OK. Connect the connected the RGB LEDs strips following the screen print markings to the shield, and the Neopixels 5V, 0V to the Arduino s 5V, 0V and the data in is connected digital pin 12. Using the TLL serial connection on the LCD display, connect the JST cable to the backpack and then connect to the Raspberry Pi's GPIO pins as follows: Red wire goes to +5V, Black wire goes to Ground, White data wire goes to pin 6 (TxD) or you can solder a header on and use jump wires instead. Adafruit Industries https://learn.adafruit.com/naughty-or-nice-machine Page 11 of 14

Fit the power socket and connect with wires to the power in on the Arduino shield, and also feed the hacked 12v to USB converter or the buck converter, use the USB lead to power the Raspberry Pi from the usb socket on the USB converter. Connect the feed for the EL transformer to the socket, you may need to use some form of connector blocks to be connect all the required feeds. Connect the Arduino SDA and SCL lines to the Raspberry Pi plus connect grounds of both devices together. Arduino A4 A5 GND ---> ---> ---> Raspberry Pi 3 5 GND Fit and connect the switches, to the Raspberry Pi GPIO pins the red wires goes to a 3v3 pin and the black wires to a 0V pin, The first switch's signal wire is connected to pin 23 and the second is connected to pin 24 Adafruit Industries https://learn.adafruit.com/naughty-or-nice-machine Page 12 of 14

How To Take a Reading Instructions for use. 1. When the "Naughty or Nice" machine first starts press the bottom button. 2. Place hand on the bottom plate inside the machine, up to your wrist 3. Press bottom button 4. Remove hand when instructed 5. Wait for your Naughtness rating Adafruit Industries https://learn.adafruit.com/naughty-or-nice-machine Page 13 of 14

Adafruit Industries Last Updated: 2018-08-22 03:45:26 PM UTC Page 14 of 14