Skip navigation
2015
Jeffery Moss

I am a New Member

Posted by Jeffery Moss Mar 30, 2015

Interested in several applications; integrate the system into my home security system; Inside and Outside cameras; Color and Night UV. Connect to Smart Phones... Application to Locate and Price Items in stores such as; Walmart, Home Depot, Lowes, Sears, Albertsons, Sam's Club, Cosco... and Many more applications... Just starting and don't know where to begin... I worked in a Chemical Laboratory for 44 years and I am now retired and on disability, due to spinal surgery, still have sciatica pain and Restless Leg Syndrome

Sorry if this is a dumb question but I am trying to find the schematics for the Pi 2?

 

Are they available?

 

Ta

Rod

couchie

Concept layout...

Posted by couchie Mar 29, 2015

Ok, so I've attempted to do a layout/flowchart of the project I'm working on. I've printed it in PDF format hoping to make it more visible.

 

I don't know if this clears up my though process or not, but...

 

I'm thinking, use the Arduino to scan the RFID, pass the data to the RPi which will then transmit the data to the SQL DB on a centralized server. The server sends back which team the player is on to  the RPi. The RPi then tells the Arduino which color to illuminate the LED's at the room's door. The player's can join different teams in each game, therefore the centralized DB will keep track of all that.

 

Make sense? And am I overthinking/working this? Do I need to use both the Arduino AND RPi or can this be accomplished with just one of these devices.... and if so, which one?

How amazing the things you can do with RPi2!

 

 

EDIT: Sorry I forgot to say the video was made by the guys of Possibly Unsafe

pi2.jpg

 

In this blog post, I’m going to use a new Raspberry Pi 2 with Node.JS with Sock.JS and Angular.JS to create a chat page. We’ll start from the basics with a simple “Hello World” web page and slowly build upon that to create a powerful chat page.

 

Installing Node.JS

The package of Node.JS that you will get if you run “apt-get install nodejs” is fairly out of date. So, in order to get something more recent, I built the latest from source.  In order to do that, navigate over to:

 

http://nodejs.org/dist/latest/

 

That will have the latest version of Node.JS.  What you are really looking for is the latest version number.  In my case it is v0.12.0.  Once you have that, you can download the source code by doing:

Once that is downloaded, unzip it and build it with the following commands:

After that is complete, we can test and make sure that Node.js is installed and working by having it print out the version number:

 

node –version

 

That should return 0.12.0.

NodeVersion.png

Hello World – Node.JS Style

Now that we have all of the necessary software, let’s start out with the simplest Node.JS program:

The first line loads the module that lets us create an HTTP server.  The second line defines the port that we are going to be listening on.  In this case we are setting it to 1337.

 

The next line creates the HTTP server.  The function that we pass into the createServer method will be called every time someone navigates to our HTTP server.  In this case, all we want to do is to write back a simple response.  The simple response comes in two parts: the header and the body.  In the header we specify two things: a status code (200) and a content-type (text/plain). The status code of 200 means that everything went well.  The content type just tells the client that we are sending over plain text.  For the body of the response, we are just going to give it the string “Hello World\n”. (In case you were wandering, the “\n” is just a code for a new line – much like hitting enter.)

 

With the last line of the program, we start up the HTTP server and have it listen on the port that we already set up.

 

Now to test the program, copy the code into a text file called helloWorld.js and run it by doing:

 

node helloWorld.js

 

This should be pretty uneventful.  It should start up the program, but it will appear as though nothing is happening:

CommandLine.png

In order to see the real excitement, open up a browser and point it to:

 

127.0.0.1:1337

 

The 127.0.0.1 is an IP address.  It happens to be a special one that points to the computer that you are currently using. The 1337 is the port that we typed into the program earlier.  When you navigate there, you should see something like this:

HelloWorld.png

As a side note, you can also view it from another computer.  Just change the IP address to point to the IP address of your Raspberry Pi:

HelloWorld2.png

Hello World – Web Page

Now we weren't really sending back a web page in the previous example.  We were just sending back a phrase and the browser was kind enough to show it to us.  If you view the source for the web page (in chrome – right click and select ‘View page source’), you’ll see that there really isn’t much there:

ViewSource.png

So, now let’s upgrade this so that it returns a real web page, and not just some text.

 

To help turn this into a website, we need to install a Node.JS package called Express.JS.  To do this, just execute the following command:

 

npm install express

 

Once Express.JS is installed, create a file called helloWebsite.js and put the following code in there:

This code is fairly similar to the first version.  We are still importing and using the HTTP module on the first line.  With the second line, we import the Express.JS module. On the third line, we create a new express application, and then set how it responds with lines 4 - 6.  So, when the user asks for our base page (‘/’) we will respond with the ‘helloWebsite.html’ file.

 

The last two lines just define the port that we are going to run on and starts up the http server.

 

Finally, we need to create the helloWebsite.html file that we are going to return:

This creates a fairly simple web page that just displays “Hello Website” to the user.  Here’s what the website looks like now:

HelloWebsite.png

And if we view the source again, we’ll see that this time it is the same information that we put in helloWebsite.html

HelloWebsiteSource.png

Sock.JS + Angular.JS

Now, let’s step it up one more notch.  Let’s get the hello message from a WebSocket.  To do this, we need to install the Sock.JS module:

 

npm install sockjs

 

Once that completes, create a file called helloWebsocket.js and put the following code in there:

Hopefully by now the code is starting to look familiar.  The first three lines just import some modules that we are going to use.  The next block of code sets up the Express.JS application.  This is very similar to the previous example, except this time we add an additional file (client.js).  This is the code that is going to run on the client’s machine to receive the message that we send.

 

The next block of code sets up the WebSocket using Sock.JS.  The first line creates a new WebSocket server.  The next three lines define what happens when a new connection is established. In this case, all we do is respond back with the text “Hello WebSockets!”.

 

The last block of code sets up the HTTP server with the Express.JS application and the Sock.JS WebSocket server.  Most of this is the same as the last time.  Now we just make sure to install the WebSocket server handler.  Here we set it up to response to the ‘/message’ relative path, so the full location would be ‘http://192.168.1.8:1337/message’.

 

Next we’ll create the webpage that will display the message to the user.  Copy and paste this into a file called hello.html:

At first glance, this website looks very similar to the one before.  It’s got basically the same structure, but this time we include some javascript code with the <script> tag.  This is very similar to the “require” statements that we saw before on the server.  It is a way to reference javascript libraries.

 

The next thing that jumps out is the {{message}} part in the body of the webpage.  This is Angular.JS’s way of saying: put whatever is in the message variable here.  So, now we aren’t hard coding the message that will be displayed to the user.  We are going to get that from the server over a WebSocket connection.

 

The last differences are a little more subtle.  There are two new attributes: ng-app and ng-controller.  These tell Angular.JS where to find the code that is associated with this web page.  Angular.JS is built for large websites with lots of javascript, so these help organize and isolate the code that backs the website.

 

Finally, we’ll write the code that is going to be executed on the client’s machine.  Copy and paste this into a file called client.js:

This code starts out with the Angular.JS attributes that we just saw in the web page.  The first line creates an Angular.JS application called myApp. The empty square brackets near the end of the line indicate that this application doesn’t have any dependencies. (Another way that Angular.JS helps manage the large amounts of code that back modern websites.)

 

The next line defines a controller.  A controller contains the interaction for a piece of a website.  The next line tells specifies what variables we want passed to us. In this case, we want the $scope variable which contains information about the current scope within the controller.

 

The next line defines a function that contains the logic for our controller and takes as an input the $scope variable that we said that we wanted earlier.  (It might seem like we are repeating ourselves here a bit, and well we are.  However, this is for good reason.  Most websites use minification for their javascript code.  When this happens, all of the variable names are changed to single letters, so our $scope function parameter will be renamed.  When this happens, Angular.JS will have no way of knowing what we want.  Since strings do not get minified, ‘$scope’ will not change.  This is what Angular.JS will use to figure out what variable you want to get passed in.)

 

Inside our controller logic function, the first thing that we do is create a WebSocket connection to the server.  We pass it in the full address of the WebSocket server.  Then we define what should happen when a new message is received. In this case we want to update the message variable (within the current $scope) to the data that is sent from the server.  The $scope.$apply function tells Angular.JS that one of the variables that it is concerned with is changing and that it should update the web page accordingly.

 

Here is what the web page looks like now:

HelloWebsocket.png

Chat

Now that we have played with all of the important pieces and gotten a feel for how they work, let’s leverage their power to create a chat web page.  It will be a simple page that just broadcasts all of the messages that are posted to all of the people participating in the conversation.

 

Let’s start with the server code; copy and paste this into a file called chatServer.js:

The vast majority of the code should look very familiar from the previous examples.  The only part that is new and different is the code that is related to the WebSocket.  The first addition is a method called broadcast that sends a given message to all of the clients that are currently connected.  The code for this method should be fairly self-explanatory.

 

Handling the WebSocket connections is also fairly straight forward.  When a new person connects, we add them to the clients object.  When a new messages is sent, we broadcast that message to all currently connected clients.  Finally, when a person leaves (closes the connection), we delete them from the clients object.

 

Next let’s look at the HTML code; copy and paste this into a file called client.html:

Ok, so the <head> part of the page just includes a bunch of libraries that we are going to be using.  The new one is ng-dialog.  We are going to use this to pop a dialog box up to the user when they first navigate to the page in order to get their user name.  The page is going to look like this:

dialog.png

Looking at the <body> of the HTML, there are three distinct sections: sending a message, displaying messages, and getting the user name.

 

The first section contains a <form> that is used to get the message that the user would like to send.  The first thing specified is the method that will be called (sendMessage) when the user submits the form.  This allows the user to press enter and submit the current message.  Wiring this up is done by the Angular attribute ng-submit. The first <input> is a text box where the user can type in a message to send.  We use the ng-model attribute to tell Angular what variable to write the text within the text box to, so that we can access it in javascript. The second <input> is a button to click to send the message.  This is the same thing as pressing enter within the text box.  Notice that we call the same method (sendMessage) in both cases.

 

The next section displays the messages that have been received.  Angular has a lot of power in this respect.  We can use the ng-repeat attribute to display everything that is in a list.  In this case, we want to display every message within the messages object.  The “track by $index” part is in case a duplicate message is sent.  By default Angular suppresses duplicates, so this part just forces the duplicates to be displayed.

 

The final section is the dialog that will be displayed to the client in order to get their user name. If you look at the <form> inside, it should look very similar to the previous <form> that got the message to be sent.

 

The last part is the client side javascript; copy and paste this into a file called client.js:

The basic structure of this file should look familiar after the previous examples.  This time, when we receive a new message (sock.onmessage), we first parse the JSON object that is sent to us.  The JSON object will look like this:

So, the object is fairly simple.  In order to go from text to a Javascript object, we use the JSON.parse method. Once it is an object, we can add (push) the content of that message on to the messages object.  If you remember, we saw that the messages object was used in the HTML code to display all of the messages in the web page.

 

The next section deals with getting the username from the client.  A dialog box is created with the template that we specified in the HTML code earlier.  We also create a separate Angular controller just for this dialog box.  The controller is fairly simple in that it just defines the method selectUserName.  When this method is called, it saves off the username that was typed in and it closes the dialog.

 

The last section defines a method called sendMessage that handles sending the message to the server.  First we check to make sure that there really is a message.  (Make sure that the user didn’t click the send button without typing in a message.)  If there is a message, then we package it up into a Javascript object.  This object has the format that we saw earlier when we were parsing the message that we received from the server.  Once we have created this object (msg), we then turn it into a string using JSON.stringify (the opposite of the JSON.parse) and send it over the WebSocket to the server.  Last but not least, we clear the message in the input text box.

 

Here’s a quick video of the chat application in action:

Conclusion

In this blog post, we create a chat web page using Node.JS, Express.JS, Sock.JS and Angular.JS.  We were able to combine these extremely powerful frameworks together to create a chat web page very quickly.  We just brushed the surface of the capabilities of these libraries but hopefully this was a nice easy introduction into what they can offer.

lmntorras

Raspberry Pi 2 Unboxing

Posted by lmntorras Mar 23, 2015

Hey, so when i got my Raspberry Pi 2 (courtesy of Element14), i decided to make a stop-motion video of the unboxing, hope you like the video

                                

                        

 

I have a model b+ , which i was very happy about it and has i saw the announcement of the Raspberry Pi 2 i wanted to get one! The features are great!!! (i made a small list of features in the end of the video )

 

I had my expectations very high with the Rpi2 , as it is a big update comparing with the b+ , i love how the Raspberry Pi foundation makes every new board backwards compatible, in comparison with the B+ the Rpi2 is more fluid and performs much better, as soon as i got it i notice a big difference in booting time. For a 35$/40$ it's a very nice deal, the 40 pin GPIO allows you to do many electronics projects , or you can use it as a media player, or as server or as a normal pc(Can the Raspberry Pi 2 Replace your Desktop Computer?)... The possibilities are endless...

 

I'm currently using it as a media player and i will integrated it in a project that i'm currently doing but when the time comes i'll post here the project!

 

Thanks to Element14

 

Luís Torrão

icade.png


Hey guys I have been having great fun with my Raspberry Pi 2 with RetroPie installed to make a mini arcade machine. I started this project with no prior knowledge of the Raspberry Pi and very little Linux experience.

 

If anyone is interested in retro gaming please check out my very detailed step by step build log from a complete noob with all the links and videos you could need on my blog

"MAN CAVE MODDER" Man Cave Modder: Build A Cheap Arcade Cabinet With A Raspberry Pi 2 & RetroPie

Thanks

 

Keith

Intro

In this blog post I will comment a bit on how I installed OpenELEC and Raspbian on the Raspberry Pi (2) using my ArchLinux based distro.

I also performed some benchmarks and measured some start/boot times.

 

Installation

Short intro on installation

It's really easy and fast to install these distros from scratch on any Linux OS (when you download the image). Alternatively you can also use NOOBS to install distros on the Raspberry Pi.

Advantage over using NOOBS: you can perform the installation offline (so without internet access) and the installation is faster, the disadvantage is that when you break your setup you might have to re-install.

NOOBS can be the best and easiest solution for some people. Personally I do not use NOOBS because the installation takes longer and the boot afterwards is also a few seconds slower beause of the added NOOBS menu.

I do recommend to read the info on the following link: NOOBS Setup | Raspberry Pi.

 

Downloading images

I've used OpenELEC (media center) and Raspbian. You can download these distros via the openelec.tv and raspberrypi.org websites. At the time I wanted to install the OpenELEC distro on my RPi2B, it had to be downloaded via the OpenELEC website (It wasn't available on the Raspberry Pi downloads page, or at least I did not see it immediately).

Dowloading OpenELEC

There are 2 images, one for the Pi version 1 and one for the Pi version 2 (make sure you download the correct one)!

OpenELEC-RPi.arm-5.0.6.img.gz / OpenELEC-RPi2.arm-5.0.6.img.gz

http://releases.openelec.tv/OpenELEC-RPi.arm-5.0.6.img.gz?mirrorlist

http://releases.openelec.tv/OpenELEC-RPi2.arm-5.0.6.img.gz?mirrorlist

Dowloading Raspbian

The Raspbian image works with both RPiB and RPi2B: http://downloads.raspberrypi.org/raspbian_latest

 

Find your (micro)SD device (really important step!):

Depending on your (micro)SD card reader, your drive might pop up as /dev/sdx or /dev/mmc*.

Check your dmesg | tail output right after your memory card is plugged in to your reader.

My internal card reader pops up in dmesg like:

[ 1952.245099] mmc0: new SDHC card at address 2320

[ 1952.249365] mmcblk0: mmc0:2320 SD08G 7.42 GiB

[ 1952.250439]  mmcblk0: p1

My USB memory card reader as:

[ 2084.797255] scsi7 : usb-storage 1-4:1.0

[ 2085.800321] scsi 7:0:0:0: Direct-Access     Generic- SD/MMC           1.00 PQ: 0 ANSI: 0 CCS

[ 2085.822107] sd 7:0:0:0: Attached scsi generic sg2 type 0

[ 2086.723674] sd 7:0:0:0: [sdc] 15556608 512-byte logical blocks: (7.96 GB/7.41 GiB)

