Skip to main content

Posts

Raspberry Pi Bluetooth Connection

Raspberry Pi 3 provides built-in bluetooh module. Latest Raspbian has been bundled with tools for enabling bluetooth connection. Bluetooth icon will be showed up on 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 make a connection especially for bluetooth device which has no standarized services.

From terminal, we can use bluetoothctl tool to scan and connect with a bluetooth device. You should make sure that BlueZ protocol stack has been installed by running $ apt-get install bluez
Run bluetoothctl to enter the tool command windowTurn 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 pairedRun scan on if your desired device has not paired yet.Run agent o…
Recent posts

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 PHP program through a web server application (Apache/Nginx). The PHP program need to run other scripts stored in the same machine.


Sample Problem
PHP program is located in /var/www/html/index.phpPython program is located in /var/www/html/capture.pyPython 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 external program returns an output. So, we shouldn't run excessive amount of external program. Clients will wait too long on their browser.
If our application actually need many external programs to be run, we can make external pr…

Take Ace 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 download i…

The Tale of Jiraiya

Jiraiya is one of most favorite character in Naruto.

Kakashi Killed Rin

Kakashi is a scumbag. He killed Rin, let Obito died for saving his life, let Sasuke left from Konoha, but finally he became Hokage. Rubbish is not extraordinary thing.

Trailer
Kakashi Killed Rin

Important Records for Mail Domain Name

When you have a domain, for example yourdomain.com, you can create your email address at that domain name like yourname@yourdomain.com. Several domain name records which I consider to be important for mail domain are:

1. MX Record
Of course, it assigns a domain where the mail exchange server is located. For example:

NamePriorityTypeDatayourdomain.com10MXmx.yourdomain.com
2. SPF Record
SPF is a spam and phishing scam fighting method which uses DNS SPF-records to define which hosts are permitted to send e-mails for a domain. See http://www.openspf.org. For example:

NameTypeDatayourdomain.comTXT"v=spf1 mx mx:yourdomain.com -all"
This configuration means emails sent from all servers defined in MX record of yourdomain.com are permitted by sender organization

3. DKIM Record
DKIM allows an organization to take responsibility for a message in a way that can be verified by a recipient. DKIM defines a domain-level digital signature authentication framework for email through the use of pu…

Installing APCu in PHP 7

APCu is one of caching application for PHP. In this case, I use PHP 7.0 on Ubuntu 16.04. In PHP 7.0, this application is provided via PEAR.

First, install PEAR.

$ sudo apt-get install php-pear
Install APCu. If an error occured state that there's no phpize, you need to install PHP 7.0-dev which provide phpize support.

$ sudo apt-get install php7.0-dev $ sudo pecl install apcu
Create APCu module configuration in PHP modules directory.

$ sudo echo "extension = apcu.so" >> /etc/php/7.0/mods-available/apcu.ini
Add that configuration to PHP FPM and CLI.

$ sudo ln -s /etc/php/7.0/mods-available/apcu.ini /etc/php/7.0/fpm/conf.d/30-apcu.ini $ sudo ln -s /etc/php/7.0/mods-available/apcu.ini /etc/php/7.0/cli/conf.d/30-apcu.ini
Restart PHP FPM.


Uchiha Madara

End of Madara

ESP-01 Flashing Circuit

ESP-01 board is different with NodeMCU DevKit (ESP-12E) board. It doesn't have USB support. You need a USB to TTL serial converter and certain circuit to switch the board between normal boot and flashing mode. You can buy a USB to TTL converter as cheap as $1 or you can utilize your current Arduino board.

First, I want to show my simple circuit using USB to TTL converter to flash ESP-01. I use Prolific USB to TTL. It's cheapest device you can get in the market. If you use this device on Windows operating system, you must check Device Manager and validate that the device isn't in error state. If it's error, you can use solution from HERE.

This following image shows the circuit for flashing ESP-01 using USB to TTL converter. I use external 3.3V supply because my Prolific can provide only 5V supply from USB and the current is too low.


If you are too lazy with push button and resistor you can use this following circuit.


In the second circuit you just need jumpers without …