Saturday, December 6, 2014

Raspberry Pi - Using eSpeak with Pidora

Raspberry Pi
Pidora 2014
eSpeak 1.47.11


Status:

  • It's working.
Install:
  • login as root:
  • yum install espeak
Test:
  • Login as an user (not root):
  • espeak "testing with espeak"
  • espeak testing,with,espeak
  • espeak -vpt "testando a voz da lingua portuguesa"
Troubleshotting:
  • Don't run espeak with root user, it will freeze and only will work again after reboot;
  • eSpeak was interfered by alsa-tools*, xdotool and libxdo;
  • Sometimes espeak freezes when it's trying to speak a word with incorrect syntax;
  • Sometimes espeak freezes, or just don't tell anything, if it receives two commands in a short time.
References:



Sunday, November 30, 2014

Installing MySql on Pìdora 2014

Pidora 2014
Apache HTTPD
MySQL 5.5.28


Status:

  • 20141130 Working on it.
  • 20141207 It's working.
ToDo:
  • Import robot database in to this server.
Installing:
  • Install MySql from old repository (fc18):
  • Downloads:
  • cd ~/Downloads
  • wget http://pidora.ca/pidora/releases/18/packages/armv6hl/os/Packages/m/mysql-server-5.5.28-1.fc18.armv6hl.rpm
  • wget http://pidora.ca/pidora/releases/18/packages/armv6hl/os/Packages/m/mysql-5.5.28-1.fc18.armv6hl.rpm
  • wget http://pidora.ca/pidora/releases/18/packages/armv6hl/os/Packages/m/mysql-libs-5.5.28-1.fc18.armv6hl.rpm
  • Login as root:
  • cd ~/Downloads
  • yum install perl-DBD-MySQL.armv6hl (mariadb and mariadb-server does not work)
  • rpm -i mysql-libs-5.5.28-1.fc18.armv6hl.rpm
  • rpm -i mysql-5.5.28-1.fc18.armv6hl.rpm
  • rpm -i mysql-server-5.5.28-1.fc18.armv6hl.rpm
  • Activate service and start mysql:
  • chkconfig mysqld on
  • service mysqld start

Testing:

  • Change mysql root password:
  • mysql
  • UPDATE mysql.user SET Password=PASSWORD('123456') WHERE User='root';


References:
MariaDB vs. MySQL

Raspberry Pidora with Arduino Uno

Pidora
Arduino Uno R3
Python 2.7.8
PySerial 2.7


Status:

  • 20141130 It's working.
Installing PySerial:
  • mkdir ~/pyserial
  • cd ./pyserial
  • Download PySerial sources:
  • wget http://pypi.python.org/packages/source/p/pyserial/pyserial-2.7.tar.gz
  • gzip -d -r ./pyserial-2.7.tar.gz
  • tar -xvf pyserial-2.7.tar
  • cd pyserial-2.7
  • su
  • pwd
  • python setup.py install
Testing PySerial:
  • python
  • import serial
  • ser=serial.Serial(port='/dev/ttyACM0', baudrate=500000, timeout=1)
  • print ser.readline()
  • ser.write("100:1:200:0\n")
  • ser.write("000:1:000:0\n")
References:

Friday, October 17, 2014

Development of Android Applications with openCV

Windows 7 SP1
Android 4.4.4
Eclipse Kepler R2
OpenCV 2.4.10
Android SDK



Code:




  • https://github.com/som4r/som4r/tree/master/robot