[ 2086.724157] sd 7:0:0:0: [sdc] Write Protect is off

[ 2086.724167] sd 7:0:0:0: [sdc] Mode Sense: 03 00 00 00

[ 2086.724584] sd 7:0:0:0: [sdc] No Caching mode page found

[ 2086.724590] sd 7:0:0:0: [sdc] Assuming drive cache: write through

[ 2086.727604]  sdc: sdc1

[ 2086.729003] sd 7:0:0:0: [sdc] Attached SCSI removable disk

 

Additionally you can use parted to check how large your device is (if you have a SD card with 8GB inserted in your card reader you should see a size of more or less 8000MB)

 

parted /dev/mmcblk0 print

Model: SD SB08G (sd/mmc)

Disk /dev/mmcblk0: 7743MB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

 

If you see a size of 120GB then it will probably your harddisk (so do NOT use this!)

parted /dev/sda print

Model: ATA WDC WD1200JB-00D (scsi)

Disk /dev/sda: 120GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Disk Flags:

 

Number  Start   End     Size    Type      File system  Flags

1      32.3kB  12.6GB  12.6GB  primary   ntfs         boot

2      12.6GB  120GB   107GB   extended               lba

5      12.6GB  120GB   107GB   logical

 

So our card reader is at /dev/mmcblk0, 1 additional point to pay attention to: write to the sd device, not a partition on the device. /dev/mmcblk0p1 will indicate the first partition while /dev/mmcblk0 will indicate the device

 

Unpacking/Copying image to the SD card

In total I prepared 2 SD cards and 2 microSD cards.
Unpacking is done with gunzip (extension .gz) while copying the image can be done with dd or dcfldd.

(By default gunzip will remove the packed file and only leave the unpacked file.)

The dcfldd tool does exactly the same as dd, but in addition it also shows the progress.

Before using dd or dcfldd, make sure the device mentioned in "of=" is your (micro)SD card because you will lose all data on that device.

(bs is size to be read/writte at a time, if is the input file/device, of is the output file/device)

 

1) SD card 1

gunzip OpenELEC-RPi.arm-5.0.6.img.gz

dcfldd bs=1m if=OpenELEC-RPi.arm-5.0.6.img of=/dev/mmcblk0

2) microSD card 1

gunzip OpenELEC-RPi2.arm-5.0.6.img.gz

dcfldd bs=1m if=OpenELEC-RPi2.arm-5.0.6.img of=/dev/mmcblk0

3) SD card 2 and microSD card 2

gunzip 2015-02-16-raspbian-wheezy.img.gz

dcfldd bs=1m if=2015-02-16-raspbian-wheezy.img of=/dev/mmcblk0

The last command was used twice, since the same image can be used for both Raspberry Pi versions.

 

After the dd or dcfldd command is finished, you only need to plug the (micro)SD in your Raspberry Pi and boot it.

Most likely the file system will get expanded to the size of your SD card and you will be asked some questions on how to setup your system.

Depending on the distribution your Pi may restart 1 or more times.

 

Benchmarks

Default configuration is used unless otherwise specified.

Some overclocking was used, this was done by modifying the arm_freq=xxx parameter in the /boot/config.txt file.

I've not used overclocking before and there are also a lot of other parameters that I did not try (yet).

The reason why I tried to overclock is because I got a question from clem57 on my previous blog post.

 

Boot/Start times

Boot Test UntilRaspberryRaspberry Pi 2 B
1a Raspbian Login Prompt34s18.5s
1b Raspbian xinit11s5.5s
2 Raspbian Desktop44s23.5s
2 Raspbian Desktop (overclocked)43s (800MHz)23s (1000MHz)
3 OpenELEC (background)31s21s

4 OpenELEC (CEC connected)

35s24s

 

During the test a TV (with CEC support), keyboard, mouse and LAN cable were connected.

I modified the config of OpenELEC to use a mysql server (mysql is running on a pc in the network which hosts the Kodi/XBMC library) and changed some mappings of my TV remote.

On both the Raspberry Pi versions, the exact same config was used.


vi /storage/.kodi/userdata/advancedsettings.xml

<advancedsettings>
    <network>
        <disableipv6>true</disableipv6>
    </network>
      <videodatabase>
         <type>mysql</type>
        <host>192.168.0.40</host>
          <port>3306</port>
        <user>xbmc</user>
        <pass>somefancypassword</pass>
    </videodatabase> 
     <videolibrary>
          <importwatchedstate>true</importwatchedstate>
       </videolibrary>
</advancedsettings>






 

vi /storage/.kodi/userdata/keymaps/remote.xml

