<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Raspberry-Pi on Arshad Siddiqui</title><link>https://arshadhs.github.io/categories/raspberry-pi/</link><description>Recent content in Raspberry-Pi on Arshad Siddiqui</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 13 Nov 2018 20:45:00 +0000</lastBuildDate><atom:link href="https://arshadhs.github.io/categories/raspberry-pi/index.xml" rel="self" type="application/rss+xml"/><item><title>Bluetooth Speaker</title><link>https://arshadhs.github.io/docs/technology/bluetoothspeakerraspberrypi/</link><pubDate>Tue, 13 Nov 2018 20:45:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/technology/bluetoothspeakerraspberrypi/</guid><description>&lt;h1 id="raspberry-pi--connect-bluetooth-speaker">
 Raspberry Pi : Connect Bluetooth Speaker
 
 &lt;a class="anchor" href="#raspberry-pi--connect-bluetooth-speaker">#&lt;/a>
 
&lt;/h1>
&lt;p>Connecting Raspberry Pi to Mi Pocket Speaker 2&lt;/p>
&lt;pre tabindex="0">&lt;code class="language-pi@raspberrypi:~" data-lang="pi@raspberrypi:~">[bluetooth]# power on
Changing power on succeeded
[bluetooth]# agent on
Agent registered
[bluetooth]# scan on
Discovery started
[CHG] Controller B8:27:EB:79:F6:B7 Discovering: yes
[bluetooth]# default-agent
Default agent request successful
[CHG] Device 00:EC:0A:57:F2:65 LegacyPairing: yes
[bluetooth]# list
Controller B8:27:EB:79:F6:B7 raspberrypi [default]
[bluetooth]# devices
Device 5C:72:FE:B7:35:FD 5C-72-FE-B7-35-FD
Device 28:F0:76:0A:B9:7B 28-F0-76-0A-B9-7B
Device 00:EC:0A:57:F2:65 Redmi
[NEW] Device 74:A3:4A:15:DD:71 Mi Pocket Speaker 2
[bluetooth]# pair 74:A3:4A:15:DD:71
Attempting to pair with 74:A3:4A:15:DD:71
[CHG] Device 74:A3:4A:15:DD:71 Connected: yes
[CHG] Device 74:A3:4A:15:DD:71 UUIDs:
 00001108-0000-1000-8000-00805f9b34fb
 0000110b-0000-1000-8000-00805f9b34fb
 0000110c-0000-1000-8000-00805f9b34fb
 0000110e-0000-1000-8000-00805f9b34fb
 0000111e-0000-1000-8000-00805f9b34fb
[CHG] Device 74:A3:4A:15:DD:71 Paired: yes
Pairing successful
[CHG] Device 74:A3:4A:15:DD:71 Connected: no
[bluetooth]# info 74:A3:4A:15:DD:71
Device 74:A3:4A:15:DD:71
 Name: Mi Pocket Speaker 2
 Alias: Mi Pocket Speaker 2
 Class: 0x240404
 Icon: audio-card
 Paired: yes
 Trusted: no
 Blocked: no
 Connected: no
 LegacyPairing: yes
 UUID: Headset (00001108-0000-1000-8000-00805f9b34fb)
 UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
 UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
 UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
 UUID: Handsfree (0000111e-0000-1000-8000-00805f9b34fb)
[bluetooth]# trust 74:A3:4A:15:DD:71
[CHG] Device 74:A3:4A:15:DD:71 Trusted: yes
Changing 74:A3:4A:15:DD:71 trust succeeded
[bluetooth]# info 74:A3:4A:15:DD:71
Device 74:A3:4A:15:DD:71
 Name: Mi Pocket Speaker 2
 Alias: Mi Pocket Speaker 2
 Class: 0x240404
 Icon: audio-card
 Paired: yes
 Trusted: yes
 Blocked: no
 Connected: no
 LegacyPairing: yes
 UUID: Headset (00001108-0000-1000-8000-00805f9b34fb)
 UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
 UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
 UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
 UUID: Handsfree (0000111e-0000-1000-8000-00805f9b34fb)
