Rpi Config: Difference between revisions

 
(10 intermediate revisions by the same user not shown)
Line 279:
conda config --add channels rpi
conda install python=3.6
 
== Desktop environment ==
 
Installation
sudo apt install lightdm
sudo apt install lxsession
sudo raspi-config # Choose Desktop autologin option
 
Troubleshooting
cat .xsession-errors
 
== VNC ==
 
* Run below command:
sudo raspi-config
 
* Enable VNC server
* Go to the options on the VNC Server on Raspberry Pi.
* Change the security authentication to "VNC Password" instead of "Unix Password"
 
= Sense Hat =
Line 312 ⟶ 331:
sense = SenseHat()
sense.show_message("Hello world!")
sense.show_message("One small step for Pi!", text_colour=[255, 0, 0], back_colour=[50,50,50], scroll_speed=0.1)
 
# rotation
Line 338 ⟶ 357:
 
sense.set_pixels(question_mark)
</syntaxhighlight>
 
*Misc:
 
Text Color & Background Color
sense.show_letter('A', text_colour=[0,255,0], back_colour=[50,50,50])
 
sense.scroll_speed()
 
== SenseHat Shutdown Button ==
 
Source: [https://github.com/villama/pi-sense-hat-shutdown/blob/master/Power.py github.com]
 
<syntaxhighlight lang="python">
#!/usr/bin/python3
# Sense Hat Off Button Program
# Press the middle button twice to shutdown
# Press three times to end the program.
 
from sense_hat import SenseHat
from time import sleep
import os
 
s = SenseHat()
last_time = -1
second_last_time = -1
last_direction = ""
second_last_direction = ""
time_passed = 99
s.rotation = 270
low_light = True
 
# Bootup indicator
s.show_letter('U', text_colour=[0,255,0])
sleep(3)
s.clear()
 
def shutdown():
third = False
s.stick.get_events()
sleep(1)
recent_events = s.stick.get_events()
if len(recent_events) > 0:
for x in recent_events:
if x[1] == 'middle' and x[2] == 'pressed':
third = True
if third == True:
s.show_letter("X", text_colour=[0,0,255])
sleep(2)
s.clear()
quit()
else:
s.show_letter("S", text_colour=[255,0,0])
sleep(2)
s.clear()
os.system("sudo shutdown -h now")
 
while(True):
event = s.stick.wait_for_event(emptybuffer=True)
 
if (event.action == "released" or event.direction != "middle"):
continue
 
second_last_time = last_time
second_last_direction = last_direction
last_time = event.timestamp
last_direction = event.direction
 
if second_last_time == -1:
time_passed = 99
else:
time_passed = last_time - second_last_time
 
#print("time passed: {}\n direction: {}".format(time_passed,event.direction))
 
if time_passed < .3:
shutdown()
</syntaxhighlight>
 
Line 618 ⟶ 714:
vcgencmd get_config int
 
== IPv6 Disable ==
 
Edit below file:
sudo nano /boot/cmdline.txt
ipv6.disable=1
 
== Change MAC address ==
 
Edit below file:
sudo nano /etc/rc.local
sudo ifconfig wlan0 hw ether b8:27:eb:4f:14:24
 
== Shrink Rpi Image ==
 
Source: [https://github.com/Drewsif/PiShrink github.com]
 
Installation:
wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh
chmod +x pishrink.sh
sudo mv pishrink.sh /usr/local/bin
 
Shrink:
sudo pishrink.sh pi.img
 
== Upgrade Raspbian to Raspberry Pi OS ==
Source: [https://www.makeuseof.com/tag/raspberry-pi-update-raspbian-os/ makeuseof.com]
 
Update Raspbian:
sudo apt update
sudo apt dist-upgrade -y
 
Run the firmware update:
sudo rpi-update
 
Edit the sources.list file:
sudo nano /etc/apt/sources.list
 
Change “buster” to “bullseye” from:
deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
To:
deb http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi
 
Run the update and upgrade commands:
sudo apt update
sudo apt install gcc-8-base
sudo apt dist-upgrade
 
Use the autoclean instruction to discard unused update files, then reboot:
sudo apt autoclean
sudo reboot
 
<br>