Tampilkan postingan dengan label Raspberry. Tampilkan semua postingan
Tampilkan postingan dengan label Raspberry. Tampilkan semua postingan

Crontab of mine


My old crontab -e entries.
need to be changed now.

39 * * * * /var/lib/asterisk/bin/freepbx-cron-scheduler.php
*/30 * * * * sudo ntpdate -u id.pool.ntp.org
@reboot root ntpdate -u id.pool.ntp.org
@reboot root perl /root/misterhouse/bin/mh -tk 0
*/15 * * * * sudo /usr/bin/python /root/twpi.py
*/1 * * * * sudo /usr/bin/python /root/getdata.py

Mau tahu ip sendiri dalam bentuk text?

Query ke getip.dyndns.org

Install web2py di raspberry pi

Saya gunakan script ini.

copy paste.
chmod +x
lalu jalankan.


echo "This script will:
1) install all modules need to run web2py on Ubuntu/Debian
2) install web2py in /home/www-data/
3) create a self signed sll certificate
4) setup web2py with mod_wsgi
5) overwrite /etc/apache2/sites-available/default
6) restart apache.

You may want to read this script before running it.

Press a key to continue...[ctrl+C to abort]"

read CONFIRM

#!/bin/bash
# optional
# dpkg-reconfigure console-setup
# dpkg-reconfigure timezoneconf
# nano /etc/hostname
# nano /etc/network/interfaces
# nano /etc/resolv.conf
# reboot now
# ifconfig eth0

echo "installing useful packages"
echo "=========================="
apt-get update
apt-get -y install ssh
apt-get -y install zip unzip
apt-get -y install tar
apt-get -y install openssh-server
apt-get -y install build-essential
apt-get -y install python2.5
apt-get -y install ipython
apt-get -y install python-dev
apt-get -y install postgresql
apt-get -y install apache2
apt-get -y install libapache2-mod-wsgi
apt-get -y install python2.5-psycopg2
apt-get -y install postfix
apt-get -y install wget
apt-get -y install python-matplotlib
apt-get -y install python-reportlab
apt-get -y install mercurial
/etc/init.d/postgresql restart

# optional, uncomment for emacs
# apt-get -y install emacs

# optional, uncomment for backups using samba
# apt-get -y install samba
# apt-get -y install smbfs

echo "downloading, installing and starting web2py"
echo "==========================================="
cd /home
mkdir www-data
cd www-data
rm web2py_src.zip*
wget http://web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip
mv web2py/handlers/wsgihandler.py web2py/wsgihandler.py
chown -R www-data:www-data web2py

echo "setting up apache modules"
echo "========================="
a2enmod ssl
a2enmod proxy
a2enmod proxy_http
a2enmod headers
a2enmod expires
a2enmod wsgi
mkdir /etc/apache2/ssl

echo "creating a self signed certificate"
echo "=================================="
openssl genrsa 1024 > /etc/apache2/ssl/self_signed.key
chmod 400 /etc/apache2/ssl/self_signed.key
openssl req -new -x509 -nodes -sha1 -days 365 -key /etc/apache2/ssl/self_signed.key > /etc/apache2/ssl/self_signed.cert
openssl x509 -noout -fingerprint -text < /etc/apache2/ssl/self_signed.cert > /etc/apache2/ssl/self_signed.info

echo "rewriting your apache config file to use mod_wsgi"
echo "================================================="
echo '
NameVirtualHost *:80
NameVirtualHost *:443
# If the WSGIDaemonProcess directive is specified outside of all virtual
# host containers, any WSGI application can be delegated to be run within
# that daemon process group.
# If the WSGIDaemonProcess directive is specified
# within a virtual host container, only WSGI applications associated with
# virtual hosts with the same server name as that virtual host can be
# delegated to that set of daemon processes.
WSGIDaemonProcess web2py user=www-data group=www-data processes=1 threads=1


  WSGIProcessGroup web2py
  WSGIScriptAlias / /home/www-data/web2py/wsgihandler.py
  WSGIPassAuthorization On

 
    AllowOverride None
    Order Allow,Deny
    Deny from all
   
      Allow from all
   

 

  AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) \
           /home/www-data/web2py/applications/$1/static/$2
 
    Options -Indexes
    Order Allow,Deny
    Allow from all
 

 
  Deny from all
 

 
  Deny from all
 

  CustomLog /var/log/apache2/access.log common
  ErrorLog /var/log/apache2/error.log



  SSLEngine on
  SSLCertificateFile /etc/apache2/ssl/self_signed.cert
  SSLCertificateKeyFile /etc/apache2/ssl/self_signed.key

  WSGIProcessGroup web2py
  WSGIScriptAlias / /home/www-data/web2py/wsgihandler.py
  WSGIPassAuthorization On

 
    AllowOverride None
    Order Allow,Deny
    Deny from all
   
      Allow from all
   
 

  AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) \
        /home/www-data/web2py/applications/$1/static/$2

 
    Options -Indexes
    ExpiresActive On
    ExpiresDefault "access plus 1 hour"
    Order Allow,Deny
    Allow from all
 

  CustomLog /var/log/apache2/access.log common
  ErrorLog /var/log/apache2/error.log

' > /etc/apache2/sites-available/default

# echo "setting up PAM"
# echo "================"
# sudo apt-get install pwauth
# sudo ln -s /etc/apache2/mods-available/authnz_external.load /etc/apache2/mods-enabled
# ln -s /etc/pam.d/apache2 /etc/pam.d/httpd
# usermod -a -G shadow www-data

echo "restarting apache"
echo "================"

/etc/init.d/apache2 restart
cd /home/www-data/web2py
sudo -u www-data python -c "from gluon.widget import console; console();"
sudo -u www-data python -c "from gluon.main import save_password; save_password(raw_input('admin password: '),443)"
echo "done!"

mengInstall PjSIP

mengInstall PjSIP
di Raspberry Pi


sudo apt-get install libv4l-dev libx264-dev libssl-dev libasound2-dev asterisk


SDL

cd
mkdir tmp
cd $HOME/tmp
wget http://www.libsdl.org/tmp/SDL-2.0.tar.gz
tar xvfz SDL-2.0.tar.gz
cd SDL-2.0.0-7125/
./configure
make
sudo make install

FFMPEG

cd $HOME/tmp
wget http://ffmpeg.org/releases/ffmpeg-0.10.7.tar.bz2
tar xvfj ffmpeg-0.10.7.tar.bz2
cd ffmpeg-0.10.7
./configure --enable-shared --disable-static --enable-memalign-hack --enable-gpl --enable-libx264
make
sudo make install

Build PjSIP

cd $HOME/tmp
wget http://www.pjsip.org/release/2.1/pjproject-2.1.tar.bz2
tar xvfj pjproject-2.1.tar.bz2
cd pjproject-2.1.0/
./configure --disable-video
make dep
make

Mounting Samba

instruksi mounting samba ke raspberry pi

sudo apt-get install smbclient

sudo mount -t cifs -o user=IRZA,password=S***,sec=ntlmv2,rw,file_mode=0777,dir_mode=0777 //192.168.30.97/Public /home/pi/data/


untuk raspberry pi bisa dimounting di Windows.

sudo apt-get install samba samba-common-bin

edit file /etc/samba/samba.conf

tambahkan:
  workgroup = yes
  wins support = yes

dan berikut ini:

[pihome]
   comment= Pi Home
   path=/home/pi
   browseable=Yes
   writeable=Yes
   only guest=no
   create mask=0777
   directory mask=0777
   public=no

Updated Robot WishList

  1. I would like to have a mobile workstation for my laptop, i usually change place while working.. living room, backyard.. etc (still in my home)
  2. Making the robot available to Indonesian language is better.
  3. I don't watch TV so much  but I would like to have recent news from selected RSS internet feed
  4. Communicating with people.. i mean telephony system in my robot.. i can perform calls from my laptop and vice versa.
  5. I want to check email.. and someone read it for me.
  6. Browsing the internet by voice or virtual touch (without mouse?)
  7. Entertaing robot..
  8. I have music clips or movie clips that i like to see many times. (building database and a navigation menu for search)
  9. I shared my laptop with my wife, and some other people.. so i cannot close the laptop for only one software. maybe other people can use the system too..
  10. Video capture
  11. I love music and love playing drums.. i want to have a recording station while jamming with my friends.
  12. Chatting with the robot would be nice
  13. Should be relatively cheap.. =)
  14. I like to have a menu system for my robot
  15. The robot should have a brain for navigating my house.
  16. The robot can recognize face and objects..
  17. Home controlled by robot.. this is good
  18. Robot Emotions? Leaf have that
  19. The robot can take or bring me something... (i think it's very hard)
  20. This one is really deep..   i want to ride my robot. transportation in my neigborhood maybe?? (last priority :) )

21. Sync with Social Media / Facebook / Twitter / email
22. Design is Modular. Can add Head / Arm / other Interface.
23. Remainder - Sync with Contacts and Google Calendar.
24. Update with weather and Traffic Jam CCTV.

25. Can use APM - Mission planner and Turnigy Remote
26. Interface to ROS


Flash Arduino UNO / MEGA menjadi device MIDI

Salah satu implementasi arduino yang menarik adalah membuat arduino menjadi midi device.
Langkah berikut untuk flashing arduino

Saya menggunakan arduino mega 2560 dari DFROBOT bisa dibeli disini

1. download dfu-programmer / unzip di harddisk anda download disini
2. download hex yang sudah dicompile   download disini

3. Connect Arduino ke computer via USB
4. reset Arduino dengan menghubungkan 2 solderan ini (pin)

5. Nanti Arduino mereset dan setelah connect kembali dia menjadi ARDUINO DFU
6. PENTING: Install driver windows dfu dengan mengarahkan ke directori dfu yang telah didownload
7. Jalankan langkah ini:

dfu-programmer at90usb82 erase
dfu-programmer at90usb82 flash Arduino-usbmidi-0.2-mega2560.hex
dfu-programmer at90usb82 reset

8. Lepas USB dan Connect kembali.

Anda tidak bisa mengupload sketch apabila sudah memasang ini. Upload implementasi anda sebelumnya.
atau mereflash kembali ke MEGA-dfu_and_usbserial_combined.hex yang ada di directory
arduino-1.0.5\hardware\arduino\firmwares\atmegaxxu2

Semoga Berhasil.


Raspberry Pi - web2py


Install Web2py di Pi


wget http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh
chmod +x setup-web2py-ubuntu.sh
sudo ./setup-web2py-ubuntu.sh

Install Pygal. for Pi
slow but works.
apt-get install python-pip
apt-get install libxml2-dev libxslt1-dev gcc
apt-get install python2.7-dev
pip install pygal

Client ntpdate
sudo apt-get install ntpdate

bisa sync waktu dengan command:
ntpdate -u id.pool.ntp.org

Untuk crontab.
crontab -e
0/15 0 0 0 0 sudo ntpdate -u id.pool.ntp.org
@reboot root ntpdate -u id.pool.ntp.org