Pi Zero W: Difference between revisions
Brian Wilson (talk | contribs) mNo edit summary |
Brian Wilson (talk | contribs) |
||
Line 93: | Line 93: | ||
=== Getting ready for OpenCV === | === Getting ready for OpenCV === | ||
Cribbed from https://www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3/ | |||
sudo -s | sudo -s | ||
Line 101: | Line 103: | ||
apt install libgtk2.0-dev | apt install libgtk2.0-dev | ||
apt install libatlas-base-dev gfortran | apt install libatlas-base-dev gfortran | ||
apt install python2.7-dev python3-dev | apt install python2.7-dev python3-dev python-pip | ||
pip install virtualenv virtualenvwrapper | |||
exit | |||
cat >> .profile <EOF | |||
export WORKON_HOME=$HOME/.virtualenvs | |||
source /usr/local/bin/virtualenvwrapper.sh | |||
EOF | |||
source .profile | |||
mkvirtualenv cv -p python3 | |||
pip install numpy | |||
This leaves you in the cv venv, | |||
on subsequent logins | |||
workon cv | |||
=== Installing OpenCV | |||
wget -O opencv-master.zip https://codeload.github.com/opencv/opencv/zip/master | |||
wget -O opencv_contrib-4.0.0.zip https://github.com/opencv/opencv_contrib/archive/4.0.0.zip | |||
cd ~/opencv-master/ | |||
mkdir build | |||
cd build | |||
cmake -D CMAKE_BUILD_TYPE=RELEASE \ | |||
-D CMAKE_INSTALL_PREFIX=/usr/local \ | |||
-D INSTALL_PYTHON_EXAMPLES=ON \ | |||
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-4.0.0/modules \ | |||
-D BUILD_EXAMPLES=ON .. | |||
make | |||
=== Camera related links === | === Camera related links === |
Revision as of 04:22, 19 November 2018
I have a PI 2 Model B (without the wireless features) and wanted to play with a camera so it made sense to invest $10 in a Pi Zero W. I can't imagine using a webcam that's wired up (I have no wired network in this rental house.)
Since it's the first Pi Zero for me I got the cute C4Labs Zebra Zero+ protoboard setup from Adafruit at the same time.
If it works out and it's fun I will set up more Pi cameras without the protoboard.
First boot
- Plug in a cable to the Windows machine and see if it recognizes the Pi Zero as a smoke test.
- Download Raspian ZIP image from https://www.raspberrypi.org/downloads/raspian
- Download Etcher from https://www.balena.io/etcher/
- Run Etcher to copy image to 32GB card (32GB is overkill but it's the first one I grabbed.)
- While waiting, dig up the HDMI cable and USB keyboard.
- Discover there are many more connectors in the world and they used an HDMI I don't have.
- Order a Type A (std HDMI) to Type C (Mini). Note the BeagleBoneBlack uses Type D (Micro).
- Wait a few days.
- OR headless mode https://learn.adafruit.com/raspberry-pi-zero-creation/text-file-editing
- Transfer card to Pi
- Connect HDMI monitor and USB keyboard
- Power on via a cellphone charger and a generic micro USB cable
- Log in and create an account
- Configure WiFi.
- Is there an ssh server running on this thing?
Headless mode
- Enable WiFI so card comes up on network.
- Enable ssh so I can log in.
Put the SD card in the Mac. Create these files.
cd /Volumes/boot touch ssh vi wpa_supplicant.conf
wpa_supplicant.conf should contain
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=US network={ ssid="YOURSSID" psk="YOURPASSWORD" scan_ssid=1 }
The wpa_supplicant.conf file gets moved on boot so don't freak if it "disappears".
Remember to update the network server dnsmasq settings to issue it a proper IP address.
ssh pi@zebra pi@zebra's password: Linux raspberrypi 4.14.79+ #1159 Sun Nov 4 17:28:08 GMT 2018 armv6l The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. SSH is enabled and the default password for the 'pi' user has not been changed. This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password. pi@raspberrypi:~$
and there was much rejoicing... seconds later, I realized that I cannot show it off because there are no LEDs to blink, no beeper, just this cold dead looking thing... anticlimax hits.
Serial console: I did not add enable_uart=1 to config.txt because I don't need it right now.
Set up a new Zero
sudo -s apt-get update apt-get upgrade rpi-update reboot
Camera notes
Enable camera and reboot
raspi-config reboot
Test camera
raspistill -o foo.jpg
Getting ready for OpenCV
Cribbed from https://www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3/
sudo -s apt install git cmake pkg-config apt install libjpeg-dev libtiff5-dev libjasper-dev libpng-dev apt install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev apt install libxvidcore-dev libx264-dev apt install libgtk2.0-dev apt install libatlas-base-dev gfortran apt install python2.7-dev python3-dev python-pip pip install virtualenv virtualenvwrapper exit cat >> .profile <EOF export WORKON_HOME=$HOME/.virtualenvs source /usr/local/bin/virtualenvwrapper.sh EOF source .profile mkvirtualenv cv -p python3 pip install numpy
This leaves you in the cv venv, on subsequent logins
workon cv
=== Installing OpenCV
wget -O opencv-master.zip https://codeload.github.com/opencv/opencv/zip/master wget -O opencv_contrib-4.0.0.zip https://github.com/opencv/opencv_contrib/archive/4.0.0.zip
cd ~/opencv-master/ mkdir build cd build cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-4.0.0/modules \ -D BUILD_EXAMPLES=ON .. make
MotionEyeOS https://www.raspberrypi-spy.co.uk/2017/04/raspberry-pi-zero-w-cctv-camera-with-motioneyeos/
MotionEye on Raspian https://www.techcoil.com/blog/how-i-setup-a-raspberry-pi-zero-w-cctv-camera-with-motioneye-and-raspbian-stretch-lite/
Built into a dummy camera case: https://www.instructables.com/id/Zero-Security-Camera/ Pi Zero (not wireless) + USB - LAN adapter
Cool 3D-printed case: https://www.thingiverse.com/thing:2544275