Skip to content

Commit b26a68c

Browse files
committed
updated Git readme and organized everything a little
1 parent 95f8cae commit b26a68c

File tree

6 files changed

+31
-16
lines changed

6 files changed

+31
-16
lines changed

README.md

+30-15
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,59 @@
33
**Raspberry Pi Zero W**
44

55
( Raspberry Pi 0 Wireless, Wi-Fi / Bluetooth )
6-
76
( Tested on v1.1 2016 )
87

98
![pi_in_a_pedal](https://user-images.githubusercontent.com/23065167/119210762-11117580-ba7c-11eb-8453-3acd4dfde7e4.jpg)
9+
## Demonstration
10+
[YouTube link](https://www.youtube.com/watch?v=9JegZhkDhrw&t=13s)
1011

11-
## Setting up Pi Zero
12-
13-
### HEADLESS
14-
#### (No USB keyboard, mouse, HDMI monitor or adapters needed)
12+
## Setting up Pi Zero - HEADLESS
13+
(No USB keyboard, mouse, HDMI monitor or adapters needed)
1514

1615
**More details** - [http://blog.gbaman.info/?p=791](http://blog.gbaman.info/?p=791)
1716

1817
For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required. **Make sure your USB cable works**. I used 2 faulty cables and wasted about 4 hours going down a dead-end rabbit hole. You should use a USB cable that transfers data, and isn't used just for charging. After flashing the microSD card and connecting the Pi via USB, running `dmesg` on the host computer can help diagnose the cable.
1918

2019
Windows computers must be running [Bonjour](https://support.apple.com/kb/DL999) (should be installed if iTunes or Quicktime is installed). Mac OS has Bonjour installed by default. Linux uses the Avahi Daemon. Ubuntu has it built-in, but you can check that it's running with: `sudo service avahi-daemon status`. This will let you use the `raspberrypi.local` address out-of-the-box.
2120

22-
#### **1. Flash the microSD**
21+
### **1. Flash the microSD**
2322
You'll need a microSD card reader or adapter. Plug it in. Use the [Raspberry Pi Imager](https://www.raspberrypi.org/software/) to install RaspberryPi OS onto the microSD card.
2423

2524
The RPi Imager can be installed on Ubuntu 20.04 with:
2625
`sudo apt-get install rpi-imager`
2726

28-
#### **2. Edit `config.txt`**
27+
### **2. Edit `config.txt`**
2928
Once Raspberry Pi OS is flashed, open up the boot partition (in Windows Explorer, Finder, Terminal Emulator, etc.) and add to the bottom of the `config.txt` file `dtoverlay=dwc2` on a new line, then save the file.
3029

3130
On Ubuntu 20.04, the config.txt file would be located at `/media/$USER/boot/config.txt`
3231

33-
#### **3. Enable SSH**
32+
### **3. Enable SSH**
3433
If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called `ssh` in the SD card as well. On Ubuntu 20.04: `sudo touch /media/$USER/boot/ssh`. By default SSH is now disabled so this is required to enable it. **Remember** - Make sure your file doesn't have an extension (like .txt etc)!
3534

36-
#### **4. Edit `modules`**
35+
### **4. Edit `modules`**
3736
Add `dwc2` and `libcomposite` to the `modules` file. On Ubuntu 20.04, the file is at `/media/$USER/rootfs/etc/modules`. You can run:
3837

39-
#### **5. Boot up the Pi** That's it, eject the SD card from your computer, put it in your Raspberry Pi Zero and connect it via USB to your computer. It will take up to 90s to boot up (shorter on subsequent boots).
38+
### **5. Boot up the Pi** That's it, eject the SD card from your computer, put it in your Raspberry Pi Zero and connect it via USB to your computer. It will take up to 90s to boot up (shorter on subsequent boots).
39+
40+
I didn't add `g_ether`, so it won't appear as a USB Ethernet device. We'll use `ssh [email protected]` to SSH into the Pi on the local network instead. With the microSD back in the computer, edit the file rootfs:`/etc/wpa_supplicant/wpa_supplicant.conf`:
41+
42+
```
43+
country=US
44+
network={
45+
ssid="ChanceTheRouter"
46+
psk="CocoaButterKisses"
47+
}
48+
```
49+
50+
Additionally, create a file called `ssh` on the boot partition. Change into the root of the boot directory and run:
51+
52+
```
53+
touch ssh
54+
```
4055

41-
We didn't add `g_ether`, so is won't appear as a USB Ethernet device. Use `ssh [email protected]` to SSH into the Pi on your network. If you have multiple Pi's on the network, rename the existing hosts or use [Fing](https://www.fing.com/products/development-toolkit) to discover the Pi's IP address.
56+
If you have multiple Pi's on the network, rename the existing hosts or use [Fing](https://www.fing.com/products/development-toolkit) to discover the Pi's IP address. If you know the Pi's MAC address, you can also use the helper script included in the repo, `rpi.sh`. Replace the "<pi mac address lowercase and colons>" with your Pi's MAC address. You might have to play with the range of the IP address included in the script.
4257

43-
#### **6. Configure the Pi as an HID**
58+
### **6. Configure the Pi as an HID**
4459
Configure the Pi as a _human interface device_ (the same device type of a generic USB keyboard) by adding the following script to `/usr/bin/vimclutch_usb`
4560

4661
```
@@ -76,22 +91,22 @@ Make the script executable:
7691
Add the script to `/etc/rc.local` before `exit 0`:
7792
`/usr/bin/vimclutch_usb #setup USB gadget`
7893

79-
#### **6. Install script requirements**
94+
### **6. Install script requirements**
8095
Install python3-pip on your Raspberry Pi:
8196
`sudo apt-get install python3-pip`
8297

8398
Install python requirements:
8499
`sudo pip3 install -r requirements.txt`
85100

86-
#### **7. Execute script on boot**
101+
### **7. Execute script on boot**
87102
Add the Python script to `rc.local` so that the pedal will work immediately upon power-up:
88103

89104
`sudo vim /etc/rc.local`
90105

91106
Then add the following line before the end of the file:
92107
`python3 /home/pi/vim-clutch/vim-clutch.py`
93108

94-
#### **8. Tweak the settings**
109+
### **8. Tweak the settings**
95110
Adjust the `sleep()` times for best results.
96111

97112
---
File renamed without changes.

gpio_led.py learning/gpio_led.py

File renamed without changes.
File renamed without changes.
File renamed without changes.

rpi.sh

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/bash
2-
ssh pi@`for ((i=1; i<=29; i++));do arp -a 192.168.1.$i; done | grep <mac address of your pi> | awk '{print $2}' | sed -e 's/(//' -e 's/)//'`
2+
ssh pi@`for ((i=1; i<=29; i++));do arp -a 192.168.0.$i; done | grep "<pi mac address lowercase and colons>" | awk '{print $2}' | sed -e 's/(//' -e 's/)//'`

0 commit comments

Comments
 (0)