// download resources
// write rasbian image to sd card
open sd in file explorer to view contents of the boot folder only
// enable ssh (must be present on first boot of pi)
// give pi network login info (can you add more "network=.." ??) add file named "wpa_supplicant.conf" that contains:
country=CA
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="localwifi"
psk="sup3rs3cur3"
}
// enable ssh over usb (for zero1.3) in boot folder edit "config.txt",append at the end:
"dtoverlay=dwc2"
in boot folder edit "cmdline.txt": find and then change
"...rootwait quiet..."
to
"...rootwait modules-load=dwc2,g_ether quiet..."
// download resources
insert prepared sd card into z1
connect laptop usb to pi data usb
(ensure you are using a data cord not a powercord duhh)
// login
on laptop using putty enter "raspberrypi.local" and press open
command terminal opens (accept security risks)
user: pi
password: raspberry
note password characters are hidden
as you type nothing on the screen will change
// change password
type 'passwd' to change password > sup3rs3cur3
// change hostname > 'z1test' (so pi@z1test.local)
sudo nano /etc/hosts #replace default 'raspberrypi' with 'z1test'
sudo nano /etc/hostname #replace default 'raspberrypi' with 'z1test'
// commit changes
sudo /etc/init.d/hostname.sh (command not found)
sudo reboot
putty again with 'z1test.local' to test it worked
sudo shutdown -h now
enable localwifi network wpa_supplicant.conf on sd card was prepared for
connect laptop to localwifi
insert prepared sd card into zw
(steps for enabling ssh over usb, it wants to be a host to 1)????
connect zw to power usb only
pi connects automatically to localwifi
check localwifi with laptop for assigned ip for raspberrypi
login on laptop > putty 192.168.43.146
command terminal opens (accept security risks)
user:pi
password:raspberry
type 'passwd' to change password > sup3rs3cur3
// change hostname > 'zwtest' (so pi@zwtest.local)
sudo nano /etc/hosts
replace default 'raspberrypi' with 'zwtest'
sudo nano /etc/hostname
replace default 'raspberrypi' with 'zwtest'
// commit changes
sudo /etc/init.d/hostname.sh (command not found)?????
sudo reboot
check localwifi settings that hostname connects as 'zwtest'
putty into pi@zwtest.local and:
sudo shutdown -h now
// main lesson is that usb/gadget mode turns device into a slave // look into host/slave hybrid
connect zw and z1 together at each device's data usb
connect zw to 2A power usb
// login to zwtest
laptop > putty 192.168.43.146 zwtest > login
//SSH z1test.local
zwtest > shh z1test.local z1test > login
TEST COMPLETE
-------------------IN WINDOWS CMD LINE-------------------
SEND to PI from PC -DONE
pscp pc-to-pi.txt pi@192.168.0.10:pctest/
COPY from PI to PC -DONE
pscp pi@192.168.0.10:pi-to-pc.txt "C:\users\windowslaptop\pitest\"
You need an SCP client to transfer the files with windows.
It is not embedded into the PuTTY graphical client,
but you can run a command-line tool pscp.exe distributed with PuTTY.
Open the command-line on the Windows machine and run the following
(assuming file.txt is in the current directory):
"C:\Program Files\PuTTY\pscp.exe" file.txt pi@your_pi:Desktop/
It will transfer the file to the Desktop directory
inside the home directory of the user pi.
-------------------IN PI CMD LINE (VIA PuTTY)-------------------
SEND to PC from PI
scp pi-to-pc.txt windowslaptop@192.168.000.002:pitest/
COPY from PC to PI
scp windowslaptop@192.168.000.002:pitest/pc-to-pi.txt "~/pctest/"
windows needs to have an SSH client running to accept scp
(STILL IN DRAFT EDIT VERSION UNDER CONSTRUCTION)
made a fresh sdcard for pi zero w with 2021-01-11-raspios-buster-armhf-lite.zip
from https://www.raspberrypi.org/software/operating-systems/ using rufus 3.13
once sdcard was "etched" two files were moved to the main directory of the sd card (called boot folder?) an empty file named "ssh" - must be included before first boot of pi "wpa_supplicant.conf" - gives pi wifi login information
country=CA
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="wifiname"
psk="password"
}
downloaded angry ip scanner to find ip address of pi
use putty to ssh into the ip of pi
username pi
password raspberry
sudo apt update
sudo apt upgrade
sudo apt install tmux
tmux new -s mysession
a thumb drive was filled with a static html project and a batch shell file to run the server
/thumbdrive
/pages
/img
index.html
test.sh
test.sh (replace this with server.py)
#!/bin/bash
python -m SimpleHTTPServer 8000
insert thumb drive to pi
sudo mkdir /mnt/usb
sudo mount /dev/sdb1 /mnt/usb
cd /mnt/usb
sudo chmod +x test.sh
sh test.sh
192.168.1.60:8000 on any browser on the wifi
close terminal
return with
tmux attach -t mysession
--local servers
--http / web
--js node - host local static site - host local file system - host dynamic sites - host to internet from home
using node // windows
install node
"Hello Node!" // so many ways to do the same thing!
https://github.com/johnpapa/node-hello/blob/master/index.js https://www.tutorialspoint.com/nodejs/nodejs_first_application
using node // linux // raspberry pi
server and gpio access
slow and expendable practice server
extracted from www.thepolyglotdeveloper.com/
pi zero uses ARMv6l nodesource does not support ARMv6l directly (can't use apt-get) but has archived binaries https://nodejs.org/dist/
it's easiest to visit the site in a browser to find the version you want go to the newest version (9.9 as of writing this) and find the …linux-armv6l.tar.gz file you are looking for make note of it's url https://nodejs.org/dist/v9.9.0/node-v9.9.0-linux-armv6l.tar.gz this zipped file contains node.js and the node package manager (NPM)
on the pi:
ssh into the pi zero and download the above link using curl:
curl -o node-v9.9.0-linux-armv6l.tar.gz https://nodejs.org/dist/v9.9.0/node-v9.9.0-linux-armv6l.tar.gz
(-o is the saved file name, the second line is the source location)
extract the file:
tar -xzf node-v9.9.0-linux-armv6l.tar.gz
move the folder to your local folder:
sudo cp -r node-v9.9.0-linux-armv6l/* /usr/local/
this should already be set into your $PATH. to ensure it's all working run:
node -v
and
npm -v
NPM likes Git, add that to your pi zero as well:
sudo apt-get install git