[bluetooth]# quit

pi@raspberrypi:~ $ sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install pulseaudio -y
pi@raspberrypi:~ $ mkdir -p scripts
pi@raspberrypi:~ $ vim scripts/autopair
#!/bin/bash
bluetoothctl &amp;lt;&amp;lt; EOF
connect [enter your MAC add]
EOF
pi@raspberrypi:~ $ chmod +x !$
chmod +x scripts/autopair
pi@raspberrypi:~ $ sudo vim /boot/config.txt
#dtparam=audio=on
pi@raspberrypi:~ $ vim ~/scripts/on.py
#!/usr/bin/python
&lt;/code>&lt;/pre>&lt;h2 id="monitor-removal-of-bluetooth-reciever">
 Monitor removal of bluetooth reciever
 
 &lt;a class="anchor" href="#monitor-removal-of-bluetooth-reciever">#&lt;/a>
 
&lt;/h2>
&lt;pre tabindex="0">&lt;code class="language-import" data-lang="import">import sys
import subprocess
import time
def blue_it():
 status = subprocess.call(&amp;#39;ls /dev/input/event0 2&amp;gt;/dev/null&amp;#39;, shell=True)
 while status == 0:
 print(&amp;#34;Bluetooth UP&amp;#34;)
 print(status)
 time.sleep(15)
 status = subprocess.call(&amp;#39;ls /dev/input/event0 2&amp;gt;/dev/null&amp;#39;, shell=True)
 else:
 waiting()
def waiting():
 subprocess.call(&amp;#39;killall -9 pulseaudio&amp;#39;, shell=True)
 time.sleep(3)
 subprocess.call(&amp;#39;pulseaudio --start&amp;#39;, shell=True)
 time.sleep(2)
 status = subprocess.call(&amp;#39;ls /dev/input/event0 2&amp;gt;/dev/null&amp;#39;, shell=True)
 while status == 2:
 print(&amp;#34;Bluetooth DOWN&amp;#34;)
 print(status)
 subprocess.call(&amp;#39;~/scripts/autopair&amp;#39;, shell=True)
 time.sleep(15)
 status = subprocess.call(&amp;#39;ls /dev/input/event0 2&amp;gt;/dev/null&amp;#39;, shell=True)
 else:
 blue_it()
blue_it()
pi@raspberrypi:~ $chmod +x ~/scripts/on.py
pi@raspberrypi:~ $vim ~/.bashrc
pulseaudio --start
wait
~/python/on.py
&lt;/code>&lt;/pre>&lt;h3 id="reboot">
 Reboot
 
 &lt;a class="anchor" href="#reboot">#&lt;/a>
 
&lt;/h3>
&lt;p>If the connection fails, remove the device and pair-trust-connect&lt;/p></description></item><item><title>Dropbox</title><link>https://arshadhs.github.io/docs/technology/dropboxwithraspberrypi/</link><pubDate>Thu, 27 Oct 2016 23:45:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/technology/dropboxwithraspberrypi/</guid><description>&lt;h1 id="dropbox-with-raspberry-pi">
 Dropbox with Raspberry Pi
 
 &lt;a class="anchor" href="#dropbox-with-raspberry-pi">#&lt;/a>
 
&lt;/h1>
&lt;p>Act as root, since I wanted to run the script on startup as a service, so I must setup dropbox for &amp;lsquo;root&amp;rsquo; user rather than &amp;lsquo;pi&amp;rsquo; -&lt;/p>
&lt;pre tabindex="0">&lt;code>pi@raspberrypi:~ $ sudo -s
root@raspberrypi:/home/pi# cd /root/
&lt;/code>&lt;/pre>&lt;h3 id="get-the-script-and-link">
 Get the script and link
 
 &lt;a class="anchor" href="#get-the-script-and-link">#&lt;/a>
 
&lt;/h3>
&lt;pre tabindex="0">&lt;code>root@raspberrypi:~# git clone http://github.com/andreafabrizi/Dropbox-Uploader.git
Cloning into &amp;#39;Dropbox-Uploader&amp;#39;...

remote: Counting objects: 785, done.
remote: Total 785 (delta 0), reused 0 (delta 0), pack-reused 785
Receiving objects: 100% (785/785), 237.87 KiB | 0 bytes/s, done.
Resolving deltas: 100% (409/409), done.
Checking connectivity... done.
root@raspberrypi:~# cd Dropbox-Uploader/
root@raspberrypi:~/Dropbox-Uploader# ./dropbox_uploader.sh
&lt;/code>&lt;/pre>&lt;p>This is the first time you run this script, please follow the instructions:&lt;/p></description></item><item><title>SSH</title><link>https://arshadhs.github.io/docs/technology/sshwithraspberrypi/</link><pubDate>Sat, 08 Nov 2014 14:08:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/technology/sshwithraspberrypi/</guid><description>&lt;h1 id="ssh-login-to-raspberry-pi-without-password">
 SSH login to Raspberry Pi without password
 
 &lt;a class="anchor" href="#ssh-login-to-raspberry-pi-without-password">#&lt;/a>
 
&lt;/h1>
&lt;p>Execute following 3 commands from PC/Laptop from which you want to login to Raspberry Pi without password.&lt;/p>
&lt;pre tabindex="0">&lt;code>laptop:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/laptop/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/laptop/.ssh/id_rsa.
Your public key has been saved in /home/laptop/.ssh/id_rsa.pub.
The key fingerprint is:
6f:72:4e:e5:f3:81:d4:27:9d:27:06:f0:ce:f1:75:7d laptop
The key&amp;#39;s randomart image is:
+--[ RSA 2048]----+
| . |
| .|
| + A|
| o = o+|
| S = *.+|
| o + o +.|
| . = + . |
| * o . |
| . . |
+-----------------+

NUsing ssh create a directory ~/.ssh as user pi on Raspberry -

laptop:~$ ssh pi@192.168.1.68 mkdir -p .sshpi@192.168.1.68&amp;#39;s password:
&lt;/code>&lt;/pre>&lt;p>Append public key to pi@Raspberry:.ssh/authorized_keys and enter pi&amp;rsquo;s password one last time:&lt;/p></description></item><item><title>Bootup Script</title><link>https://arshadhs.github.io/docs/technology/bootupraspberrypi/</link><pubDate>Mon, 16 Dec 2013 22:45:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/technology/bootupraspberrypi/</guid><description>&lt;h1 id="bootup-script-setup">
 Bootup script Setup
 
 &lt;a class="anchor" href="#bootup-script-setup">#&lt;/a>
 
&lt;/h1>
&lt;p>Edit Python script, add as first line -&lt;/p>
&lt;pre tabindex="0">&lt;code>#!/usr/bin/python
&lt;/code>&lt;/pre>&lt;p>Change permissions -&lt;/p>
&lt;pre tabindex="0">&lt;code>chmod 755 raspiLapseCam.py
&lt;/code>&lt;/pre>&lt;p>That means you can execute it by typing &lt;code>raspiLapseCam.py&lt;/code> rather than &lt;code>python raspiLapseCam.py&lt;/code>&lt;/p>
&lt;p>Then we can use an /etc/init.d script to get it started when the system boots.&lt;/p>
&lt;p>Start by copying /etc/init.d/skeleton to /etc/init.d/timelapse -&lt;/p>
&lt;pre tabindex="0">&lt;code>cd /etc/init.d &amp;amp;&amp;amp; sudo cp skeleton timelapse
&lt;/code>&lt;/pre>&lt;p>edit /etc/init.d/timelapse, change lines 23 &amp;amp; 24 to refer to the command &amp;lsquo;/home/pi/raspiLapseCam.py&amp;rsquo; -&lt;/p>
&lt;pre tabindex="0">&lt;code>DESC=&amp;#34;Raspberry Pi TimeLapse&amp;#34;
DAEMON=/home/pi/raspiLapseCam.py
&lt;/code>&lt;/pre>&lt;p>Make it executable -&lt;/p></description></item><item><title>e-mail</title><link>https://arshadhs.github.io/docs/technology/emailwithraspberrypi/</link><pubDate>Mon, 16 Dec 2013 22:45:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/technology/emailwithraspberrypi/</guid><description>&lt;h1 id="e-mail-with-raspberry-pi">
 E-Mail with Raspberry Pi
 
 &lt;a class="anchor" href="#e-mail-with-raspberry-pi">#&lt;/a>
 
&lt;/h1>
&lt;p>A quick guide to setting up the E-Mail on Raspberry Pi.&lt;/p>
&lt;hr>
&lt;h2 id="using-ssmtp">
 Using SSMTP
 
 &lt;a class="anchor" href="#using-ssmtp">#&lt;/a>
 
&lt;/h2>
&lt;pre tabindex="0">&lt;code>pi@raspberrypi ~ $ sudo apt-get install ssmtp mailutils mpack
&lt;/code>&lt;/pre>&lt;p>Now edit the file /etc/ssmtp/ssmtp.conf as root and add the next lines. Please note that some of the lines already exist and may need to be changed. Others don&amp;rsquo;t exist yet and need to be added to the end of the file.&lt;/p></description></item><item><title>Surveillance</title><link>https://arshadhs.github.io/docs/technology/surveillanceraspberrypi/</link><pubDate>Mon, 16 Dec 2013 22:45:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/technology/surveillanceraspberrypi/</guid><description>&lt;h1 id="raspberry-pi-surveillance">
 Raspberry Pi Surveillance
 
 &lt;a class="anchor" href="#raspberry-pi-surveillance">#&lt;/a>
 
&lt;/h1>
&lt;p>One of the hobby projects:&lt;/p>
&lt;ul>
&lt;li>Keep on capturing pictures in a loop, compare current picture with last picture, if the difference in pixel is more than threshold, capture a high resolution image, save it to RAM disk (so that memory card is safe from frequent read write operations), rename the image using date and time; e-mail it with date in subject field.&lt;/li>
&lt;li>Run a cron job to delete temporary files older than 20 minutes.&lt;/li>
&lt;li>Run the script as service and use another to monitor the service, on failure restart the service.&lt;/li>
&lt;/ul>
&lt;h3 id="python-script-to-detect-motion">
 Python script to detect motion
 
 &lt;a class="anchor" href="#python-script-to-detect-motion">#&lt;/a>
 
&lt;/h3>
&lt;p>(To Do: add git link for the code here))&lt;/p></description></item><item><title>WiFi</title><link>https://arshadhs.github.io/docs/technology/wifionraspberrypi/</link><pubDate>Sat, 14 Dec 2013 22:47:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/technology/wifionraspberrypi/</guid><description>&lt;h1 id="wi-fi-set-up-for-raspberry-pi">
 Wi-Fi Set-up for Raspberry Pi
 
 &lt;a class="anchor" href="#wi-fi-set-up-for-raspberry-pi">#&lt;/a>
 
&lt;/h1>
&lt;p>Make sure your interface file and wpa_supplicant.conf look like the ones below -&lt;/p>
&lt;hr>
&lt;pre tabindex="0">&lt;code>pi@raspberrypi ~ $ sudo nano /etc/network/interfaces

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

pi@raspberrypi ~ $ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
ssid=&amp;#34;YOURSSID&amp;#34;
psk=&amp;#34;YOURPASSWORD&amp;#34;

# Protocol type can be: RSN (for WP2) and WPA (for WPA1)
proto=WPA

# Key management type can be: WPA-PSK or WPA-EAP (Pre-Shared or Enterprise)
key_mgmt=WPA-PSK

# Pairwise can be CCMP or TKIP (for WPA2 or WPA1)
pairwise=TKIP

#Authorization option should be OPEN for both WPA1/WPA2 (in less commonly used are SHARED and LEAP)
auth_alg=OPEN
}


pi@raspberrypi ~ $ sudo reboot
&lt;/code>&lt;/pre>&lt;p>To view all WiFi networks -&lt;/p></description></item><item><title>Camera</title><link>https://arshadhs.github.io/docs/technology/camerawithraspberrypi/</link><pubDate>Thu, 12 Dec 2013 22:51:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/technology/camerawithraspberrypi/</guid><description>Setting up and enabling the Raspberry Pi camera module along with useful imaging tools.</description></item><item><title>NFS</title><link>https://arshadhs.github.io/docs/technology/nfsonraspberrypi/</link><pubDate>Thu, 05 Sep 2013 22:43:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/technology/nfsonraspberrypi/</guid><description>How to turn your Raspberry Pi into a simple and effective network file server using Samba.</description></item><item><title>VNC</title><link>https://arshadhs.github.io/docs/technology/vnconraspberrypi/</link><pubDate>Thu, 22 Aug 2013 22:45:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/technology/vnconraspberrypi/</guid><description>A quick guide to installing and using VNC for remote access on Raspberry Pi.</description></item><item><title>Raspberry Pi</title><link>https://arshadhs.github.io/docs/technology/raspberrypisetup/</link><pubDate>Wed, 24 Jul 2013 10:55:52 +0100</pubDate><guid>https://arshadhs.github.io/docs/technology/raspberrypisetup/</guid><description>&lt;h2 id="raspberry-pi-setup">
 Raspberry Pi Setup
 
 &lt;a class="anchor" href="#raspberry-pi-setup">#&lt;/a>
 
&lt;/h2>
&lt;p>Steps I followed to set-up my raspberry Pi with Raspbian&lt;/p>
&lt;p>Also configure -&lt;/p>
&lt;ul>
&lt;li>XBMC (for playing videos)&lt;/li>
&lt;li>NFS (to access external hard drive from any device in the house)&lt;/li>
&lt;li>VNC viewer (to access the desktop from any device in the house)&lt;/li>
&lt;/ul>
&lt;h3 id="format-sd-card">
 Format SD Card
 
 &lt;a class="anchor" href="#format-sd-card">#&lt;/a>
 
&lt;/h3>
&lt;ul>
&lt;li>&lt;strong>Windows&lt;/strong>&lt;/li>
&lt;/ul>
&lt;ol>
&lt;li>Download &lt;a href="https://www.sdcard.org/downloads/formatter_4/">SD Formatter&lt;/a>&lt;/li>
&lt;li>Install SD Formatter and run the software&lt;/li>
&lt;li>Set &amp;ldquo;FORMAT SIZE ADJUSTMENT&amp;rdquo; to ON in the Options menu.&lt;/li>
&lt;li>Make sure you have selected the Drive your SD Card is inserted in&lt;/li>
&lt;li>Format the memory card&lt;/li>
&lt;/ol>
&lt;ul>
&lt;li>&lt;strong>Linux&lt;/strong>&lt;/li>
&lt;/ul>
&lt;ol>
&lt;li>Use gparted (or the command-line version parted if you prefer), if you don&amp;rsquo;t have it, install it as you usually would.&lt;/li>
&lt;li>Format the entire disk as FAT / FAT16 (make sure you select the correct disk)&lt;/li>
&lt;/ol>
&lt;h3 id="install-os">
 Install OS
 
 &lt;a class="anchor" href="#install-os">#&lt;/a>
 
&lt;/h3>
&lt;p>&lt;strong>NOOBS&lt;/strong>&lt;/p></description></item></channel></rss>