Status:
  • 20141016  Using "OpenCV Tutorial 3 - Camera Control" sample application for android. Added Http code to this application. Connection with TTS SOM4R WebService was made successfully.
  • 20141017  Classes of Tutorial3 project has been copied to FaceDetect project, among with others config files (some files were merged with facedetect original ones), and it's working. :)
  • 20141018  The application is capable to call the TTS webservice. App is capturing face image (gray-scale) and saving on device.
  • 20141019  The application is using AsyncTask to fetch http data. Implemented a basic web.py server to recieve images (c:/development/python/wsrest_face_upload.py).
  • 20141021  The application is with multipart upload code. Need to do tests with WS face uploader.
  • 20141022  The application is sending image file to server, but the image is arriving distorced. There is a problem in app (Java Multipart Sender) or it is in (Python) WS face uploader app? does not matter anyway, lets try this using base64 string inside RDF XML object.
  • 20141023  The application is sending image file to server, and face upload webservice is saving file correctly.
  • 20141025  The application has two modes; face identification (default) or face registration. Need to do a modification on resource-xml object according to selected mode.
  • 20141102 The application is sending image and name to ws_registration (./gallery folder), when in registration mode, and to ws_recognition (./upload folder), when in recognition mode. Update of PCA matriz is automatic, just need to put new image in the ./gallery folder.
  • 20141109 The application sends image for both servers (registration and recognition) and user can sends feedback.
  • 20141116 The application has the delete function, calling wsrest_face_deletion.
  • 20141123 The application can consider feedback (interface tag "ignore_feedback"). WS Recognition can call database function "getFeedbackAnalysis", using feedback data stored in "tbl_face_user_feedback" (populated by trigger "after_insert_tbl_stm"). This function adds only 4ms of time to the process.
  • 20141129 WS Registration and WS Recognition are saving looking for 3 images, grayscale, inverted and  canny80x80). It´s working.
  • 20141209 The application is working with minimal errors ocurrence. Version is Beta!

ToDo:

  • Solicitar token e ou IP do servidor ao iniciar o aplicativo. Usuários com permissões de: reconhecer, reconhecer+feedback, cadastrar+reconhecer+feedback, deletar e admin. Cria Documentação e publicá-la na web.
Installing:
  • Download and install Eclipse Kepler R2
  • Download OpenCV for Android
Testing:

  • On most devices running Android 3.2 or older, you can find the option under Settings > Applications > Development.
  • On Android 4.0 and newer, it's in Settings > Developer options.
  • Note: On Android 4.2 and newer, Developer options is hidden by default. To make it available, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options.
References:

Sunday, October 5, 2014

Installing OpenCV 2.4 in Ubuntu 14.04.1

Ubuntu 14.04.1
OpenCV 2.4
Python 2.7.6


