(No USB keyboard, mouse or HDMI monitor is needed)
-
Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
-
Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the
config.txt
filedtoverlay=dwc2
on a new line, then save the file. -
If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH is now disabled so this is required to enable it. Remember - Make sure your file doesn't have an extension (like .txt etc)!
-
Finally, open up the
cmdline.txt
. Be careful with this file, it is very picky with its formatting! Each parameter is seperated by a single space (it does not use newlines). Insertmodules-load=dwc2,g_ether
afterrootwait
. To compare, an edited version of thecmdline.txt
file at the time of writing, can be found here. -
That's it, eject the SD card from your computer, put it in your Raspberry Pi Zero and connect it via USB to your computer. It will take up to 90s to boot up (shorter on subsequent boots). It should then appear as a USB Ethernet device. You can SSH into it using
raspberrypi.local
as the address.
username: pi
password: raspberry
https://www.raspberrypi.org/documentation/remote-access/vnc/README.md
Edit the file wpa_supplicant.conf
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Add the network configuration into wpa_supplicant.conf as follow (becareful of "
sign):
NOTE: I have an issue when key in the bellow network information. The space and the "
sign must be exactly as the one bellow.
network={
ssid="SUTD_Staff"
key_mgmt=WPA-EAP
eap=PEAP
identity="xxxxxxxx"
password="yyyyyyy"
pairwise=CCMP TKIP
group=CCMP TKIP
phase2="auth=MSCHAPV2"
}
Continue to edit the file interfaces
sudo nano /etc/network/interfaces
Add following lines:
iface lo inet loopback
iface eth0 inet dhcp
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
sudo apt-get install ssmtp
sudo apt-get install bsd-mailx
sudo nano /etc/ssmtp/ssmtp.conf
Addline
AuthUser= Your-Gmail@gmail.com
AuthPass=Your-Gmail-Password
FromLineOverride=YES
mailhub=smtp.gmail.com:587
UseSTARTTLS=YES
echo "Test text" | mailx -s "Test Mail" your_email@gmail.com
sudo nano /etc/network/if-up.d/mailip
Add the content
#!/bin/sh
# Send a mail with the IP address after interface comes up
# It is safe to ignore localhost
if [ "$IFACE" = lo ]; then
exit 0
fi
# Only run from ifup.
if [ "$MODE" != start ]; then
exit 0
fi
# We only care about IPv4 and IPv6
case $ADDRFAM in
inet|inet6|NetworkManager)
;;
*)
exit 0
;;
esac
# We wait for DHCP to assign an IP address
sleep 15
# Store the IP address to a variable
MYIP="$(/bin/hostname --all-ip-addresses)"
# Send the mail if the address is not empty
if [ -z "$MYIP" ]; then
exit 0
else
echo "$MYIP" | /usr/bin/mail -s "PI is up" your_username@gmail.com
fi
exit 0
make the above script executable
sudo chmod +x /etc/network/if-up.d/mailip
finally, reboot
https://spellfoundry.com/2016/05/29/configuring-gpio-serial-port-raspbian-jessie-including-pi-3/
https://www.raspberrypi.org/documentation/configuration/uart.md
1. Enable the GPIO serial port:
sudo nano /boot/config.txt
Add the line: enable_uart=1
2. If you are using the serial port for anything other than the console you need to disable it.
sudo systemctl disable serial-getty@ttyS0.service
3. You also need to remove the console from the cmdline.txt
. If you edit this with:
sudo nano /boot/cmdline.txt
you will see something like: dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes root wait
remove the line: console=serial0,115200
and save and reboot for changes to take effect.
To switch bluetooth to software UART and set /dev/ttyAM0 to real UART
In Linux device terms, by default, /dev/ttyS0 refers to the mini UART, and /dev/ttyAMA0 refers to the PL011. The primary UART is that assigned to the Linux console, which depends on the Raspberry Pi model as described above, and can be accessed via /dev/serial0.
Keep in mind that this one will remain possible software problem on bluetooth (software UART), but not on Serial (Hardware)
Edit the file /boot/config.txt
and add the following line at the end :
dtoverlay=pi3-miniuart-bt
core_freq=250
Edit the file /lib/systemd/system/hciuart.service
and replace /dev/ttyAMA0
with /dev/ttyS0
If you have a system with udev rules that create /dev/serial0
and /dev/serial1
(look if you have these one), and if so use /dev/serial1
.
Then reboot
1.In command line, type:
$sudo raspi-config
And then choose Interface Option -> Enable the Camera.
2.Test camera by typing:
$raspistill -v -o test.jpg
The file will be save at root.
Host (Raspberry Pi)
- Install vlc:
$sudo apt-get update
$sudo apt-get install vlc
- Run stream command:
$raspivid -o - -t 0 -hf -w 640 -h 360 -fps 25|cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264
Client (Windows or Linux)
On Window, open VLC -> Media -> Open network stream -> Network, fill in network url:
http://RaspberryPi-IP:8090/
reference: https://raspberrypi.stackexchange.com/questions/27082/how-to-stream-raspivid-to-linux-and-osx-using-gstreamer-vlc-or-netcat Linux (Client)
$sudo apt-get install mplayer
$nc -l 2222 | mplayer -fps 200 -demuxer h264es -
Raspberry Pi (Server)
/opt/vc/bin/raspivid -t 0 -w 300 -h 300 -hf -fps 20 -o - | nc <IP-OF-THE-CLIENT> 2222