<keymap>
    <global>
        <remote>
              <skipminus>back</skipminus>
            <skipplus>ContextMenu</skipplus>
            <stop>XBMC.ActivateWindow(Home)</stop>
        </remote>
    </global>
  <home>
    <remote>
        <skipminus>XBMC.ActivateWindow(VideoLibrary,TvShowTitles)</skipminus>
        <skipplus>XBMC.ActivateWindow(VideoLibrary,addons://sources/video/)</skipplus>
          <reverse>XBMC.ActivateWindow(VideoLibrary,MovieTitles)</reverse>
    </remote>
  </home>
<FullScreenVideo>
    <remote>
        <pause>pause</pause>
          <stop>stop</stop>
        <skipminus>Info</skipminus>
        <skipplus>audiotoggledigital</skipplus>
        <reverse>aspectratio</reverse>
        <forward>VolumeUp</forward>
      </remote>
</FullScreenVideo>
</keymap>







To improve the boot times a bit more you can also edit the config.txt (in /boot or /flash, depends on the distro you're using) and add the following lines at the bottom:

disable_splash=1

boot_delay=0

Raspbian:

sudo vi /boot/config.txt

OpenELEC (In OpenELEC you need to remount the partition mounted on /flash as read/write. You do not need sudo because you're already the root user by default.):

mount -o remount,rw /flash

vi /flash/config.txt



Sysbench

I installed sysbench to run some CPU tests on the Raspberry Pis.

The command to install it:

sudo apt-get install sysbench

 

CPU

The command to start the CPU test with x threads is the following:

sysbench --test=cpu --cpu-max-prime=20000 --num-threads=x run

DeviceClock (in MHz)ThreadsExecution time (in seconds) : manual testExecution time (in seconds) : scriptCPU temp right after test (script only)
Raspberry Pi B70011334.62071332.243856.8'C
Raspberry Pi B7002-1336.483456.2'C
Raspberry Pi B80011166.66671163.122457.3'C
Raspberry Pi B80021171.2851 (*)
1166.393257.3'C
Raspberry Pi 2 B9001779.9761779.926149.2'C
Raspberry Pi 2 B9004196.2276-
Raspberry Pi 2 B9005-195.927456.8'C
Raspberry Pi 2 B10001707.0518701.849550.8'C
Raspberry Pi 2 B10004176.4975-
Raspberry Pi 2 B10005176.2414176.695960.0'C

(The lower the time, the better it is, because it means it can do the CPU test faster.)

(*) I'm not sure why this test with 2 threads is almost 5 seconds slower on the Raspberry Pi B compared to the test with 1 thread (I did read out the CPU temp while the test was busy, which I did not do during the other tests).


Memory

Memory transfer test of 2048MB

DeviceClock (in MHz)Transfer Speed (MB/s)Execution time (seconds)
Raspberry Pi B (1 threads) (*)700334.576.1213
Raspberry Pi B (2 threads)700335.876.0976
Raspberry Pi B (2 threads) (*)700333.886.1340
Raspberry Pi B (5 threads) (*)700334.006.1318

Raspberry Pi B (2 threads)

800335.376.1067
Raspberry Pi 2 B (5 threads)9001104.351.8545
Raspberry Pi 2 B (5 threads)10001183.481.7305

(*) Tests were executed manually afterwards. In general these tests seem to be worse compared to the previous tests executed during the script run.


Script

A script was written to execute some tests in bulk, the output is attachted to this blog (only the serial number was blanked out).

Below you can also find the script source. Feel free to (re-)use it.

#!/bin/bash
# v1.0 : 2015-03-21 : Johan Boeckx
DEBUG=0
TIME=1
THREADS=`cat /proc/cpuinfo | grep "processor.*:.*[0-9]" | wc -l`
THREADS=$((THREADS+1))
TIME=`date +%Y-%m-%d--%H-%M-%S`

seperator()
{
    local COLS=`tput cols`
    local IDX=0
    printf "\n"
    while [ ${IDX} -lt ${COLS} ] ; do
        printf "-"
        IDX=$((IDX+1))
    done
    printf "\n\n"
}

docmd()
{
echo "[CMD] $@"
echo
if [ ${DEBUG} -ne 0 ] ; then
    read -p "Run?" KEY
    if [[ $KEY == y* ]] ; then
        if [ ${TIME} -eq 0 ] ; then
            $@
        else
            time $@
            vcgencmd measure_temp
        fi
    fi
else
    if [ ${TIME} -eq 0 ] ; then
        $@
    else
        time $@
        vcgencmd measure_temp
    fi
fi
seperator
}

getInfo()
{
    TIME=0
    docmd cat /proc/cpuinfo
    docmd vcgencmd get_config arm_freq
    echo THREADS=${THREADS}
    TIME=1
}

doTests()
{
    getInfo
    docmd sysbench --test=threads --thread-locks=1 --max-time=20s --num-threads=${THREADS} run
    docmd sysbench --test=mutex --max-time=20s --num-threads=64 run
    docmd sysbench --test=memory --num-threads=${THREADS} --memory-block-size=1M --memory-total-size=512MB run
    docmd sysbench --test=memory --num-threads=${THREADS} --memory-block-size=1M --memory-total-size=1024MB run
    docmd sysbench --test=memory --num-threads=${THREADS} --memory-block-size=1M --memory-total-size=2048MB run
    docmd sysbench --test=memory --num-threads=${THREADS} --memory-block-size=1M --memory-total-size=4095MB run
    docmd sysbench --test=cpu --cpu-max-prime=20000 --num-threads=${THREADS} run
    docmd sysbench --test=cpu --cpu-max-prime=20000 run
}

doTests 2>&1 | tee res_sysbench_${TIME}.txt






Software Installation, Part I

 

Using NOOBS from Raspberry Pi

 

     For most people, this looks like the old and tried method. But with the new Raspberry Pi 2 Model B, there are problems out there. Lets take a look down memory lane and see what happens as we go down step by step.

 

(1)  Go to Downloads | Raspberry Pi. We see many options, but which one to choose? The very first thing to do is click on "More Info". Why not download? If you do what I suggest you will see which downloads work with Pi 2 and which do not.

     Checking  Raspbian first, we see

SHA-1: b71d7b61f44e9bd582df71c9be494c271c97650f

Pi Version supported: Pi 1 and 2

     But under OpenELEC, we see

SHA-1: 52beec8af6f61f05d484dba4e4b594eef2b7f4b8

Pi Version supported: Pi 1 only

     Checking NOOBS Lite (which I prefer since it will be smallest download)     Note: This one will need an Ethernet cable to your router!

SHA-1: e14053513795a386ac259f19408b94ffafa238d9

Pi Version supported: Pi 1 and 2

(2) For Windows users:

     Insert the SD card into your SD card reader and check which drive letter was assigned.

     You can easily see the drive letter (for example G:) by looking in the left column of Windows Explorer. Check that the partition is FAT and not NTFS.

     You can use the SD Card slot (if you have one) or a cheap SD adaptor in a USB port. Note: Not all SD card readers work, so mileage will vary.

(3) Download the Win32DiskImager utility from the Source forge Project page (it is also a zip file); you can run this from a USB drive if you wish.

(4) Extract the executable from the zip file to Desktop.

(5) Find file on Desktop. Right-click on the file, and select "Run as administrator". You may get a pop up warning you are about to run. This is normal so allow it.

Note: When there are chooses, pick the latest one especially with Pi 2. Anything before the release date of Feb 2, 2015 is bound not to work.

(6) Select the drive letter of the SD card in the device box. Be careful to select the correct drive; if you get the wrong one you can destroy your data on the computer's hard disk!

(7) Click Write and wait for the write to complete.

(8) Exit the Win32DiskImager utility and eject the SD card from Windows Explorer.

(9) Insert the SD card into micro SD slot in Raspberry Pi 2 near red light under the board. The 4 gold pins must be face up.

(10) With a keyboard/mouse in USB and the HDMI connected to TV or monitor, plug in micro USB into power source of at least 1 ampere current and 5 volts. I recommend this because it is safest for first time users. Computer USB 2.0 power is specified at 500 milliamperes. Newer computers may supply more, so check with the motherboard.

(11) After the initial multicoloured screen, a menu appears

Note: As of my last check, pick Rasbian especially with Pi 2. Many of the other chooses have not been updated and are bound not to work.

alt text

On first boot NOOBS will format your SD card and allow you to select which OSes you want to install from a list. This OS list is automatically generated from both locally available OSes (i.e. those contained in the /os directory on disk) or those available from our remote repository (wired network connection required).

Only the latest version of each OS will ever be displayed meaning that you can be sure that you have installed the most up-to-date release of your selected OS.

On any subsequent boot you can then press the SHIFT key to enter the NOOBS interface and easily reinstall your choice of OSes.

The NOOBS interface provides the following functionality:

  • Install: Installs the selected OSes onto your SD card. Changing this selection erases all OSes currently installed.
  • Edit Config: Opens a text editor allowing the cmdline and config for the selected installed OS to be edited.
  • Online Help: [Networking Required] Open a browser that displays the Raspberry Pi Forum ( http://www.raspberrypi.org/phpBB3/ ), allowing people to quickly access help and troubleshooting.
  • Exit: Quits NOOBS and reboots the Pi into the OS boot menu.
  • Language Selection: Allows you to select the language to be displayed.
  • Keyboard Layout Selection: Allows you to select the keyboard layout to be used.
  • Display Mode Selection: By default, NOOBS will output over HDMI at your display's preferred resolution, even if no HDMI display is connected. If you do not see any output on your HDMI display or are using the composite output, press 1, 2, 3 or 4 on your keyboard to select HDMI preferred mode, HDMI safe mode, composite PAL mode or composite NTSC mode respectively.

Note that all user settings (language, keyboard layout, display mode) will persist between reboots and will also be automatically passed to the installed OSes. This means that if you can see the NOOBS interface on your display device then you should be able to see the OS CLI/GUI when it boots too!

Source: https://github.com/raspberrypi/noobs

What if my screen is blank?

If your display remains blank, you should select the correct output mode for your display by pressing one of the following number keys on your keyboard:

1. HDMI mode - this is the default display mode.

2. HDMI safe mode - select this mode if you are using the HDMI connector and cannot see anything on screen when the Pi has booted.

3. Composite PAL mode - select  this mode if you are using the composite RCA video connector to a PAL TV.

4. Composite NTSC mode - select this mode if you are using the composite RCA video connector to a NTSC TV.

Rasbian and  Risc OS are Pi 2 ready. The others are not as of this blog date!

 

     Ok this is all for now, later I will present other options. Please let me know what you think and if this was helpful.

 

Thanks,

Clem

 

PS Please check out Raspberry Pi Model B+ 3.5mm Audio/Video Jack | Raspberry Pi Spy if you plan on using the composite video.

Last friday the Raspberry Pi 2 Model B 1024MB, a credit card sized single-board computer, arrived from Element14.

First a big thank you to Element14 for letting me RoadTest this product.

 

In this blog post I will share some unboxing pictures and my initial thoughts.

 

 

Unboxing

Box contents and pictures

The box contained 2 items:

 

  • The Raspberry Pi 2 (*)
  • Quick start guide & safety instruction manual

(*) In the pictures the anti static bag, in which the RPi2 came, was already removed

Unbox_1.jpg

Unbox_2.jpg

Unbox_3.jpg

 

Initial thoughts

 

Raspberry Pi B vs. Raspberry Pi 2

RPi2vsRPiB.jpg

Design Improvements

  • USB ports are not sticking out anymore
  • Composite video moved to 3,5mm jack
  • No in/output on all sides (RPiB : 3 sides, RPi2 : 2 sides)
  • No SD sticking out due to the replacement of SD with micro SD card

When you look at the design, improvements were made if you compare with the older Raspberry Pi B.

However these improvements were already introduced with the Raspberry Pi Model B plus (the form factor of a RPiB+ and RPi2 are the same).

 

Additional features

  • Extended GPIO to 40 pins
  • 2 extra USB ports

 

Enhancements (compared to both RPiB and RPiB+)

  • 900 MHz quad-core CPU (ARMv7) vs. 700MHz single core (ARMv6)
  • 1024MB of RAM vs. 512MB of RAM

More processing power was added by using a quad core CPU. Also because of the ARMv7 instruction set, it can run even more linux distributions (and a special Windows 10 verison).

 

Possible enhancements which are not (yet) present

  • On/Off, reset buttons
  • Gbit LAN
  • eMMC
  • SATA connector

There are actually a lot of things we can up with which are not present. But does the RPi2 need them to be better?

What I miss the most is an on/off switch, but the RPiB also did not have this. How did I solve this? I use a distribution plug with a separate switch.

And I connect an external HD to the RPi so I do not really need a SATA connector.

 

Getting started

 

Do we have everything we need to get started: yes and no.

If you buy the Raspberry Pi 2 keep in mind that the box does not contain everything you need to get started.

You at least need a micro sd card and a 5V micro USB power supply. A HDMI cable can also come in handy if you want to attach a display directly to the Pi.

I still have a 5V 2.1A and a 5V 1A power supply and I already prepared 2 micro sd cards, 1 with OpenELEC and 1 with Raspbian.

You might also considder buying a case.

 

Do you have questions and or comments? Do you want me to test something specific?

Let me know by posting a comment and/or sending a private message.

RetroPie-Game-Emulator.jpg

There have been many blog posts written about setting up a game emulator using the Raspberry Pi, however with the release of the Raspberry Pi 2 and its amazing speed I wanted to see just how much better game play is on the latest board. This quick run through shows how I created my system so I could play some of my favorite classic games and how I got around the minor issues I encountered. What you will need is the equipment listed below, a game emulator along with game files (ROMs). Please note that you are not legally allowed to create a ROM (Digital Copy) of a game unless you own a physical copy of the game. I have limited myself to games that I personally own a copy for my demos.


Equipment

83-16530        Raspberry Pi 2 Model B
83-16319        Raspberry Pi 2 Case
83-16536        Micro SD Card
28-17985        Power Supply
24-14785        HDMI Cable
83-16530        USB Mouse
83-14600        USB Keyboard
83-14647        HDMI equipped monitor or TV
831-3058        WiFi Dongle
USB Game Controllers
The equipment listed above has links to MCM Electronics which is an element 14 sister company and ships to North America. For other regions please see equivalent items on the element14 website

 

Setting It All Up

1. Download the RetroPie Image

- Download the RetroPie Project SD Card Image from the RetroPie Website (Use version 2.5 for a Raspberry Pi 2)
- Save the image to your computer hard drive

 

2. Install the RetroPie on the SD Card

- Download Win32DiskImager
- Select the RetroPie image file that you downloaded onto your computer hard drive and select the drive letter that your SD card is assigned (e.g. E:\)
- Confirm you have the correct details and click on Write

2015-03-06_1647.png

3. Booting up the Emulator

- Insert the micro SD Card into the PI and connect your mouse, keyboard, network cord, monitor and power supply (also game controller if you have one)
- The Pi will now boot up and into RetroPie

RetroPie.jpg

- Press f4 which will take you to command line

Command-Line.jpg

- Type sudo raspi-config

- Select Expand File system and accept until you’re back to the main screen

- Go to Advanced Options->SSH and enable it (Mine was already enabled)

- Go to overclock, select Medium

- Finally, select finish and then select yes to reboot

- Once you restart you will be taken to the main screen which will show your loaded emulators

Emulators.jpg

4. Adding ROMS to Your Raspberry Pi Emulator

- Connect your Pi to your home network and go to network in windows explorer
- In the list you should find a device called RaspberryPI, double click it
- Look for the ROMS folder, this is where you store your game files based on game emulator
- Make sure your ROMs are unzipped before you load them into the proper directories

 

5. Play Games!

 


Want another chance to win a Raspberry Pi 2 from the element14 Community?

 

16248420870_05843a8150_o_d.jpg

 

Through March 31 we are giving away Raspberry Pi 2 units to selected members who have earned a Plugged In badge.

 

Just take the following steps to enter the giveaway:

 

1) If you are not a registered member yet, register now.

 

2) Once you are a registered member, complete your Plugged In badge.

 

For a chance to win a Raspberry Pi 2, you have to complete the Plugged In badge by March 31st, 2015.

 

That's it! Once you join the element14 Community and earn your Plugged In badge your name will be entered into the giveaway. We will announce the winners after March 31st. (Be sure to use a working email address as well as your preferred shipping address when you register so we can contact you if you are selected. If you are already a registered Community member, please make sure your email and shipping details are current.)

 

Meanwhile, check out all of the latest Raspberry Pi 2 content:

 

Good luck from the element14 Community!

Terms and Conditions are attached.

Introduction

 

Well it took an extra day or two, due to the weather, to get the parts in that I ordered, but they are finally here.  I decided that the first project I would try was OpenElec because I already have my old Pi set up with it and it will give me a good comparison.

 

For those of you who haven't tried OpenElec, or aren't familiar with it, I highly recommend you give it a shot.  It is a distribution of Linux that is streamlined to run Kodi (formerly XBMC).  What's great about it is that it is extremely easy to set up and it works very well.  I mentioned in my last post about all the time and money I had spent trying to build a comparable setup in the past.  OpenElec is easier and runs better than any other setup I've had.  Here's a small list of the pros and cons, as I see them, of OpenElec on a Pi compared to a full home theater PC (HTPC) running Windows:

 

Pros:

  • Much easier to set up
  • Built in support for HDMI-CEC (You can use your regular TV remote to control Kodi without any extra hardware, like Lirc.)
  • Quiet (No fans = no noise)
  • Small profile (Zip tie it to the HDMI cable behind the TV if you want it completely hidden)
  • Lots of user created add-ons for Kodi for all sorts of services

Cons:

  • No Netflix (I have two other devices, a Wii U and a blu-ray player, plugged into the TV that provide Netflix ability if I need it anyways.)
  • Not as powerful processor-wise (The Pi, and especially the Pi 2, are very smooth running OpenElec, however.)
  • No automatic "on-the-fly" quality adjustments to prevent buffering (This can be annoying at times.)

 

Setup

 

So let's jump into getting this set up.  It's really simple.  First head on over to the OpenElec website and get the latest release from the download section.  Make sure you download the "Diskimage" file for your appropriate Pi.  I'm obviously using a Pi 2 and the current release is 5.0.5 so I downloaded OpenELEC-RPi2.arm-5.0.5.img.gz.  Follow the instructions here to get the image on your SD card.  I run Ubuntu and my SD card is at /dev/sdb so my install went like this:

cd ~/Downloads

gunzip -d OpenELEC-RPi2.arm-5.0.5.img.gz

sudo dd if=OpenELEC-RPi2.arm-5.0.5.img of=/dev/sdb bs=4M

sync

That's all.  Now we stick the card in the Pi and plug it into the TV.  I use an ethernet cable to connect it to my network.  On the first run it will expand the image to fill the SD card.  It will also run a few plugin updates and ask you a few questions.  The defaults are usually fine but I like to enable SSH and Samba now.  You can always go back and do this later in the settings if you change your mind.  As I mentioned, my Samsung TV supports HDMI-CEC so I don't need any extra remotes or hardware to control it.  Many new TVs support this but they don't market it as "HDMI-CEC".  From Wikipedia:

Trade names for CEC are Anynet+ (Samsung), Aquos Link (Sharp), BRAVIA Link and BRAVIA Sync (Sony), HDMI-CEC (Hitachi), E-link (AOC), Kuro Link (Pioneer), INlink (Insignia), CE-Link and Regza Link (Toshiba), RIHD (Remote Interactive over HDMI) (Onkyo), RuncoLink (Runco International), SimpLink (LG), T-Link (ITT), HDAVI Control, EZ-Sync, VIERA Link (Panasonic), EasyLink (Philips), and NetCommand for HDMI (Mitsubishi).

You may have this ability and didn't even know it.  This is by far my favorite thing about using the Pi as a media player.  The Kodi remote control app for the iPad is also awesome.  You can browse your files, and even add-ons, in the app and play them on your TV with ease.  A lot of times I won't even touch the TV remote.  I'll select a movie or show in the remote control app and the Pi will turn the TV on, select the correct source on the TV, and begin playing the video.  I was pleased to see that some of the other popular add-ons that I use are already available in this new release without having to add any repositories.  A few of my favorites are NHL Gamecenter (requires subscription), NBC Sports Live Extra, Revision3, TWiT, and YouTube.  To install these simply navigate to "Videos" and "Get more...".  Select the add-ons that you want and choose "Install".

 

My impressions

 

Having used the Raspberry Pi model B for a few years now I can feel a bit of a speed boost on the new Pi 2.  The main menus are comparable between the two but where the new Pi jumps ahead is the sub-menus inside the apps.  This is probably due to the fact that the Pi is doing some scraping or processing work to generate these sub-menus inside the apps that I'm using.  The faster processor handles this better.  Based on my small experience with the new Pi I would say this time is almost cut in half.  On the old model B it would take 5 seconds or so to load the sub-menus in NHL Gamecenter while now it's only taking around 2.  That might not seem like much but when you have to navigate down through a few sub-menus it starts to add up.

 

Video playback on both Pi models is great.  I can play 5000 kbit/s streams of my NHL Gamecenter games with no problems.  When I get my server set up in my new house I'll be able to add that as a source and play the files off of it too.  I also like the AirPlay feature.  I don't use it a lot because it can be hit or miss.  I think that is a WiFi issue though.  My setup used to have the Pi on a wireless bridge so streaming a YouTube video to the Pi took 3 times the wireless bandwidth.  (Once to get it from the router to the iPad, once from the iPad back to the router, and once from the router to the Pi.)  The Chromecast is smarter about this.  (It just passes the URL to the device and let's it get it on its own.)  I imagine if you were streaming from a wired device or a video that you have on your device already it would work well.  Streaming music from my iPad works well though.

 

I'm very satisfied with this new device.  I would say it's worth the purchase just for this purpose.  I would even recommend to someone using a model B for this already to upgrade to a Pi 2.  They would benefit from the increased performance AND have another spare Pi to re-purpose, maybe for a RetroPie install, for example.

{gallery} OpenElec on the new Pi

screenshot000.png

Main Menu

screenshot001.png

My Video Add-ons

screenshot002.png

NHL Gamecenter

screenshot003.png

YouTube

screenshot004.png

NBC Sports

screenshot005.png

Menu overlays on video without any performance hit

screenshot006.png

Some Music Add-ons

2015-03-01 17.24.37.png

iPad XBMC controller browsing Video Add-ons