Status:
  • 20141005  OpenCV Python samples is working.
  • 20141006  Installing MySql, Apache, PHP and PhpMyAdmin. (Apache=ok, PhpMyAdmin=no)
  • 20141007  Try to fix apache (or php, or phpmyadmin) problem (don't start phpmyadmin configuration popup at instalation time)
  • 20141008  Installing MySql managers (MySQL Workbench, Emma) and restoring "robot" database (manual creation of a new database and import sql file exported by the hp_centauro notebook.
  • 20141009  robot_wsr_face_recognition app is working without any modification :)
Install:
  • sudo apt-get update
  • sudo apt-get install libcv2.4 libcv-dev libhighgui2.4 libhighgui-dev opencv-doc opencv-data libopencv-dev
  • Installing Python Libraries:
  • sudo apt-get install python-opencv  python-dev python-webpy
  • Download OpenCV Library and Extract to "home" folder.
  • Copy OpenCV "data" folder into "samples" folder (otherwise python samples don't work)
Testing OpenCV Python samples:
  • cd ~/opencv-2.4.9/samples/python
  • copiar pasta "OpenCV"/data para "OpenCV"/samples
  • python ./facedetect.py 0
  • python ./motempl.py (contorno e movimento)
  • python ./laplace.py (contorno)
 Installing PyFaces:
  • sudo apt-get install tix python-imaging-tk
  • Download pyfaces
  • Unzip to ~/pyfaces
  • cd ~/pyfaces
  • python pyfacescontroller.py (not working)
Installing som4r repository:
  • sudo apt-get install subversion
Installing Apache, MySql and PhP:

Saturday, September 27, 2014

Raspberry Pi - Pidora

Windows 7
SDFormatter 4.0
Win32DiskImager
PuTTY 0.63


Status:

  • 2014 09 27 - Wi-Fi working.
Install:
  • Download Pidora Operating System image (http://downloads.raspberrypi.org/pidora_latest)
  • Unzip downloaded file.
  • Use Win32DiskImager to write the image to SD card.
  • Connect a keyboard (USB) and monitor (HDMI) to the Raspberry Pi board.
  • Boot Raspberry Pi board with SD card.
Configure:
  • Configure keyboard, timezone, create user "pi", set root password, enable SSH service and DVI adapter. Reboot.
  • Login with default user and password (pi  raspberry).
Configure Wi-Fi:
  • su -     (use root password)
  • Installing ifconfig package:
  • yum provides ifconfig
  • yum install net-tools wpa_supplicant dhclient
  • chkconfig wpa_supplicant on
  • service wpa_supplicant start
  • chkconfig NetworkManager on
  • service NetworkManager start
  • reboot
  • Login as root and configure Wi-Fi Network:
  • nmcli dev wifi con "myssid" password "myssidpassword"
Checking Network:
  • iwconfig
  • iwlist scan
  • pifconfig
  • ifconfig
Update:
  • Login as root.
  • yum update      (zzz)
References:

Saturday, September 13, 2014

Installing Arduino IDE and Libs on Ubuntu 10.10 and Windows 7

Ubuntu 10.10
Windows 7 (64bits)
Arduino IDE 1.0.5 for Linux (32bits)
Arduino IDE 1.5.7 for Windows



Status:
  • 2014.09.14  It's working. 
Installing on Ubuntu:
  • sudo apt-get update
  • sudo apt-get install arduino openjdk-6-jre gcc-avr avr-libc
  • Plug and Check if Arduino device was detected (ttyACM0: USB ACM device):
  • lsusb
  • dmesg | grep tty

Setting the Permission on ttyACM0 (Linux only - All distro):
  • Check the owner group of the serial port:
  • ls -l /dev/ttyACM0
  • You will get something like "dialout" or "uucp".
  • Add our user (pi) to that group:
  • usermod -a -G dialout pi
  • Add our user (pi) to "lock" group (if you have filesystem-2012.6-2 or newer):
  • usermod -a -G lock pi
Installing on Windows:
Testing - Linux and Windows:
  • Double click on /~/arduino-1.0.5/arduino and choose "Run" (arduino.exe on Windows).
  • Select a serial port (menu: Tools->Serial Port->dev/ttyACM0) (COM4 on Windows).
  • If there is no serial port available then try one of those options.
  • Select a board (menu: Tools->Board->Arduino Uno).
  • See examples (menu: File->Sketchbook).
  • Open file serial_echo.ino with Arduino IDE and Upload.



Testing with Python:
  • We don't need any privileges, like when working with Arduino IDE (chmod 777 /dev/ttyACM0).
  • python
  • import serial
  • On Linux:
  • ser=serial.Serial(port='/dev/ttyACM0', baudrate=500000, timeout=1)
  • On Windows:
  • ser=serial.Serial(port='COM4', baudrate=500000, timeout=1)
  • ser.write('Testing...\n')
  • print ser.readline()
  • ser.close()
References:

Sunday, September 7, 2014

Raspberry Pi - Raspbian - 2015

Windows 7
SDFormatter 4.0
Win32DiskImager
PuTTY 0.63
Raspbian 2015-02-16


Status:

  • 05/04/2015 - Configuring Wi-Fi network
  • 07/09/2014 - Access allowed (SSH through Raspberry Pi ethernet adapter). 

Install:


Configure:
  • Configure keyboard, timezone, ssh service and camera-support (raspi-config).
  • Login with default user and password (pi  raspberry).
  • Configuring Wi-Fi:
  • sudo cp /etc/wpa_supplicant/wpa_supplicant.conf  /etc/wpa_supplicant/wpa_supplicant.conf.orig
  • sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
  • Go to the bottom of the file and add the code bellow.

  • sudo cp /etc/network/interfaces /etc/network/interfaces.orig
  • Allow hotplug and dhcp client to wlan0 network interface:

  • Save the file and reboot system.
  • Check network status:
  • sudo ifconfig wlan0

  • Tip for ubuntu 16.04 Server:
  • Do not need wpa_supplicant.conf file, just config ssid and psk in /etc/network/interfaces file. 
  • auto wlp3s0
  • iface wlp3s0 inet dhcp
  •        wpa-ssid network-name
  •        wpa-psk pre-shared-key
  • Configuring Ethernet cable network:
  • Allow hotplug to eth0 network interface:
  • sudo nano /etc/network/interfaces


  • Connect Ethernet cable to Raspberry Pi board.
  • sudo ifdown eth0
  • sudo ifup eth0
  • Check network status:
  • sudo ifconfig

  • sudo reboot
  • Connect the Raspbian OS through the network using ssh client (Putty for Windows).



  • Update packages:
  • sudo apt-get update
Troubleshoot:

  • With this interfaces file above, cannot use Realtek Wlan Adapter and keyboard at same time ("IRQ32 disabled after an error").
  • see file /var/log/syslog



References:

Sunday, August 31, 2014

Raspberry Pi - Python Libraries - Raspbian or Adafruit

Windows 7
Linux 3.1.9adafruit+ armv6l
PuTTY 0.63
WinSCP 5.5.5


Status:
  • 20140830 Working both examples.
ToDo:
  • Choose the " best"  Python API:
    • RPIO?
    • Arduino Nampy? - This library allows you to communicate with your Arduino connected via USB using classes and methods really similar to those in the Arduino framework. Behind the scenes , Nanpy communicates via USB with the server part running as Arduino firmware. 
    • WiringPi?
  • OR use Serial Communication and pass commands to Arduino connected.
Install RPIO lib:
  • cd ~/
  • sudo apt-get install python-setuptools
  • sudo easy_install -U RPIO
  • git clone https://github.com/metachris/RPIO.git
  • cd RPIO
  • sudo python setup.py install
Testing RPIO lib:
  • cd ~/RPIO/examples
  • PWM Servo example:
  • python example3_pwm_servo.py

  • PWM LowLevel example:
  • python example4_pwm_lowlevel.py



Connect Raspberry Pi and Arduino:




  • sudo apt-get install python-serial
  • Call Python console:
  • python
  • >>>import serial
  • >>>ser = serial.Serial('/dev/ttyACM0', 500000)
  • >>>ser.readline()
  • >>>print ser
  • >>>ser.write('3')

Install Arduino lib:

  • sudo apt-get install arduino (see links 4 and 5 below)
References:

Saturday, August 30, 2014

Raspberry Pi - Remote Access - Raspbian or Adafruit

Windows 7
Linux 3.1.9adafruit+ armv6l
PuTTY 0.63
WinSCP 5.5.5


Status:
  • 20140906 OS Crashed. Building from scratch.
  • 20140830 Working Wi-Fi, SSH and VNC (manual start).
ToDo:
  • Autostart of VNCServer it's not working.
Install - Wi-Fi:
  • Login using a keyboard (USB) and monitor (HDMI) connected to the raspberry board: 
  • Default user and password:   pi   raspberry
  • Edit the file /etc/network/interfaces  and change SSID and password of Wi-Fi network. See on the References links (below) how to encrypt the password.

  • sudo reboot
Install SSH Server:
  • Already installed by default.
  • To configure:
  • sudo raspi-config
  • Interfacing Options  -> SSH
  • To access: Putty for Windows.


  • To transfer files: WinSCP (for Windows).


Install VNC Server:
  • sudo apt-get update
  • sudo apt-get install tightvncserver
  • tightvncserver
  • vncserver :0 -geometry 1920x1080 -depth 24
  • Configuring Autostart:
  • Create a file (~/vnc.sh):

  • cd ~/
  • chmod +x vnc.sh
  • ./vnc.sh
  • Connect to Raspberry Desktop using VNC Viewer.

  • Configuring Autostart:
  • cd /etc/init.d/
  • Create a file (/etc/init.d/vncboot.sh)

  • chmod 755 vncboot
  • update-rc.d ./vncboot defaults (or update-rc.d /etc/init.d/vncboot defaults)
  • reboot

References: