Speech with Raspberry Pi


Raspberry Pi is an excellent automation control unit, and we can use it to build a voice recognition feature in order to make it as a voice automation control unit. Yeah, is it very interesting ! In the following, I will show you the script to build voice feature, including converting speech to text, converting text to speech, auto-reply a text question.

Script to convert Speech to Text

I take the benefit of using google speech recognition ver 2 feature and arecord feature of Raspberry Pi. To remind that you should apply your google api key for usage in this script, as below:

read more

How to Capture Weather Forecast from web using Raspberry Pi's Python Program


We can use python to develop a program to capture any city’s weather forecast from openweathermap.org web site under our Raspberry Pi computer. I list our program and screen capture result in the following for your reference.

Program Source Code under Python ver 3 as below:

import urllib.request,json

city = input(“Enter City: “)

def getForecast(city) :
    #url = “http://api.openweathermap.org/data/2.5/forecast/daily?cnt=7&units=meteric&mode=json&q=”
    #url = “http://api.openweathermap.org/data/2.5/forecast/city?id=524901&APPID=42443ecbdcad3d01842205e3745895cd”
    #url = “http://api.openweathermap.org/data/2.5/forecast/daily?cnt=7&units=meteric&mode=json&q=LONDON&lang=zh_cn&APPID=42443ecbdcad3d01842205e3745895cd”
    url = “http://api.openweathermap.org/data/2.5/forecast/daily?cnt=7&units=meteric&mode=json&q=”
    url = url + city + “&lang=zh_cn&APPID=42443ecbdcad3d01842205e3745895cd”
    req = urllib.request.Request(url)
    return json.loads(response.read().decode(“UTF-8″))

read more

Network Communication Script for Raspberry Pi


We can use python programs to start a server side and client side network communication service and allow them to transmit message  to each other under a Raspberry Pi. For example, we start two LXTerminal Sessions under a Raspberry Pi (or two difference Pi), and then run the following script.

In Server Side, run the following script:

import socket
comms_socket = socket.socket()
comms_socket.bind((‘localhost’, 50000))
connection, address = comms_socket.accept()
while True:
    send_data = input(“Reply: “)
    connection.send(bytes(send_data, “UTF-8″))

read more

Most Easy Way to Start a Web Server Service Using Python


Although it is easy to start-up IIS under Window O/S or Apache under Unix O/S, we still have another choice to start a web server service using Python programming tools. You only need to install python, and then start python and run the following script line by line:

