Leave a comment  →
' . get_the_title() . '

This is awesome. The only thing I miss is the LAN interface but at $5 its still amazing. It has Broadcom BCM2835 processor and that also 40% faster than the pi 1 with 512 MB of Ram.

Today, I’m pleased to be able to announce the immediate availability of Raspberry Pi Zero, made in Wales and priced at just $5. Zero is a full-fledged member of the Raspberry Pi family, featuring:

  • A Broadcom BCM2835 application processor
    • 1GHz ARM11 core (40% faster than Raspberry Pi 1)
  • 512MB of LPDDR2 SDRAM
  • A micro-SD card slot
  • A mini-HDMI socket for 1080p60 video output
  • Micro-USB sockets for data and power
  • An unpopulated 40-pin GPIO header
    • Identical pinout to Model A+/B+/2B
  • An unpopulated composite video header
  • Our smallest ever form factor, at 65mm x 30mm x 5mm

Raspberry Pi Zero runs Raspbian and all your favourite applications, including Scratch, Minecraft and Sonic Pi.

RaspberryPi BLOG

DIY Bluetooth Speaker!

Leave a comment  →

After weeks of waiting, the parts I needed for a homemade Bluetooth speaker arrived. Pictured above are the PAM8403 amplifier board, Bluetooth module (USB powered with a 3.5mm audio jack), and a couple of 3-watt speakers. The power supply is a 5V 2A power supply I had laying around. All of the project materials amounts […]


Leave a comment  →

There are some android devices that have an ethernet (LAN) port for example Android STB, Android powered door-phone monitors, etc. The regular way of getting MAC address is as follows

WifiManager manager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiInfo info = manager.getConnectionInfo();
String address = info.getMacAddress();

Not to forget adding the following permission in the AndroidManifest.xml 

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

The above method will give us the MAC address of WiFi. Assuming your Ethernet interface is eth0, to get the MAC address of Ethernet port we have to try opening and reading the file /sys/class/net/eth0/address. This can be Implemented as below.

public static String loadFileAsString(String filePath) throws java.io.IOException{
    StringBuffer data = new StringBuffer(1000);
    BufferedReader reader = new BufferedReader(new FileReader(filePath));
    char[] buf = new char[1024];
    int numRead=0;
    while((numRead=reader.read(buf)) != -1){
        String readData = String.valueOf(buf, 0, numRead);
    return data.toString();

public String getMacAddress(){
    try {
        return loadFileAsString("/sys/class/net/eth0/address")
                .toUpperCase().substring(0, 17);
    } catch (IOException e) {
        return null;

Leave a comment  →

Here I am sharing a header file called easyavr.h. This is a pretty basic header file with some helper functions related to input output pins of AVR

#ifndef __EASYAVR_H_
#define __EASYAVR_H_

//  Sets pin of port to 1
//  Example for PD2: PIN_ON(PORTD, 2)
#define PIN_ON(port,pin) ((port) |= (1 << (pin)))

//  Sets pin of port to 0
//  Example for PD2: PIN_OFF(PORTD, 2)
#define PIN_OFF(port,pin) ((port) &= ~(1 << (pin)))

//  Sets pin of port to value
//  Example for PD2: PIN_SET(PORTD, 2, 1)
#define PIN_SET(port,pin,val) (((val) > 0) ? PIN_ON((port),(pin)) : PIN_OFF((port),(pin)))

//  Sets all of port pins to OUTPUT mode
#define PORT_AS_OUTPUT(port) ((port) = 0xFF)

//  Sets all of port pins to INPUT mode
#define PORT_AS_INPUT(port) ((port) = 0x00)

//  Sets pin of port to OUTPUT mode
//  Example for PD1: PORT_AS_OUTPUT(DDRD, 1)
#define PIN_AS_OUTPUT(ddr,pin) ((ddr) |= (1 << (pin)))

//  Sets pin of port to INPUT mode
//  Example for PD1: PORT_AS_INPUT(DDRD, 1)
#define PIN_AS_INPUT(ddr,pin) ((ddr) &= ~(1 << (pin)))

//  Checks pin's value of port
//  Returns 1 or 0
//  Example for PD2: CHECK_PIN(PIND, 2)
#define CHECK_PIN(pinreg,pin) (((pinreg) & (1 << (pin))) != 0)


   by Dost Muhammad Shah    2 Comments  →

We can validate a base64 encoded string using a nice regex (regular expression). The following regex can be used with any programming language. I would use php for the example. The regex is as follows.


Which will also detect the usage of = or == at the end of the string (and only end).

A function geared specifically toward this:

<?phpfunction is_base64_encoded()
     if (preg_match('%^[a-zA-Z0-9/+]*={0,2}$%', $data)) {
           return TRUE;
     else {
             return FALSE;
 is_base64_encoded("iash21iawhdj98UH3"); // true
 is_base64_encoded("#iu3498r"); // false
 is_base64_encoded("asiudfh9w=8uihf"); // false
 is_base64_encoded("a398UIhnj43f/1!+sadfh3w84hduihhjw=="); // false