Archive for Oktober 2015
Raspberry Pi Guitar Pedals
By : M yunus
Raspberry Pi emang gak ada matinya. selalu ada ide keren buat bisa di pake di kehidupan sehari". Yup, kali ini gua make raspberry buat bikin "Raspberry Pi Guitar pedals". apa itu??? yupp bikin pedal gitar murah pake raspberry. kita bisa make effect gitar ampe ratusan effect, dari music rock, reagge, blues, acoustik, dan banyak lagi ...
yuk simak!!!!!!!!!!! :D
HARDWARE:
- Raspberry Pi B+
- Box kecil untuk raspberry
- USB Sound
- 2x 3mm jack to audio jack female ( kalo gak dapet custom sendiri)
- fan mini ( untuk ngipasin raspi biar gak kepanasan
- 2x 7 segment
- 1 led indikator
- spul gitar akustik
- speaker aktif
- gitar akustik
SOFTWARE:
- pastikan di raspberry anda sudah terinstall raspbian wheezy.
kalo belum ngikutin tutorial disini aja gan :D
https://www.raspberrypi.org/documentation/installation/installing-images/
- Setelah itu bua terminal jalankan perintah" dibawah..
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install qjackctl
sudo apt get install rakarrack
sudo apt-get install xdotool
sudo apt-get install jackd
- setelah terinstall, kita akan membuat aplikasi qjackctl dan rakarrack berjalan langsung saat pertama kali dihidupkan( jadi gakperlu repot" pake monitor ckck)
- buat script dengan perintah:
sudo nano pedal.sh
-setelah itu masukan script dibawah ini. setelahnya ctrl+x, shift+y, enter
#!/bin/sh
xdotool exec jackd -P80 -p16 -t2000 -v -dalsa -dhw:0 -p1024 -n2 -r44100 -S -s
- setelah itu buat script lain dengan perintah:
sudo nano kill.sh
-setelah itu masukan script dibawah, setelahnya ctrl+x, shift+y, enter.
#!/bin/sh
xdotool sleep 15 mousemove 569 749 sleep 1 click 3 mousemove 565 730 sleep 1 click 1
- buat script la dengan nama:
sudo nano pedalall.sh
- setelah itu masukan script dibawah, setelahnya ctrl+x, shift+y, enter.
#!/bin/sh
lxterminal -e "bash -c \"./pedal.sh; exec bash\""
lxterminal --command=qjackctl
lxterminal --command=rakarrack
lxterminal -e "bash -c \"./python.sh; exec bash\""
xdotool sleep 7
lxterminal -e "bash -c \"./kill.sh; exec bash\""
- buat script lg dengan nama python.sh
sudo nano python.sh
- masukan script dibawah dan save:
#!/bin/sh
xdotool exec sudo python python/7segment2.py
- buat script python untuk mengakses GPIO raspberry untuk 7 segment, led indikator dan pedal push dengan perintah :
mkdir python
cd python
sudo nano 7segment2.py
-masukan program python kedalamnya dan save:
import RPi.GPIO as GPIO
import time
import subprocess
ledPin = 21
buttonPin2= 20
led1 = 26
led2 = 16
led3 = 19
led4 = 13
led5 = 12
led6 = 6
led7 = 5
led8 = 7
led9 = 8
led10 = 11
led11 = 25
led12 = 9
led13 = 10
led14 = 24
led15 = 23
led16 = 22
leds = [led1, led2, led3, led4, led5, led6, led7, led8, led9, led10, led11, led12, led13, led14, led15, led16]
GPIO.setmode(GPIO.BCM)
GPIO.setup(ledPin, GPIO.OUT)
GPIO.setup(buttonPin2, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
for led in leds:
GPIO.setup(led, GPIO.OUT)
#==========================...............===============================
#------------------------------------------------------------------------
#-------------------------FUNGSI PANGGILAN-------------------------------
#------------------------------------------------------------------------
def NUM1(index):
GPIO.output(leds[ index + 0 ] , GPIO.HIGH)
GPIO.output(leds[ index + 1 ], GPIO.HIGH)
GPIO.output(leds[ index + 2 ], GPIO.LOW)
GPIO.output(leds[ index + 3 ], GPIO.HIGH)
GPIO.output(leds[ index + 4 ], GPIO.HIGH)
GPIO.output(leds[ index + 5 ], GPIO.HIGH)
GPIO.output(leds[ index + 6 ], GPIO.HIGH)
GPIO.output(leds[ index + 7 ], GPIO.LOW)
def NUM2(index):
GPIO.output(leds[ index + 0 ] , GPIO.LOW)
GPIO.output(leds[ index + 1 ] , GPIO.LOW)
GPIO.output(leds[ index + 2 ] , GPIO.HIGH)
GPIO.output(leds[ index + 3 ] , GPIO.HIGH)
GPIO.output(leds[ index + 4 ] , GPIO.LOW)
GPIO.output(leds[ index + 5 ] , GPIO.HIGH)
GPIO.output(leds[ index + 6 ] , GPIO.LOW)
GPIO.output(leds[ index + 7 ] , GPIO.LOW)
def NUM3(index):
GPIO.output(leds[ index + 0 ] , GPIO.HIGH)
GPIO.output(leds[ index + 1 ] , GPIO.LOW)
GPIO.output(leds[ index + 2 ] , GPIO.LOW)
GPIO.output(leds[ index + 3 ] , GPIO.HIGH)
GPIO.output(leds[ index + 4 ] , GPIO.LOW)
GPIO.output(leds[ index + 5 ] , GPIO.HIGH)
GPIO.output(leds[ index + 6 ] , GPIO.LOW)
GPIO.output(leds[ index + 7 ] , GPIO.LOW)
def NUM4(index):
GPIO.output(leds[ index + 0 ] , GPIO.HIGH)
GPIO.output(leds[ index + 1 ] , GPIO.HIGH)
GPIO.output(leds[ index + 2 ] , GPIO.LOW)
GPIO.output(leds[ index + 3 ] , GPIO.HIGH)
GPIO.output(leds[ index + 4 ] , GPIO.LOW)
GPIO.output(leds[ index + 5 ] , GPIO.LOW)
GPIO.output(leds[ index + 6 ] , GPIO.HIGH)
GPIO.output(leds[ index + 7 ] , GPIO.LOW)
def NUM5(index):
GPIO.output(leds[ index + 0 ] , GPIO.HIGH)
GPIO.output(leds[ index + 1 ] , GPIO.LOW)
GPIO.output(leds[ index + 2 ] , GPIO.LOW)
GPIO.output(leds[ index + 3 ] , GPIO.HIGH)
GPIO.output(leds[ index + 4 ] , GPIO.LOW)
GPIO.output(leds[ index + 5 ] , GPIO.LOW)
GPIO.output(leds[ index + 6 ] , GPIO.LOW)
GPIO.output(leds[ index + 7 ] , GPIO.HIGH)
def NUM6(index):
GPIO.output(leds[ index + 0 ] , GPIO.LOW)
GPIO.output(leds[ index + 1 ] , GPIO.LOW)
GPIO.output(leds[ index + 2 ] , GPIO.LOW)
GPIO.output(leds[ index + 3 ] , GPIO.HIGH)
GPIO.output(leds[ index + 4 ] , GPIO.LOW)
GPIO.output(leds[ index + 5 ] , GPIO.LOW)
GPIO.output(leds[ index + 6 ] , GPIO.LOW)
GPIO.output(leds[ index + 7 ] , GPIO.HIGH)
def NUM7(index):
GPIO.output(leds[ index + 0 ] , GPIO.HIGH)
GPIO.output(leds[ index + 1 ] , GPIO.HIGH)
GPIO.output(leds[ index + 2 ] , GPIO.LOW)
GPIO.output(leds[ index + 3 ] , GPIO.HIGH)
GPIO.output(leds[ index + 4 ] , GPIO.HIGH)
GPIO.output(leds[ index + 5 ] , GPIO.HIGH)
GPIO.output(leds[ index + 6 ] , GPIO.LOW)
GPIO.output(leds[ index + 7 ] , GPIO.LOW)
def NUM8(index):
GPIO.output(leds[ index + 0 ] , GPIO.LOW)
GPIO.output(leds[ index + 1 ] , GPIO.LOW)
GPIO.output(leds[ index + 2 ] , GPIO.LOW)
GPIO.output(leds[ index + 3 ] , GPIO.HIGH)
GPIO.output(leds[ index + 4 ] , GPIO.LOW)
GPIO.output(leds[ index + 5 ] , GPIO.LOW)
GPIO.output(leds[ index + 6 ] , GPIO.LOW)
GPIO.output(leds[ index + 7 ] , GPIO.LOW)
def NUM9(index):
GPIO.output(leds[ index + 0 ] , GPIO.HIGH)
GPIO.output(leds[ index + 1 ] , GPIO.LOW)
GPIO.output(leds[ index + 2 ] , GPIO.LOW)
GPIO.output(leds[ index + 3 ] , GPIO.HIGH)
GPIO.output(leds[ index + 4 ] , GPIO.LOW)
GPIO.output(leds[ index + 5 ] , GPIO.LOW)
GPIO.output(leds[ index + 6 ] , GPIO.LOW)
GPIO.output(leds[ index + 7 ] , GPIO.LOW)
def NUM0(index):
GPIO.output(leds[ index + 0 ] , GPIO.LOW)
GPIO.output(leds[ index + 1 ] , GPIO.LOW)
GPIO.output(leds[ index + 2 ] , GPIO.LOW)
GPIO.output(leds[ index + 3 ] , GPIO.HIGH)
GPIO.output(leds[ index + 4 ] , GPIO.HIGH)
GPIO.output(leds[ index + 5 ] , GPIO.LOW)
GPIO.output(leds[ index + 6 ] , GPIO.LOW)
GPIO.output(leds[ index + 7 ] , GPIO.LOW)
def NUMALL(val,index):
if val == 0:
NUM0(index)
if val == 1:
NUM1(index)
if val == 2:
NUM2(index)
if val == 3:
NUM3(index)
if val == 4:
NUM4(index)
if val == 5:
NUM5(index)
if val == 6:
NUM6(index)
if val == 7:
NUM7(index)
if val == 8:
NUM8(index)
if val == 9:
NUM9(index)
#==========================...............===============================
#------------------------------------------------------------------------
#----------------------------FUNGSI UTAMA--------------------------------
#------------------------------------------------------------------------
try:
while True:
subprocess.call(["xdotool","mousemove","34","70","click","1"])
num1 = 0
while num1 < 6:
NUMALL(num1,0)
num2 = 0
while num2 < 10:
if GPIO.input(buttonPin2)==True:
NUMALL(num2,8)
time.sleep(0.1)
num2 += 1
GPIO.output(ledPin, GPIO.HIGH)
subprocess.call(["xdotool","mousemove","34","70","click","1"])
time.sleep(0.1)
subprocess.call(["xdotool","mousemove","291","158","click","1"])
time.sleep(0.1)
subprocess.call(["xdotool","mousemove","34","70","click","1"])
time.sleep(0.1)
num1 += 1
num1 = 5
while num1 > 0:
NUMALL(num1,0)
num2 = 9
while num2 >= 0:
if GPIO.input(buttonPin2)==True:
NUMALL(num2,8)
time.sleep(0.1)
num2 -= 1
GPIO.output(ledPin, GPIO.HIGH)
subprocess.call(["xdotool","mousemove","34","70","click","1"])
time.sleep(0.1)
subprocess.call(["xdotool","mousemove","228","155","click","1"])
time.sleep(0.1)
subprocess.call(["xdotool","mousemove","34","70","click","1"])
time.sleep(0.1)
num1 -= 1
except KeyboardInterrupt:
GPIO.cleanup()
#--------------------------------------------------------------------------------------------------------------------------------
- setelah semua script dibuat, selanjutnya membut script tsb menjadi executable dengan perintah:
sudo chmod +x namaScript.sh
- setelah itu kita set screen raspberry dengan perintah:
sehingga menjadi
- jika ada pertanyaan bisa coment atw kalo mau fast respond,, Call ke 083820864843
- Videonya gan:
yuk simak!!!!!!!!!!! :D
HARDWARE:
- Raspberry Pi B+
- Box kecil untuk raspberry
- USB Sound
- 2x 3mm jack to audio jack female ( kalo gak dapet custom sendiri)
- fan mini ( untuk ngipasin raspi biar gak kepanasan
- 2x 7 segment
- 1 led indikator
- spul gitar akustik
- speaker aktif
- gitar akustik
SOFTWARE:
- pastikan di raspberry anda sudah terinstall raspbian wheezy.
kalo belum ngikutin tutorial disini aja gan :D
https://www.raspberrypi.org/documentation/installation/installing-images/
- Setelah itu bua terminal jalankan perintah" dibawah..
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install qjackctl
sudo apt get install rakarrack
sudo apt-get install xdotool
sudo apt-get install jackd
- setelah terinstall, kita akan membuat aplikasi qjackctl dan rakarrack berjalan langsung saat pertama kali dihidupkan( jadi gakperlu repot" pake monitor ckck)
- buat script dengan perintah:
sudo nano pedal.sh
-setelah itu masukan script dibawah ini. setelahnya ctrl+x, shift+y, enter
#!/bin/sh
xdotool exec jackd -P80 -p16 -t2000 -v -dalsa -dhw:0 -p1024 -n2 -r44100 -S -s
- setelah itu buat script lain dengan perintah:
sudo nano kill.sh
-setelah itu masukan script dibawah, setelahnya ctrl+x, shift+y, enter.
#!/bin/sh
xdotool sleep 15 mousemove 569 749 sleep 1 click 3 mousemove 565 730 sleep 1 click 1
- buat script la dengan nama:
sudo nano pedalall.sh
- setelah itu masukan script dibawah, setelahnya ctrl+x, shift+y, enter.
#!/bin/sh
lxterminal -e "bash -c \"./pedal.sh; exec bash\""
lxterminal --command=qjackctl
lxterminal --command=rakarrack
lxterminal -e "bash -c \"./python.sh; exec bash\""
xdotool sleep 7
lxterminal -e "bash -c \"./kill.sh; exec bash\""
- buat script lg dengan nama python.sh
sudo nano python.sh
- masukan script dibawah dan save:
#!/bin/sh
xdotool exec sudo python python/7segment2.py
- buat script python untuk mengakses GPIO raspberry untuk 7 segment, led indikator dan pedal push dengan perintah :
mkdir python
cd python
sudo nano 7segment2.py
-masukan program python kedalamnya dan save:
import RPi.GPIO as GPIO
import time
import subprocess
ledPin = 21
buttonPin2= 20
led1 = 26
led2 = 16
led3 = 19
led4 = 13
led5 = 12
led6 = 6
led7 = 5
led8 = 7
led9 = 8
led10 = 11
led11 = 25
led12 = 9
led13 = 10
led14 = 24
led15 = 23
led16 = 22
leds = [led1, led2, led3, led4, led5, led6, led7, led8, led9, led10, led11, led12, led13, led14, led15, led16]
GPIO.setmode(GPIO.BCM)
GPIO.setup(ledPin, GPIO.OUT)
GPIO.setup(buttonPin2, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
for led in leds:
GPIO.setup(led, GPIO.OUT)
#==========================...............===============================
#------------------------------------------------------------------------
#-------------------------FUNGSI PANGGILAN-------------------------------
#------------------------------------------------------------------------
def NUM1(index):
GPIO.output(leds[ index + 0 ] , GPIO.HIGH)
GPIO.output(leds[ index + 1 ], GPIO.HIGH)
GPIO.output(leds[ index + 2 ], GPIO.LOW)
GPIO.output(leds[ index + 3 ], GPIO.HIGH)
GPIO.output(leds[ index + 4 ], GPIO.HIGH)
GPIO.output(leds[ index + 5 ], GPIO.HIGH)
GPIO.output(leds[ index + 6 ], GPIO.HIGH)
GPIO.output(leds[ index + 7 ], GPIO.LOW)
def NUM2(index):
GPIO.output(leds[ index + 0 ] , GPIO.LOW)
GPIO.output(leds[ index + 1 ] , GPIO.LOW)
GPIO.output(leds[ index + 2 ] , GPIO.HIGH)
GPIO.output(leds[ index + 3 ] , GPIO.HIGH)
GPIO.output(leds[ index + 4 ] , GPIO.LOW)
GPIO.output(leds[ index + 5 ] , GPIO.HIGH)
GPIO.output(leds[ index + 6 ] , GPIO.LOW)
GPIO.output(leds[ index + 7 ] , GPIO.LOW)
def NUM3(index):
GPIO.output(leds[ index + 0 ] , GPIO.HIGH)
GPIO.output(leds[ index + 1 ] , GPIO.LOW)
GPIO.output(leds[ index + 2 ] , GPIO.LOW)
GPIO.output(leds[ index + 3 ] , GPIO.HIGH)
GPIO.output(leds[ index + 4 ] , GPIO.LOW)
GPIO.output(leds[ index + 5 ] , GPIO.HIGH)
GPIO.output(leds[ index + 6 ] , GPIO.LOW)
GPIO.output(leds[ index + 7 ] , GPIO.LOW)
def NUM4(index):
GPIO.output(leds[ index + 0 ] , GPIO.HIGH)
GPIO.output(leds[ index + 1 ] , GPIO.HIGH)
GPIO.output(leds[ index + 2 ] , GPIO.LOW)
GPIO.output(leds[ index + 3 ] , GPIO.HIGH)
GPIO.output(leds[ index + 4 ] , GPIO.LOW)
GPIO.output(leds[ index + 5 ] , GPIO.LOW)
GPIO.output(leds[ index + 6 ] , GPIO.HIGH)
GPIO.output(leds[ index + 7 ] , GPIO.LOW)
def NUM5(index):
GPIO.output(leds[ index + 0 ] , GPIO.HIGH)
GPIO.output(leds[ index + 1 ] , GPIO.LOW)
GPIO.output(leds[ index + 2 ] , GPIO.LOW)
GPIO.output(leds[ index + 3 ] , GPIO.HIGH)
GPIO.output(leds[ index + 4 ] , GPIO.LOW)
GPIO.output(leds[ index + 5 ] , GPIO.LOW)
GPIO.output(leds[ index + 6 ] , GPIO.LOW)
GPIO.output(leds[ index + 7 ] , GPIO.HIGH)
def NUM6(index):
GPIO.output(leds[ index + 0 ] , GPIO.LOW)
GPIO.output(leds[ index + 1 ] , GPIO.LOW)
GPIO.output(leds[ index + 2 ] , GPIO.LOW)
GPIO.output(leds[ index + 3 ] , GPIO.HIGH)
GPIO.output(leds[ index + 4 ] , GPIO.LOW)
GPIO.output(leds[ index + 5 ] , GPIO.LOW)
GPIO.output(leds[ index + 6 ] , GPIO.LOW)
GPIO.output(leds[ index + 7 ] , GPIO.HIGH)
def NUM7(index):
GPIO.output(leds[ index + 0 ] , GPIO.HIGH)
GPIO.output(leds[ index + 1 ] , GPIO.HIGH)
GPIO.output(leds[ index + 2 ] , GPIO.LOW)
GPIO.output(leds[ index + 3 ] , GPIO.HIGH)
GPIO.output(leds[ index + 4 ] , GPIO.HIGH)
GPIO.output(leds[ index + 5 ] , GPIO.HIGH)
GPIO.output(leds[ index + 6 ] , GPIO.LOW)
GPIO.output(leds[ index + 7 ] , GPIO.LOW)
def NUM8(index):
GPIO.output(leds[ index + 0 ] , GPIO.LOW)
GPIO.output(leds[ index + 1 ] , GPIO.LOW)
GPIO.output(leds[ index + 2 ] , GPIO.LOW)
GPIO.output(leds[ index + 3 ] , GPIO.HIGH)
GPIO.output(leds[ index + 4 ] , GPIO.LOW)
GPIO.output(leds[ index + 5 ] , GPIO.LOW)
GPIO.output(leds[ index + 6 ] , GPIO.LOW)
GPIO.output(leds[ index + 7 ] , GPIO.LOW)
def NUM9(index):
GPIO.output(leds[ index + 0 ] , GPIO.HIGH)
GPIO.output(leds[ index + 1 ] , GPIO.LOW)
GPIO.output(leds[ index + 2 ] , GPIO.LOW)
GPIO.output(leds[ index + 3 ] , GPIO.HIGH)
GPIO.output(leds[ index + 4 ] , GPIO.LOW)
GPIO.output(leds[ index + 5 ] , GPIO.LOW)
GPIO.output(leds[ index + 6 ] , GPIO.LOW)
GPIO.output(leds[ index + 7 ] , GPIO.LOW)
def NUM0(index):
GPIO.output(leds[ index + 0 ] , GPIO.LOW)
GPIO.output(leds[ index + 1 ] , GPIO.LOW)
GPIO.output(leds[ index + 2 ] , GPIO.LOW)
GPIO.output(leds[ index + 3 ] , GPIO.HIGH)
GPIO.output(leds[ index + 4 ] , GPIO.HIGH)
GPIO.output(leds[ index + 5 ] , GPIO.LOW)
GPIO.output(leds[ index + 6 ] , GPIO.LOW)
GPIO.output(leds[ index + 7 ] , GPIO.LOW)
def NUMALL(val,index):
if val == 0:
NUM0(index)
if val == 1:
NUM1(index)
if val == 2:
NUM2(index)
if val == 3:
NUM3(index)
if val == 4:
NUM4(index)
if val == 5:
NUM5(index)
if val == 6:
NUM6(index)
if val == 7:
NUM7(index)
if val == 8:
NUM8(index)
if val == 9:
NUM9(index)
#==========================...............===============================
#------------------------------------------------------------------------
#----------------------------FUNGSI UTAMA--------------------------------
#------------------------------------------------------------------------
try:
while True:
subprocess.call(["xdotool","mousemove","34","70","click","1"])
num1 = 0
while num1 < 6:
NUMALL(num1,0)
num2 = 0
while num2 < 10:
if GPIO.input(buttonPin2)==True:
NUMALL(num2,8)
time.sleep(0.1)
num2 += 1
GPIO.output(ledPin, GPIO.HIGH)
subprocess.call(["xdotool","mousemove","34","70","click","1"])
time.sleep(0.1)
subprocess.call(["xdotool","mousemove","291","158","click","1"])
time.sleep(0.1)
subprocess.call(["xdotool","mousemove","34","70","click","1"])
time.sleep(0.1)
num1 += 1
num1 = 5
while num1 > 0:
NUMALL(num1,0)
num2 = 9
while num2 >= 0:
if GPIO.input(buttonPin2)==True:
NUMALL(num2,8)
time.sleep(0.1)
num2 -= 1
GPIO.output(ledPin, GPIO.HIGH)
subprocess.call(["xdotool","mousemove","34","70","click","1"])
time.sleep(0.1)
subprocess.call(["xdotool","mousemove","228","155","click","1"])
time.sleep(0.1)
subprocess.call(["xdotool","mousemove","34","70","click","1"])
time.sleep(0.1)
num1 -= 1
except KeyboardInterrupt:
GPIO.cleanup()
#--------------------------------------------------------------------------------------------------------------------------------
- setelah semua script dibuat, selanjutnya membut script tsb menjadi executable dengan perintah:
sudo chmod +x namaScript.sh
- setelah itu kita set screen raspberry dengan perintah:
sudo nano /boot/config.txt
- hilangkan tanda "#" didepan perintah:
#framebuffer_width=1023 #framebuffer_height=767
sehingga menjadi
framebuffer_width=1023
framebuffer_height=767
akhiri dengan, ctrl+x, shift+y, enter.
- setelah itu setting patchbay qjackctl menjadi seperti dalam video ini:
https://www.youtube.com/watch?v=q9tFSsi60AQ&feature=youtu.be
- setelah itu reboot raspberry pi:
sudo reboot
-setelah semua berjalan dengan baik rangkaikan semua hardware tampak seperti ini:
- jika ada pertanyaan bisa coment atw kalo mau fast respond,, Call ke 083820864843
- Videonya gan: