Quantcast
Channel: vox populi vox dei
Viewing all articles
Browse latest Browse all 67

Internet of things - Rasberry Pi2

$
0
0

Install the Windows 10 IoT Core tools


What you need

  1. A PC running Windows 10 
  2. Raspberry Pi 2
  3. 5V micro USB power supply - with at least 1.0A current. If you plan on using several power-hungry USB peripherals, use a higher current power supply instead (>2.0A)
  4. 8GB micro SD card - class 10 or better. (Microsoft suggest this one or this one)
  5. HDMI cable and monitor
  6. Ethernet cable
  7. Micro SD card reader (Due to an issue with most internal SD card readers, Microsoft suggest an external USB card reader like this one or this one)
  1. Download the ISO for the Raspberry Pi 2 from the Microsoft Download Center.
  2. Save the ISO to a local folder
  3. Double click on the ISO (IoT Core RPi.iso). It will automatically mount itself as a virtual drive so you can access the contents.
  4. Install Windows_10_IoT_Core_RPi2.msi. When installation is complete, flash.ffu will be located at C:\Program Files (x86)\Microsoft IoT\FFU\RaspberryPi2
  5. Eject the Virtual CD when done

Put the Windows 10 IoT Core Insider Preview image on your SD card

  1. Insert a micro SD card into your SD card reader.
  2. Use IoTCoreImageHelper.exe to flash the SD card. Search for “WindowsIoT” from start menu and select the shortcut “WindowsIoTImageHelper”
  1. The tool will enumerate devices as shown. Select the SD card you want to flash and then provide the location of the ffu and flash the image.
  2. Click on the Safely Remove Hardware icon in your task tray and select your USB SD card reader to safely remove it from the system. Failing to do this can cause corruption of the image.
    NOTE: If you want to remove Windows 10 IoT Core from your SD card after you are done using it, see the FAQ section titled How do I remove Windows 10 IoT Core from my SD card?.
    NOTE: IoTCoreImageHelper.exe is the recommended tool to flash the SD card. However, instructions are available for using DISM command line tool directly

Hook up your board

  1. Insert the micro SD card you prepared (the slot is on the opposite side of the board shown below).
  2. Connect a network cable from your local network to the Ethernet port on the board. Make sure your development PC is on the same network.
    NOTE: If you don’t have a local wired network, see here for additional connection options.
  3. Connect an HDMI monitor to the HDMI port on the board.
  4. Connect the power supply to the micro USB port on the board.

Boot Windows 10 IoT Core

  1. Windows 10 IoT Core will boot automatically after connecting power the supply. This will take a few minutes.
  2. Once the device has booted, the DefaultApp will launch and display the IP address of RPi2.
  3. Follow the PowerShell documentation here to use PowerShell to connect to your running device. You can also follow the instructions here to use SSH to connect to your device.
  4. It is highly recommended that you update the default password for the Administrator account. To do this, issue the following commands in your PowerShell connection:
    Replace [new password] with a strong password:
     net user Administrator [new password]
    Once this is done, you’ll need to re-establish the current session using enable-psSession with the new credentials.

Install the Rasbian 20XX-XX-XX-raspbian-wheezy.img or Ubuntu Mate image Windows


  1. Download the IMG for the Raspberry Pi 2 from raspberrypi.org or from https://ubuntu-mate.org/raspberry-pi/ for Ubuntu Mate.  For Ubuntu mate mouse over on one of the country icon and use wget if you want to download inside a Window shell
eg: wget http://can.ubuntu-mate.net/raspberry-pi/ubuntu-mate-15.04-desktop-armhf-raspberry-pi-2.img.bz2

Put the Image on your SD card


Using the Win32DiskImager program

1.   Download the distribution from the raspberrypi.org downloads page or from a mirror or torrent. Make sure the distribution is for the Raspberry Pi, as others will not work. Usually these are zipped (compressed) files ending in .zip or .gz (something like "distribution-name.zip").
2.   Extract the image file from the downloaded .zip file, so you now have "distribution-name.img".
3.   Insert the SD card into your SD card reader and check what drive letter it was assigned. You can easily see the drive letter (for example G:) by looking in the left column of Windows Explorer. You can use the SD Card slot (if you have one) or a cheap Adapter in a USB slot.
4.   Download the Win32DiskImager utility (it is also a zip file). You can run this from a USB drive.


5.   Extract the executable from the zip file and run the Win32DiskImager utility; you may need to run the utility as Administrator! Right-click on the file, and select 'Run as Administrator'
6.   Select the image file you extracted above.
7.   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! If you are using an SD Card slot in your computer (if you have one) and can't see the drive in the Win32DiskImager window, try using a cheap Adapter in a USB slot.
8.   Click Write and wait for the write to complete.
9.   Exit the imager and eject the SD card.
10. You are now ready to plug the card into your Raspberry Pi

Raspbian


if you plan to use an apple keyboard (the white one) connect the Mouse directly on the Pi which now has 4 external USB! Sweet! Else the keyboard won't be recognize

User management in Raspbian is done on the command line. The default user is pi with the password raspberry. You can add users and change each user's password.

CHANGE YOUR PASSWORD

When logged in as the pi user you can change your password with the passwd command.

Enter passwd on the command line and hit Enter. You'll be prompted to enter your current password to authenticate, and then asked for a new password. Hit Enter on completion and you'll be asked to confirm it. Note that no characters will be displayed while entering your password. Once you've correctly confirmed, you'll be shown a success message (passwd: password updated successfully) and the new password will be in effect immediately.

If your user has sudo permissions, you can change another user's password with passwd proceeded by the user's username, e.g. sudo passwd bob will allow you to set the user bob's password, and then some additional optional values for the user such as their name. Just hit Enter to skip each of these options.

Keyboard

sudo dpkg-reconfigure keyboard-configuration

Reload the keymap

invoke-rc.d keyboard-setup start





AlaMode works on the Pi 2


ICoutesy Element 14
the new Pi 2 is quite snappy, even the web browser is quite useable. It should be a marvelous platform for your IOT projects! Especially with AlaMode.
It has the same form factor as the B+ so you have to plug the AlaMode’s shorter GPIO connector into one end of the header, and the board overlaps the connector end of the Pi by a few millimeters. I recommend putting some electrical tape over the metal cans of the connectors to keep from shorting AlaMode’s headers.
Because the Pi 2 has a new processor, the GPIO base addressed changed, which makes us update our patched version of avrdude. (needed because standard Arduinos use serial ports handshaking to toggle the reset line, we use a GPIO pin)
Get the new setup here:
wget https://github.com/wyolum/alamode/blob/master/bundles/alamode-setup.tar.gz?raw=true
tar -xvzf alamode-setup.tar.gz
cd alamode-setup
sudo ./setup
Note if you haven’t already, you’ll need a new version of Raspbian that supports the Pi2, plus installing Arduino 
pi@raspberrypi ~ $ sudo apt-get update
pi@raspberrypi ~ $ sudo apt-get install arduino
before running the setup above.

      Ubuntu Mate


Re-size file system

There are no utilities included for automatic file system re-sizing. However, it's not hard to do manually. Once booted:
$sudo fdisk /dev/mmcblk0
Delete the second partition (d, 2), then re-create it using the defaults (n, p, 2, enter, enter), then write and exit (w). Reboot the system, then:
$sudo resize2fs /dev/mmcblk0p2
$ sudo parted /dev/mmcblk0p2
(parted) print
In my case using a 16GB sdcard
Model: Unknown (unknown)
Disk: /dev/mmcblk0p2: 15.9 GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk FLags:
Number Start End Size File systen Flags
1      0.00B 15.9GB   ext4
(parted) quit
$pi@pi-desktop:~$

Hardware accelerated video

To play videos using hardware accelerated decoding you will need MPEG-2 and/or VC-1 licenses from the Raspberry Pi Store. You can then use omxplayer, which uses the Raspberry Pi VideoCore libraries, to provide hardware accelerated video playback.

Redirecting audio output

You can select which audio device omxplayer should output audio to.
For HDMI
omxplayer -o hdmi video.mp4
For 3.5mm audio jack
omxplayer -o local video.mp4
The sound will output to HDMI by default if both HDMI and the 3.5mm audio jack are connected. You can, however, force the system to output to a particular device using amixer.
For HDMI
sudo amixer cset numid=3 2
For 3.5mm audio jack
sudo amixer cset numid=3 1
 

Wifi dongle

I purchased Netis WF2120 worked out of the box!! 

Apple Wireless Keyboard and Apple Magic Mouse

 
I managed to get an "Apple Wireless Keyboard" and "Apple Magic Mouse"
working. The is a lot of crap out there on how to do it. This is what
worked here (blueman did NOT work).
The advantage of doing it this way is that the keyboard and mouse are available without X.
Here they work at boot.

By BLE USB dongle : Cirago BTA8000 worked out of the box!!

Get root
sudo -i

apt-get install bluetooth bluez-tools
Wait a long time....

check bluetooth status:
/etc/init.d/bluetooth status

You may need to start bluetooth, if its not running:
/etc/init.d/bluetooth start

hciconfig -a
You should see a line with "UP RUNNING PSCAN" probably on hci0

If its down you it may come up with:
hciconfig hci0 up

Once hci0 is up, find the address of the device you want to pair:
hcitool scan
and copy the bluetooth address to use in the following commands

pair the keyboard (here an old apple wireless keyboard):
bluez-simple-agent hci0 68:D9:3C:ED:47:15

it will prompt you for a pin, enter a 4 digit number for the keyboard, then type in on the keyboard and press enter on it.
For the mouse try 0000 or 1234. If you need to pair
again you may get and error. If so append repair after the and the old
pairing is deleted.


You want your Pi to remember that your keyboard’s paired with it so it will connect to that keyboard when it boots. You can tell your Pi to trust your keyboard with the bluez-test-device command.trust the device:
bluez-test-device trusted yes

and connect it:
bluez-test-input connect


Once you’ve got your Apple keyboard paired, trusted, and conneted, you can unplug your USB keyboard and reboot your Pi. If your Pi doesn’t immediately pick up your Apple keyboard on boot, you can prompt it to connect my pressing any key. The LED will flash once, and then you can type normally.repeat the pairing, trusting, connects for each device. I have only tested this with input
devices (eg keyboard and mouse).

 

Viewing all articles
Browse latest Browse all 67

Trending Articles