import http.server, os
#define the server document directory with unix path;
#if it is window env with directory as c:\Users\administrator\Documents\
httpd = http.server.HTTPServer((‘′, 8000),

read more

Setup to upload & access Dropbox on Raspberry Pi


If you want to upload file from or to DropBox through Raspberry Pi, it is easy to do so. The following will show you a a installation program and its setup steps.

Step 1. Setup DropBox account and apps from web

First of all you need a DropBox account and apps account through the following links. Hop on over to dropbox is free.


You then need to visit this link https://www.dropbox.com/developers/apps, login to DropBox and create an “app” by clicking the “create app” button.

Then choose “Dropbox API app”, “Files and Datastores”, and answer the final question “Can your app be limited to its own, private folder?” – either answer is OK, depending on your needs. The result will be as below:

read more

Backup of Raspberry Pi system image from SIM card


If you want to backup your Raspberry Pi system image from SIM card, you can use the HDD Raw Copy Tool as described below.

Developer: HDDGURU.COM

License terms: Freeware

Supported OS: MS Windows XP, Vista, 7, 8, Server 2003, 2008, 2008R2

HDD Raw Copy Tool is a utility for low-level, sector-by-sector hard disk duplication and image creation.

  • Supported interfaces: S-ATA (SATA), IDE (E-IDE), SCSI, SAS, USB, FIREWIRE.
  • Big drives (LBA-48) are supported.
  • Supported HDD/SSD Manufacturers: Intel, OCZ, Samsung, Kingston, Maxtor, Hitachi, Seagate, Samsung, Toshiba, Fujitsu, IBM, Quantum, Western Digital, and almost any other not listed here.
  • The program also supports low-level duplication of FLASH cards (SD/MMC, MemoryStick, CompactFlash, SmartMedia, XD) using a card-reader.

HDD Raw Copy tool makes an exact duplicate of a SATA, IDE, SAS, SCSI or SSD hard disk drive. Will also work with any USB and FIREWIRE external drive enclosures as well as SD, MMC, MemoryStick and CompactFlash media.

read more

Sound Control on Raspberry Pi


Raspberry Pi has a build-in sound card, HDMI and phone jack output to play sound. If you connect to HDMI display or plug-in a headphone to it, you can play sound. The setup of sound feature is easy as described below.

Step 1. Install PiAUISuite sound software

$ sudo apt-get install git-core

$ git clone git://github.com/StevenHickson/PiAUISuite.git

$ ./InstallAUISite.sh

(be aware to answer pop-up question to continue installation)

Step 2. Setup Sound Device

$ modprobe snd_bcm2835

$ amixer controls
numid=3,iface=MIXER,name=’PCM Playback Route’
numid=2,iface=MIXER,name=’PCM Playback Switch’
numid=1,iface=MIXER,name=’PCM Playback Volume’

read more

Build a Raspberry Pi Webcam Server for Motion Detection


Raspberry Pi can be connected to a camera to capture picture and video in order to use it as a CCTV motion detection device, which I have described in my previous post. To further enhance the motion detection feature, we can build a Raspberry Pi Webcam Video Server for browsing from web. It is more effective to monitor environment from outside. In the following, I will describe the installation steps of a application call motionPie to build a web server.

1. Download & Format the SD Card

  1. Download the Motion Pie SD Card Image from the Motion Pie GitHub repository or my link <<HERE>>.
  2. You will need a formatting tool. Visit the SD Association’s website and download SD Formatter 4.0 for either Windows or Mac.
  3. Follow the instructions to install the formatting software.
  4. Insert your SD card into the computer or laptop’s SD card reader and check the drive letter allocated to it, e.g. I:/
  5. In SD Formatter, select the drive letter for your SD card (eg. I:/) and format

2. Install the Motion Pie Image onto the SD Card

  1. Download the Win32DiskImager.
  2. Now unzip the MotionPie ISO file so you can install it onto the Pi safely.
  3. Select the MotionPie ISO file and the drive letter your SD card is assigned (Eg. I:/)
  4. Confirm you have the correct details and click on Write.
  5. Once done you can safely remove your SD card from the computer.

Booting/Setting up MotionPie

Now we’re ready for boot up, so insert the SD Card, an Ethernet cord and the power cord. We will need to communicate to the Pi over the network rather than directly like I have done in most of the previous tutorials.

read more

Install OpenCV 3.0 for both Python 2.7+ and Python 3+ on your Raspberry Pi 2

Information source: http://www.pyimagesearch.com/2015/07/27/installing-opencv-3-0-for-both-python-2-7-and-python-3-on-your-raspberry-pi-2/

So if you’re interested in building awesome computer vision based projects like this, then follow along with me and we’ll have OpenCV 3.0 with Python bindings installed on your Raspberry Pi 2 in no time.

UPDATE: The tutorial you are reading now covers how to install OpenCV 3 with Python 2.7 and Python 3 bindings on Raspbian Wheezy. This tutorial works perfectly, but if you are looking to install OpenCV 2.4 on Raspbian Wheezy or OpenCV 3 on Raspbian Jessie, please see these tutorials:

read more

Python Motion Detection Program on Raspberry Pi


Raspberry Pi can connect to a camera to capture picture and video. As an advance feature, it can be used as a CCTV to monitor the environment. For example, from official Raspberry Pi web site “https://www.raspberrypi.org/forums/viewtopic.php?t=45235″, there shows a simple and efficient motion detection script in Python using PIL.

While watching for motion it pipes a thumbnail image from raspistill at around 1fps to analyse (it keeps everything in memory to avoid wearing out the SD card). Once motion is detected it calls raspistill again to write a high-res jpeg to disk. It also checks free disk space and if under a set limit it starts to delete the oldest images to make sure there is always enough free space for new images. While running on my rev1 B it consumes around 12% CPU / 4% ram and manages to capture a full size image once ever 2-3 secs.

read more