Skip to content

mlucchini/pi-experiments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pi experiments

Weathercock

Self-defense turret. Uses face detection and recognition to detect intruders and shoot them with a Nerf gun triggered by a servo motor. See this README.

Nerf gun Fisheye camera
Nerf gun Fisheye camera
Base Trigger
Base Servo trigger

Programs

LCD screen

Pin connections as defined on rototron.

make exec PROGRAM=lcd
Stepper motor

Enable I2C with sudo raspi-config and increase the I2C baudrate dtparam=i2c_baudrate=1000000 in /boot/config.txt. I also tried to add options i2c_bcm2708 baudrate=1000000 to /etc/modprobe.d/i2c.conf:

For Nema-17 12V 350mA: red-grey-blank-yellow-green

# Simple demonstration program
make exec PROGRAM=motor

# Manual keyboard controller - should probably execute from a shell on the Pi though
make exec PROGRAM=motor_remote_control
Servo motor

May be a good idea to use a PWM controller to avoid jitter? Meanwhile, connect white to GPIO pin #18 and power/ground.

make exec PROGRAM=servo
Flex sensor

I adapted the pin connections from raspberrypi-spy. I used a MCP3008 and a 10K resistor as well and it worked fine.

make exec PROGRAM=flex_sensor
Browser driver

I'm running Raspbian headless. So the selenium driver is installed as a pip dependency along virtual display:

pip install pyvirtualdisplay selenium

Firefox with Aptitude:

sudo apt-get install python-pip iceweasel xvfb

And GeckoDriver by hand and we want a version compatible with IceWeasel. Since currently IceWeasel is ~ Firefox v52, you don't want to install GeckoDriver v0.19 which requires Firefox v55.

wget https://github.com/mozilla/geckodriver/releases/download/v0.16.1/geckodriver-v0.16.1-arm7hf.tar.gz
tar -zxvf geckodriver-v0.16.1-arm7hf.tar.gz
sudo mv geckodriver /usr/local/bin
rm geckodriver-v0.16.1-arm7hf.tar.gz
make exec PROGRAM=browser_driver
Blink LED
make exec PROGRAM=blink
Configurable RGB LED
make exec PROGRAM=rgb_led
Vibrate phone buzzer
make exec PROGRAM=vibrator
RFID reader

Follow this pins setup.

make exec PROGRAM=rfid_writer
make exec PROGRAM=rfid_reader

Random

Power supply

The Pi may crash and restart unless it's got sufficient power. For the Pi3, 2.4A and 5.1V is good.

SD card images

Card to image:

sudo dd if=/dev/rdisk2 of=raspberry-opencv.dmg bs=1m

Image to card:

diskutil unmountDisk /dev/disk2
sudo newfs_msdos -F 16 /dev/disk2
sudo dd if=raspberry-opencv.dmg of=/dev/rdisk2 bs=1m

Notes:

  • Usage of raw disk rdisk2 and block size of 1M to improve copy speed dramatically (10-15x)
  • Use Ctrl+T to show progress in the console
USB microphone

Check microphone connection:

lsusb
amixer

Record:

arecord -D plughw:1 --duration=10 -f cd -vv ~/rectest.wav

Play:

aplay ~/rectest.wav
# or
scp -r pi@pi2.local:~/rectest.wav .
open rectest.wav
Camera

Take a picture and check it:

raspistill -o ~/cam.jpg
scp -r pi@pi2.local:~/cam.jpg .
open cam.jpg
Raspberry Pi volume
alsamixer