Format SD card(update 10/20/2019

Step 1 & 2 is conbined using "SD CARD Formatter.exe"

Need to test if 64G sd card works the same. If 64G sd CDcard is formated to any formay beside fat32, then follow step 1 & 2.

1.Use SDformater to overwrite the sd card and restore the size back to 64g (57g)

Under Option, select Full Overwrite and Adjust Size on. This will take many minutes.

2. use command line

cd to fat32format directry

fat32format X: wher X is the drive letter

(Do not enter -Cn, the default works)

Instead of NOOB as in step 3, Use Etcher.exe make raspbian-buster.img into sd card.

3 copy extracted NOOB to sd card(files in directory)

4. boot from raspberrypi

5.Enable SSH

6.

Install Samba

sudo apt-get update

sudo apt-get install dist-upgrade

sudo apt-get clean

sudo apt-get install samba samba-common-bin

sudo apt-get install leafpad

Confiuration of Samba

cd /etc/samba

sudo cp smb.conf smb.conf.original

sudo leafpad smb.cong

Install Apache

sudo apt-get install apache2 -y

Install PHP

sudo apt-get install php libapache2-mod-php -y

leafpad is a gui editor

nano is command line editor

Wiring pi install for php wiring pi is already installed in latest

type gpio -v to test.

sudo apt-get install git-core

git clone git://git.drogon.net/wiringPi

cd wirinfPi

./build

Do configurations

Samba

stand alone server

Win support = yes

work group is opto-net

[shares}

path= /home/shares

Browseable = yes

read only = no

guest OK=yes

create mask =777

testparm check conf for correctness

Programs installations

Place index.php in /var/www/html

Place action.php in /var/www/html

Install APC UPS

lsusb check if apc is connected.

sudo apt-get insatll apcupsd -y

cd /etc/apcupsd

sudo apcupsd.conf pcupsd.conf.original

sudo leafpad apcupsd.conf

edit: UPSNAME RpiUpsd 8 char or less

edit: UPSCABLE usb

edit: uncomment polltime 60

edit:BATTERYLEVEL 5 shut down at 5% power level

edit MINUTE 3 shut down with 3 minte of power left

sudo service apcupsd restart

sudo apcaccessto see if the program works

install checkUps.py to start at boot

add a line in /etc/rc.local

python3 /home/pi/checkUps.py

"in this case, checkUps.py is localed at pi's home folder"

Just before the last line "exit o"

Test web site

Look at code for id & password

connect LED with ballist resistor to pot

connect magnetic switch to port

Test bootup running checkUps.py

config Rpi boot to text and see checkUps.py works.