Jack-O-Lantern Configuration Notes === Schematic: * GPIO 2 (5v) to HC-SR04 pin 1 (VCC) * GPIO 6 (GND) to HC-SR04 pin 4 (GND) * GPIO 12 (BCM 18) to LED in (both) * GPIO 14 (GND) to LED out (both) * GPIO 16 (BCM 23) to HC-SR04 pin 2 (TRIG) * GPIO 18 (BCM 24) to 1k resistor to HC-SR04 pin 3 (ECHO) to 2.2k resistor to GPIO 20 (GND) Molex-10 (Raspberry Pi): 1: Red to HC-SR04 molex-4 pin 1 3: Black to HC-SR04 molex-4 pin 4 6: White to LED 7: Black to LED 8: Blue to HC-SR04 molex-4 pin 2 9: Yellow to 1k resistor to HC-SR04 molex-4 pin 3 10: Black to 2.2k resistor to HC-SR04 molex-4 pin 3 Molex-4 (LED): 1: Red to molex-4 pin 1 2: Blue to molex-10 pin 8 3: 1k resistor to yellow to molex-10 pin 3; 2.2k resistor to black to molex-10 pin 10 === Configuration: sudo nano /etc/default/keyboard # change XKBLAYOUT="gb" to XKBLAYOUT="us" sudo /usr/sbin/locale-gen --purge en_US.UTF-8 Edit /etc/dhcpcd.conf and add the following line at the bottom: static domain_name_servers=8.8.8.8 8.8.4.4 sudo apt-get update sudo apt-get dist-upgrade sudo apt-get install python-pip python-dev build-essential RPi.GPIO mpg123 sudo apt autoremove pip install --upgrade pip = Set script to run at startup: Run raspi-config. Select option 3 ("Boot Options"), option 1 ("Desktop / CLI"), and option 2 ("Console Autologin"). Edit ~/.bashrc and add: /home/pi/pumpkin.py === Music and sound effects: Create a folder called ~/Music for music (preferably MP3s, or any format that mpg123 can play) and a folder called ~/Sounds for sounds (preferably WAVs, or any format that aplay can play). Spaces in the filenames may create problems. === HC-SR04 range finder: https://thepihut.com/blogs/raspberry-pi-tutorials/hc-sr04-ultrasonic-range-sensor-on-the-raspberry-pi Note: Some HC-SR04s are defective. See following link for more info. https://forums.parallax.com/discussion/153735/pulsin-timeout-and-hc-sr04-problems === LIRC: = Step 1: Install LIRC sudo su -c "grep '^deb ' /etc/apt/sources.list | sed 's/^deb/deb-src/g' > /etc/apt/sources.list.d/deb-src.list" sudo apt install -y vim devscripts dh-exec doxygen expect libasound2-dev libftdi1-dev libsystemd-dev libudev-dev libusb-1.0-0-dev libusb-dev man2html-base portaudio19-dev socat xsltproc python3-yaml dh-python libx11-dev python3-dev python3-setuptools mkdir ~/lirc-src ; cd ~/lirc-src ; apt source lirc wget https://raw.githubusercontent.com/neuralassembly/raspi/master/lirc-gpio-ir-0.10.patch patch -p0 -i lirc-gpio-ir-0.10.patch cd lirc-0.10.1 ; debuild -uc -us -b cd ~/lirc-src sudo apt install ./liblirc0_0.10.1-5.2_armhf.deb ./liblircclient0_0.10.1-5.2_armhf.deb ./lirc_0.10.1-5.2_armhf.deb # this command will fail, but needs to be run anyway sudo cp /etc/lirc/lirc_options.conf.dist /etc/lirc/lirc_options.conf sudo cp /etc/lirc/lircd.conf.dist /etc/lirc/l sudo nano /etc/lirc/lirc_options.conf # set the following options: driver = default device = /dev/lirc1 sudo nano /boot/config.txt # add the following lines: dtoverlay=gpio-ir,gpio_pin=17 dtoverlay=gpio-ir-tx,gpio_pin=18 # note: this is the opposite pinout configuration from most places, including the # source guide below - it is switched so that gpio-ir-tx is included in the molex # connector. sudo apt install -y --allow-downgrades ./liblirc0_0.10.1-5.2_armhf.deb ./liblircclient0_0.10.1-5.2_armhf.deb ./lirc_0.10.1-5.2_armhf.deb # this command will succeed this time Reboot. Confirm that /dev/lirc0 and /dev/lirc1 exist. = Step 2: Recording IR Commands Stop LIRCD: sudo systemctl stop lircd Setting LIRC configuration for receiving: Edit /etc/lirc/lirc_options.conf and set the following option: device = /dev/lirc1 Restart LIRC: sudo systemctl start lircd Testing receipt of data: mode2 -d /dev/lirc1 Press a button - if the command is received, the console will output a series of space and pulse outputs. Recording a remote: irrecord -n -d /dev/lirc1 ~/lircd.conf This command runs in an interactive mode. Follow the instructions (more or less exactly) - may have to repeat if something gets screwed up. The output is a lircd.conf file including the device name. Applying configuration to lirc: sudo mv .lircd.conf /etc/lirc/lircd.conf = Step 3: Playing IR Commands Stop LIRCD: sudo systemctl stop lircd Setting LIRC configuration for transmitting: Edit /etc/lirc/lirc_options.conf and set the following option: device = /dev/lirc0 Restart LIRC: sudo systemctl start lircd = Source: https://github.com/AnaviTechnology/anavi-docs/blob/master/anavi-infrared-phat/anavi-infrared-phat.md#setting-up-lirc ===