Compare commits
8
Commits
040a6ca33f
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c96d0bb829 | ||
|
|
58206eb384 | ||
|
|
7cc99fb75e | ||
|
|
b292dbd6e9 | ||
|
|
7fa93735bd | ||
|
|
a4d28d02f7 | ||
|
|
b0d632f0c5 | ||
|
|
39c0f158fe |
@@ -12,7 +12,8 @@ Scripts and documentation for setting up a Raspberry Pi (Zero W 1 or 2) for use
|
|||||||
sudo apt-get -y upgrade
|
sudo apt-get -y upgrade
|
||||||
```
|
```
|
||||||
|
|
||||||
1. [Gadget Mode to setup a network connection over USB](https://github.com/raspberrypi/rpi-usb-gadget)
|
1. [Gadget Mode to setup a network connection over USB](https://github.com/raspberrypi/rpi-usb-gadget). A more explanatory version in the [Raspberry Pi Newsletter](https://www.raspberrypi.com/news/usb-gadget-mode-in-raspberry-pi-os-ssh-over-usb/)
|
||||||
|
* If you don't have Internet Connection Sharing, th pi will show up as 10.12.194.1
|
||||||
1. [Setup the OLED screen to print the IP](oled-display/README.md)
|
1. [Setup the OLED screen to print the IP](oled-display/README.md)
|
||||||
Based upon [Marcel's script on github to show the IP address on the OLED screen](https://github.com/mkyas/cpsy-display-ip)
|
Based upon [Marcel's script on github to show the IP address on the OLED screen](https://github.com/mkyas/cpsy-display-ip)
|
||||||
1. Install Blinka by following the guide [CircuitPython Libraries on Linux and Raspberry Pi](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/installing-circuitpython-on-raspberry-pi)]
|
1. Install Blinka by following the guide [CircuitPython Libraries on Linux and Raspberry Pi](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/installing-circuitpython-on-raspberry-pi)]
|
||||||
@@ -48,3 +49,32 @@ Credit: Daníel Bjartur Guðmundsson, transcribed by Joseph T. Foley
|
|||||||
1. Show details of "preconfigured" network: nmcli connection show preconfigured
|
1. Show details of "preconfigured" network: nmcli connection show preconfigured
|
||||||
1. Change the SSID (which wireless network you will connect to) in the "New_SSID": nmcli connection modify preconfigured wifi.ssid "New_SSID"
|
1. Change the SSID (which wireless network you will connect to) in the "New_SSID": nmcli connection modify preconfigured wifi.ssid "New_SSID"
|
||||||
1. Change the wireless access password in the "New_Password": nmcli connection modify preconfigured wifi-sec.psk "New_Password"
|
1. Change the wireless access password in the "New_Password": nmcli connection modify preconfigured wifi-sec.psk "New_Password"
|
||||||
|
|
||||||
|
## Wifi keeps dropping out. What do I do?
|
||||||
|
1. `sudo raspi-config`
|
||||||
|
1. Advanced Options > A12 WLAN Power Save
|
||||||
|
1. Yes to disabling
|
||||||
|
|
||||||
|
## I'd like to stop typing my password all the time
|
||||||
|
1. Copy your private key to your pi from `~/.ssh/id_*` to the Pi
|
||||||
|
1. On the Pi, start ssh-agent with
|
||||||
|
```eval $(ssh-agent)```
|
||||||
|
1. Now add your key
|
||||||
|
```ssh-add```
|
||||||
|
|
||||||
|
## I'd like to access my pi's files directly on my computer.
|
||||||
|
In linux, you can use sshfs: https://github.com/libfuse/sshfs
|
||||||
|
1. Install sshfs
|
||||||
|
```sudo apt install sshfs```
|
||||||
|
1. Make a place to mount the files on the pi
|
||||||
|
```mkdir username-rover```
|
||||||
|
1. Now we mount the pi's filesystem using sshfs
|
||||||
|
```sshfs username@host-or-ip /home/username ~/username-rover```
|
||||||
|
|
||||||
|
## How do I get the python virtual environment to start each time
|
||||||
|
1. Edit your `.bashrc` to have this at the end:
|
||||||
|
```
|
||||||
|
if [ -f ~/env/bin/activate ]; then
|
||||||
|
source ~/env/bin/activate
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|||||||
+10
-3
@@ -18,20 +18,27 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Is the dwc2 overlay installed? Nothing will work if it isn't.
|
# Is the dwc2 overlay installed? Nothing will work if it isn't.
|
||||||
|
<<<<<<< HEAD
|
||||||
|
if lsmod | grep -q "dwc2"; then
|
||||||
|
echo "DWC2 module loaded, setting up OTG gadget serial and ethernet" | logger -t $0 -p info
|
||||||
|
echo "DWC2 module loaded"
|
||||||
|
=======
|
||||||
if [ -d /sys/class/udc ] && [ -n "$(ls -A /sys/class/udc)" ]; then
|
if [ -d /sys/class/udc ] && [ -n "$(ls -A /sys/class/udc)" ]; then
|
||||||
systemd-cat -t gadget.sh -p info echo "DWC2 precompiled, setting up OTG gadget serial and ethernet"
|
systemd-cat -t gadget.sh -p info echo "DWC2 precompiled, setting up OTG gadget serial and ethernet"
|
||||||
elif lsmod | grep -q "dwc2"; then
|
elif lsmod | grep -q "dwc2"; then
|
||||||
systemd-cat -t gadget.sh -p info echo "Pre 6.18.39 kernel. DWC2 module loaded, setting up OTG gadget serial and ethernet"
|
systemd-cat -t gadget.sh -p info echo "Pre 6.18.39 kernel. DWC2 module loaded, setting up OTG gadget serial and ethernet"
|
||||||
|
>>>>>>> master
|
||||||
else
|
else
|
||||||
systemd-cat -t gadget.sh -p warning echo "DWC2 module missing. Aborting OTG setup."
|
echo "DWC2 module missing. Aborting OTG setup." | logger -t $0 -p info
|
||||||
|
echo "DWC2 module missing"
|
||||||
systemctl disable serial-getty@ttyGS0.service
|
systemctl disable serial-getty@ttyGS0.service
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo modprobe libcomposite
|
modprobe libcomposite
|
||||||
cd /sys/kernel/config/usb_gadget
|
cd /sys/kernel/config/usb_gadget
|
||||||
if [ -d "MyGadget" ]; then
|
if [ -d "MyGadget" ]; then
|
||||||
systemd-cat -t gadget.sh -p warning echo "MyGadget already exists. Aborting OTG setup."
|
echo "MyGadget already exists. Aborting OTG setup." | logger -t $0 -p info
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
"""
|
||||||
|
This demo will fill the screen with white, draw a black box on top
|
||||||
|
and then print the device's hostname and IP address in the center of the display
|
||||||
|
|
||||||
|
This example is for use on (Linux) computers that are using CPython with
|
||||||
|
Adafruit Blinka to support CircuitPython libraries. CircuitPython does
|
||||||
|
not support PIL/pillow (python imaging library)!
|
||||||
|
"""
|
||||||
|
|
||||||
|
import board
|
||||||
|
import digitalio
|
||||||
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
|
import adafruit_ssd1306
|
||||||
|
import socket
|
||||||
|
import platform
|
||||||
|
|
||||||
|
# Define the Reset Pin
|
||||||
|
oled_reset = None
|
||||||
|
try:
|
||||||
|
oled_reset = digitalio.DigitalInOut(board.D4)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
# No reset pin
|
||||||
|
|
||||||
|
# Change these
|
||||||
|
# to the right size for your display!
|
||||||
|
WIDTH = 128
|
||||||
|
HEIGHT = 64
|
||||||
|
BORDER = 5
|
||||||
|
|
||||||
|
# Use for I2C.
|
||||||
|
i2c = board.I2C() # uses board.SCL and board.SDA
|
||||||
|
oled = adafruit_ssd1306.SSD1306_I2C(WIDTH, HEIGHT, i2c, addr=0x3C, reset=oled_reset)
|
||||||
|
|
||||||
|
# Clear display.
|
||||||
|
oled.fill(0)
|
||||||
|
oled.show()
|
||||||
|
|
||||||
|
# Create blank image for drawing.
|
||||||
|
# Make sure to create image with mode '1' for 1-bit color.
|
||||||
|
image = Image.new("1", (oled.width, oled.height))
|
||||||
|
|
||||||
|
# Get drawing object to draw on image.
|
||||||
|
draw = ImageDraw.Draw(image)
|
||||||
|
|
||||||
|
# Draw a white background
|
||||||
|
draw.rectangle((0, 0, oled.width, oled.height), outline=255, fill=255)
|
||||||
|
|
||||||
|
# Draw a smaller inner rectangle
|
||||||
|
draw.rectangle(
|
||||||
|
(BORDER, BORDER, oled.width - BORDER - 1, oled.height - BORDER - 1),
|
||||||
|
outline=0,
|
||||||
|
fill=0,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Load default font.
|
||||||
|
font = ImageFont.load_default()
|
||||||
|
|
||||||
|
# Get the local IP address as a string.
|
||||||
|
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
|
||||||
|
s.connect(("8.8.8.8", 80))
|
||||||
|
ipaddr = s.getsockname()[0]
|
||||||
|
|
||||||
|
hostname = platform.node()
|
||||||
|
text = hostname + "\n" + ipaddr
|
||||||
|
|
||||||
|
bbox = font.getbbox(ipaddr)
|
||||||
|
(font_width, font_height) = bbox[2] - bbox[0], bbox[3] - bbox[1]
|
||||||
|
|
||||||
|
draw.multiline_text(
|
||||||
|
xy=(10,10),
|
||||||
|
text=text,
|
||||||
|
fill=255,
|
||||||
|
font=font,
|
||||||
|
spacing=2, #pixel gap between lines,
|
||||||
|
align="left",
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
# Display image
|
||||||
|
oled.image(image)
|
||||||
|
oled.show()
|
||||||
Reference in New Issue
Block a user