Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
diy_bluetooth_midi_bridge [2020/11/01 16:50] – [Errors and omissions!] wimdiy_bluetooth_midi_bridge [2021/02/06 01:55] (current) – Added actual content for wpa_supplicant.conf rs2000
Line 43: Line 43:
  
 If you don't know how to create or edit a file in the "boot" volume of the micro-sd card: If you don't know how to create or edit a file in the "boot" volume of the micro-sd card:
-  * On MacOS: press <cmd><space> to bring up the search box, then type terminal<enter>. This will get you to a command prompt. Then, to create the ''wpa_supplicant.conf'' file you can type ''nano /Volumes/boot/wpa_supplicant.conf'' to create the file and open an editor. When done editing press ''<control-s>'', then ''<control-x>'', which should save the file and return you to the command prompt. Next, to create the ''ssh'' file, type ''touch /Volumes/boot/ssh''.+  * On MacOS: press <cmd><space> to bring up the search box, then type terminal<enter>. This will get you to a command prompt. Then, to create the ''wpa_supplicant.conf'' file you can type ''nano /Volumes/boot/wpa_supplicant.conf'' to create the file and open an editor. 
 +  * Add the following content to this file (Use the WiFi data of a router that has internet access!): 
 +  * <html><pre><span style="color:darkblue;font-size:80%;">country=US 
 +ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev 
 +update_config=1 
 + 
 +network={ 
 +    ssid="YOUR_NETWORK_NAME" 
 +    scan_ssid=1 
 +    psk="YOUR_PASSWORD" 
 +    key_mgmt=WPA-PSK 
 +}</span> 
 +</pre></html> 
 +  *  When done editing press ''<control-s>'', then ''<control-x>'', which should save the file and return you to the command prompt. Next, to create the ''ssh'' file, type ''touch /Volumes/boot/ssh''.
   * On Windows: There is an excellent article here: [[https://desertbot.io/blog/headless-pi-zero-w-wifi-setup-windows]] that should tell you everything you need to know.   * On Windows: There is an excellent article here: [[https://desertbot.io/blog/headless-pi-zero-w-wifi-setup-windows]] that should tell you everything you need to know.
  
Line 52: Line 65:
   * On a PC you can use the free PuTTY program. Hopefully connecting to ''pi@raspberrypi.local'' will work.   * On a PC you can use the free PuTTY program. Hopefully connecting to ''pi@raspberrypi.local'' will work.
   * In some cases finding the device by name won't work. I highly suggest this article in that case: [[https://desertbot.io/blog/headless-pi-zero-w-wifi-setup-windows]]   * In some cases finding the device by name won't work. I highly suggest this article in that case: [[https://desertbot.io/blog/headless-pi-zero-w-wifi-setup-windows]]
- 
 ==== Building the Device ==== ==== Building the Device ====
 Yes! You are finally ready now to carefully follow the excellent [[https://www.raspberrypi.org/downloads/|step-by-step guide]]. **If you plan to add the web-page status display, ** it's slightly easier if you skip the ENABLING READ-ONLY MODE steps for now. If you're not sure, then go ahead with these steps though. It's only a little more trouble to work around. Yes! You are finally ready now to carefully follow the excellent [[https://www.raspberrypi.org/downloads/|step-by-step guide]]. **If you plan to add the web-page status display, ** it's slightly easier if you skip the ENABLING READ-ONLY MODE steps for now. If you're not sure, then go ahead with these steps though. It's only a little more trouble to work around.
Line 69: Line 81:
 === Add the Web Content === === Add the Web Content ===
 Assuming you're still logged in from the previous steps, execute the following commands, one step at a time, checking to be sure there are no error messages:  Assuming you're still logged in from the previous steps, execute the following commands, one step at a time, checking to be sure there are no error messages: 
-<code>+<file>
 cd /var/www/html cd /var/www/html
 sudo rm index*.html sudo rm index*.html
Line 75: Line 87:
 sudo unzip html.zip sudo unzip html.zip
 ls ls
-</code>+</file>
  
 The output from the last command should look like this: The output from the last command should look like this:
-<code>+<file>
 pi@raspberrypi(rw):/var/www/html$ ls pi@raspberrypi(rw):/var/www/html$ ls
 html.zip  index.html  styles.css html.zip  index.html  styles.css
-</code>+</file>
  
 Next: Next:
-<code>+<file>
 cd /usr/lib/cgi-bin cd /usr/lib/cgi-bin
 sudo wget -O cgi-bin.zip https://wiki.audiob.us/lib/exe/fetch.php?media=wiki:cgi-bin.zip sudo wget -O cgi-bin.zip https://wiki.audiob.us/lib/exe/fetch.php?media=wiki:cgi-bin.zip
 sudo unzip cgi-bin.zip sudo unzip cgi-bin.zip
-ls +sudo chmod +x *.py 
-</code>+ls -l  
 +</file>
  
 The output of the last command should look like this: The output of the last command should look like this:
-<code+<file
-pi@raspberrypi(rw):/usr/lib/cgi-bin$ ls +pi@raspberrypi(rw):/usr/lib/cgi-bin$ ls -l 
-cgi-bin.zip  devicelist.py  reconnect.py +total 12 
-</code>+-rw-r--r-- 1 root root 1149 Oct 31  2020 cgi-bin.zip 
 +-rwxr-xr-x 1 root root 1117 Oct 24 16:37 devicelist.py 
 +-rwxr-xr-x 1 root root  321 Oct 24 16:31 reconnect.py 
 +</file>
  
-Finally create the file that gives the web server permission to run some needed commands. Type ''sudo nano /etc/sudoers.d/010_www-data-nopasswd'' and paste the following into the file: +== Permission Changes == 
-<code>+ 
 +Create the file that gives the web server permission to run some needed commands. Type ''sudo nano /etc/sudoers.d/010_www-data-nopasswd'' and paste the following into the file: 
 +<file>
 www-data ALL=(ALL) NOPASSWD: /usr/bin/aconnect www-data ALL=(ALL) NOPASSWD: /usr/bin/aconnect
 www-data ALL=(ALL) NOPASSWD: /usr/local/bin/connectall.rb www-data ALL=(ALL) NOPASSWD: /usr/local/bin/connectall.rb
-</code>+</file>
 Press ''<ctrl-s> <ctrl-x>'' to save and exit. Press ''<ctrl-s> <ctrl-x>'' to save and exit.
 +
 +Another permissions modification: Type ''sudo nano /etc/group'', then find the line that begins with ''audio:'' and make it look //exactly// like this:
 +<file>
 +audio:x:29:pi,www-data
 +</file>
 +Remember to type ''<ctrl-s><ctrl-x>'' when done.
 +
 +You probably also want to change the time zone on the device since the web display shows the last refresh time. Enter ''sudo raspi-config'', then go to Localization Options > Change Time Zone.
  
 **If the Read-Only file system modification hasn't been applied,** you should now be able to reboot the device, then go to http://raspberrypi.local from an iOS device to see the status displayed. Otherwise, see below.  **If the Read-Only file system modification hasn't been applied,** you should now be able to reboot the device, then go to http://raspberrypi.local from an iOS device to see the status displayed. Otherwise, see below. 
Line 108: Line 134:
 === If Read-Only File System is in Use === === If Read-Only File System is in Use ===
 Since Nginx requires log files and the Read-Only mod changed the log directory two more steps are needed. First, add a line into /etc/fstab for a new temporary file system. Type ''sudo nano /etc/fstab'' and add a line exactly like the last one below. Then press ''<ctrl-s> <ctrl-x>'' to save and exit. **Be careful!** Don't touch anything else in the file or your system may not boot. Since Nginx requires log files and the Read-Only mod changed the log directory two more steps are needed. First, add a line into /etc/fstab for a new temporary file system. Type ''sudo nano /etc/fstab'' and add a line exactly like the last one below. Then press ''<ctrl-s> <ctrl-x>'' to save and exit. **Be careful!** Don't touch anything else in the file or your system may not boot.
-<code>+<file>
 proc            /proc           proc    defaults          0       0 proc            /proc           proc    defaults          0       0
 PARTUUID=8ea4fe3d-01  /boot           vfat    defaults,ro          0       2 PARTUUID=8ea4fe3d-01  /boot           vfat    defaults,ro          0       2
Line 120: Line 146:
   tmpfs           /var/lib/dhcpcd5 tmpfs   nosuid,nodev               0   tmpfs           /var/lib/dhcpcd5 tmpfs   nosuid,nodev               0
   tmpfs           /var/log/nginx   tmpfs   nosuid,nodev               0   tmpfs           /var/log/nginx   tmpfs   nosuid,nodev               0
-</code>+</file>
  
 (Optional) Turn off logging to keep from filling up the temporary file system. Run ''sudo nano /etc/nginx/nginx.conf''. Find the two log setting lines and comment them out by placing a "#" mark before them. Then press ''<ctrl-s> <ctrl-x>'' to save and exit. (Optional) Turn off logging to keep from filling up the temporary file system. Run ''sudo nano /etc/nginx/nginx.conf''. Find the two log setting lines and comment them out by placing a "#" mark before them. Then press ''<ctrl-s> <ctrl-x>'' to save and exit.
-<code>+<file>
         # access_log /var/log/nginx/access.log;         # access_log /var/log/nginx/access.log;
         # error_log /var/log/nginx/error.log;         # error_log /var/log/nginx/error.log;
-</code>+</file>
  
 Lastly, invoke the ''ro'' command and then ''sudo reboot''. If all went well, the web page should still display when you go to http://raspberrypi.local. Lastly, invoke the ''ro'' command and then ''sudo reboot''. If all went well, the web page should still display when you go to http://raspberrypi.local.
  
-=== If Read-Only File System is not in Use ===+=== If Read-Only File System is Not in Use ===
 (Optional) If all is working, this might be a good time to follow the directions under ENABLING READ-ONLY MODE in the [[https://neuma.studio/rpi-midi-complete.html|article]]. This will help protect the SD card from becoming corrupted when turning off the device. Keep in mind that from the time you do this, a ''rw'' command will need to be executed if any changes are made in the device, and certain app major app installations (such as the web-page modification above) require troubleshooting and extra setup to make work. So only do this if you're really ready to lock things down. (Optional) If all is working, this might be a good time to follow the directions under ENABLING READ-ONLY MODE in the [[https://neuma.studio/rpi-midi-complete.html|article]]. This will help protect the SD card from becoming corrupted when turning off the device. Keep in mind that from the time you do this, a ''rw'' command will need to be executed if any changes are made in the device, and certain app major app installations (such as the web-page modification above) require troubleshooting and extra setup to make work. So only do this if you're really ready to lock things down.
  
Line 141: Line 167:
 You can also PM @wim on the Audiobus forum if you prefer. 8-) You can also PM @wim on the Audiobus forum if you prefer. 8-)
  
 +
 +{{tag>DIY Do_it_Yourself Raspberry_Pi BLE_Midi Bluetooth MIDI_Hub USB USB_MIDI}}
  
  • diy_bluetooth_midi_bridge.1604209857.txt.gz
  • Last modified: 2020/11/01 16:50
  • by wim