Skip to main content

Posts

Showing posts from 2018

Raspberry Pi Bluetooth Connection

Raspberry Pi 3 provides a built-in Bluetooth module. The latest Raspbian has been bundled with tools for enabling Bluetooth connection. The Bluetooth icon will be shown up on the top right corner of the desktop. It's a tool to discover available Bluetooth devices and connect Pi with Bluetooth devices. It is easy to connect any Bluetooth-enabled electronic device with Pi. But, sometimes Pi will fail to connect, especially for Bluetooth device that has no standardized services. From a terminal, we can use the  bluetoothctl tool to scan and connect with a Bluetooth device. You should make sure that the BlueZ protocol stack has been installed by running $ apt-get install bluez Run bluetoothctl to enter the tool command window Turn the power on by running power on (Optional) You can set AutoEnable=true in /etc/bluetooth/main.conf if you want to make the Bluetooth auto power-on after reboot. Run devices to see which devices have been paired Run scan on if your desired d

Run Python Scripts Using PHP in a Linux Environment

How to run python or other scripts using PHP or other popular web programming languages in a Linux environment? Problem We want to access the PHP program through a web server application (Apache/Nginx). The PHP program needs to run other scripts stored in the same machine. Sample Problem PHP program is located in /var/www/html/index.php Python program is located in /var/www/html/capture.py Python program will access Pi Camera, capture an image, and store it in /var/www/html/assets/photo.jpg Solution index.php should access and run capture.py script. The script is as follows: $output = shell_exec("python /var/www/html/capture.py"); Execution of external program using shell_exec() or exec() will block the program. The next line of PHP codes will be run after the external program returns an output. So, we shouldn't run an excessive amount of external programs. Clients will wait too long on their browser. If our application actually needs ma

Take Me Away

Notes of Raspberry Pi

Currently, there are several models of Raspberry Pi i.e. A/B, A+/B+, 2, 3 and zero. The differences are on their provided interfaces, RAM size, processor model, processing power, AV jack, etc. Pi 3 uses Broadcom BCM2837 SoC with 64-bit support. Unlike earlier models, Pi 3 has built in wireless support, including 2.4GHz Wi-Fi and bluetooth. There is a Display Serial Interface (DSI) port near GPIO port. There is also Camera Serial Interface (CSI) near HDMI port which provides a high-speed connection to the Raspberry Pi Camera Module. The Pi 3 can draw up up to 1.2A so we need power adapter that can provide 2A of current. Warning : When handling the Pi, always avoid touching GPIO pins, and never connect anything to them while Pi is switched on. GPIO port is powerful but fragile. Software Raspberry Pi Fondation supplies a software tool known as NOOBS (New Out-Of Box Software) which helps user to install standard operating system for Raspberry Pi like Raspbian and others. We can