Size: 5624
Comment:
|
Size: 5664
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 5: | Line 5: |
* Raspberry Pi 3 Model B Plus Rev 1.3 |
RaspberryPi
Kit in https://www.chiptec.net/pcs-e-mobilidade/computadores/raspberrypi/kit-raspberry-pi-3-modelo-b-noobs-caixa-carregador-preto.html (Kit Raspberry Pi 3 Modelo B+(NOOBS+Caixa+Carregador) Preto)
- Raspberry Pi 3 Model B Plus Rev 1.3
Processador Broadcom BCM2837B0, Cortex-A53 (ARMv8) 64-bit SoC @ 1.4GHz Memória RAM 1GB LPDDR2 SDRAM Armazenamento Cartão MicroSD 32GB com NOOBS Wi-Fi e Bluetooth 2.4GHz e 5GHz IEEE 802.11.b/g/n/ac wireless LAN, Bluetooth 4.2, BLE LAN Gigabit Ethernet em USB 2.0 (saída máxima 300 Mbps) Expansão Extended 40-pin GPIO header CSI camera port DSI display port 4-pole stereo output e composite video port Portas HDMI USB 2.0 (4) Micro-SD Alimentação Entrada 5V/2.5A DC Prazo de Garantia 2 Anos
Access GPIO https://elinux.org/RPi_GPIO_Code_Samples#C
https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up
https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up/print
BCM2835
- Timers
- Interrupt controller
- GPIO
- USB
- PCM / I2S
- DMA controller
- I2C master
- I2C / SPI slave
- SPI0, SPI1, SPI2
- PWM
- UART0, UART1
Install and configure screensaver and lock screen
- sudo apt-get install xscreensaver
- Preferences, Screen saver
- Auto lock after 2 minutes
- Create new menu item (Preferences, Main menu editor)
- Menu item name Lock
- Command: xscreensaver-comand -lock
- Icon: /usr/share/lxpanel/images/ns-lock.png
Info
$ lsb_release -a No LSB modules are available. Distributor ID: Raspbian Description: Raspbian GNU/Linux 9.4 (stretch) Release: 9.4 Codename: stretch $ uname -a Linux raspberrypi 4.14.71-v7+ #1145 SMP Fri Sep 21 15:38:35 BST 2018 armv7l GNU/Linux
Install eclipse
- apt-get install eclipse-platform
Blink led port 26
https://www.raspberrypi.org/documentation/usage/gpio/python/README.md
- python drive_gpio26.py
Install python 3.8.5 in raspberry py
- tar xvzf Python-3.8.5.tgz
- cd Python-3.8.5/
- ./configure
- make clean
- make
- make install
- sudo make install
- /usr/local/bin/python3.8 -v
- /usr/local/bin/pip3.8 install cherrypy
- pip3.8 install jinja2
Enable X11 forwarding
Blink led service
Starts automatically after boot.
/home/pi/Documents/drive_gpio26.py
/etc/init.d/drive_gpio26
1 #! /bin/sh
2 ### BEGIN INIT INFO
3 # Provides: drive_gpio26
4 # Default-Start: 2 3 4 5
5 # Default-Stop:
6 # Short-Description: Blinks a led
7 # Description: Blinks a led
8 ### END INIT INFO
9 touch /var/lock/drive_gpio26
10 # Carry out specific functions when asked to by the system
11 case "$1" in
12 start)
13 echo "Starting script drive_gpio26 "
14 su pi -c "nohup /usr/bin/python /home/pi/Documents/drive_gpio26.py >> /tmp/drive_gpio26.log 2>&1 &"
15 ;;
16 stop)
17 echo "Stopping script drive_gpio26"
18 kill $(cat /tmp/drive_gpio26.pid)
19 ;;
20 *)
21 echo "Usage: /etc/init.d/drive_gpio26 {start|stop}"
22 exit 1
23 ;;
24 esac
25
26 exit 0
- update-rc.d drive_gpio26 defaults # insert links in /etc/rc*d
- update-rc.d drive_gpio26 defaults 20 80
- update-rc.d drive_gpio26 enable
- service drive_gpio26 status
- reboot
Install MariaDB raspbian
1 sudo bash
2 apt install mariadb-server
3 mysql_secure_installation
4 # define root pass
5 mysql
6 GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY '????????' WITH GRANT OPTION;
7 FLUSH PRIVILEGES;
8 create database testdb;
9 show databases;
10 use testdb
11 CREATE TABLE locations ( id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, lat VARCHAR(30) NOT NULL, lon VARCHAR(30) NOT NULL);
12 exit
13 mysql -u admin -p
14 sudo pip3.8 install mysql-connector-python
15 #
16 python 3.8
17 import mysql.connector
18 mysql.connector.connect(host='localhost',database='testdb',user='admin',password='xxxxxxxx')
test_mariadb.py
1 import mysql.connector
2 conn = mysql.connector.connect(
3 host='localhost',
4 database='testdb',
5 user='admin',
6 password='xxxxxxxx'
7 )
8 cursor=conn.cursor()
9 cursor.execute("Insert into locations (lat,lon) values(%s,%s)" , ("aaa","bbb") )
10 conn.commit()
11 print(cursor.rowcount, "record inserted.")
Install Squid Web Proxy
1 sudo bash
2 apt update
3 apt install squid
4 cd /etc/squid/
5 cp squid.conf squid.conf.ORIG
6 cat squid.conf.ORIG | egrep -v -e '^[[:blank:]]*#|^$' > squid.conf
7 nano squid.conf
8 acl localnet src 192.168.111.0/24
9 http_access allow Localnet
10 # comment http_access deny all
11 service squid reload
12 #firefox manual proxy
13 #IP rpi: 192.168.111.222 Port: 3128
14 #also for ftp and https
15