Thursday 23 April 2015

Flashing Ubilinux (Debian)


Approach 3: Flash the Debian Ubilinux OS which comes with apt-get capability (This worked like a charm!)



Installing numpy and scipy are a piece of cake using apt-get install. However, the Yocto Linox Image does not come with this feature. There is a workaround to this that we have used to get numpy and scipy installed and running. 

Note: Installing Yocto linux allows you make Edison into an end product where you need a fast, stripped-down version of Linux. However, if you need additional features and a full-fledged package manager loading Debian Ubilinux is a better alternative. 

Important: You can potentially brick your Edison by following this tutorial. Be careful not to unplug your Edison for at least 2 minutes where it says so.

1. Install Ubilinux
We need to download the Ubilinux image, which we will install on the Edison, and some software depending on your current operating system.
IMPORTANT: Make sure the Edison is not powered or connected to your host computer at this time.

a) If you haven’t installed Intel’s Edison Drivers for Windows :

1. Click here.
2. Download the Windows Standalone Driver 1.2.1.

b)  Download dfu-util for Windows.

1. Download the Ubilinux image by navigating to http://www.emutexlabs.com/ubilinux      and click on “ubilinux for Edison.”
2. Extract the ubilinux-edison-XXXXXX.tar.gz.
3. Copy the “dfu-util.exe” which was downloaded into the toFlash folder in the  Ubilinux folder.
4. Scroll down the folder and double-click on “flashall.bat”.

c) A command window will open up and ask you to plug in your Edison.

This will begin your installtion. Read the WARNING below.

WARNING: Once the command prompt closes, you need to wait for at least two minutes for the installation to complete. The Edison should reset a couple of times to finalize its installation. Don’t try to disconnect Edison or do anything else for those 2 minutes. Else you risk bricking your Edison.
Your installation is now Complete!

Monday 20 April 2015

Getting Scipy Working on Edison


How to get scipy working on Intel Edison?

Since most Machine Learning algorithms tend to use numpy and scipy, these are some of the main libraries that we need to be able to install on Intel Edison.

Before delving into the solution that worked for us, we will go through all different ways we tried and what problems we encountered at each step.

Approach 1: Try installing scipy using pip


1. We tried installing scipy the same way we installed numpy - 

pip install scipy

However, this failed as it required BLAS(Atlas) and gfortran. 

2. So we tried installing BLAS using the following commands:

2. tar jxvf ./atlas3.10.2.tar.bz2
4. mkdir ./ATLAS/build
5. cd ./ATLAS/build
6. ../configure --prefix=/usr/local --with-netlib-lapack-tarfile=/home/root/lapack-3.5.0.tgz --nof77 -v 2
7. make build
8. make install

However, even after 15 hours the installation didn’t complete. In case it completes for you, you can also try installing gfortran similarly. 

3. To install gfortran:

1. opkg install libgmp-dev libmpfr-dev libmpc-dev
2. wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-4.9.1/gcc-4.9.1.tar.bz2
3. tar jxvf ./gcc-4.9.1.tar.bz2
4. mkdir ./gcc-4.9.1/build
5. cd ./gcc-4.9.1/build
6. ../configure --prefix=/usr/local --enable-languages=c,c++,fortran --with-fpmath=sse
7. make
8. make install
However, many forum posts show that this also may not succeed because, more than 4GB disk space was required to build gfortran.
However, if you are successful in installing both you should now be able to run pip install scipy.

Approach 2: Try installing scipy using Miniconda


You can follow the process as shown in the following link -


However, we were unsucessful in getting scipy installed using this method.

Approach 3: Use a hack with Debian (Ubilinux) image instead of Yocto Linux. (This works!)


Refer to the next few blog posts to get familiarized with Ubilinux. 

Getting Numpy on Intel Edison


How to get Numpy working on Intel Edison ?

Since most Machine Learning algorithms tend to use numpy and scipy, these are some of the main libraries that we need to be able to install on Intel Edison.

Before installing numpy, the following  libraries and paclages need to be installed- 
1. Install setup-tools

1. wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py
2. python ez_setup.py --insecure

2. Install pip

sudo easy_install pip

3. Install numpy

pip install numpy

Note: numpy package takes a long time to install. So be patient. 
This works even with the Ubilinux image.

Saturday 21 March 2015

How to transfer files to and from Edison ?

3. Transferring files to and from Intel Edison

You can't have two machines being the 'master' of the same partition at the same time, so you need to switch the owner. The g_multi driver allows the remote PC to become the master, and cannot allow the Edison to also be writing to the disk at the same time.

You first need to mount the contents of the Edison Drive on your Windows to a local directory in Edison.

Type in the following commands to do the above-

  1. rmmod g_multi
  2. mkdir /update
  3. losetup -o 8192 /dev/loop0 /dev/disk/by-partlabel/update
  4. mount /dev/loop0 /update

You can now see the contents of the Edison drive in /update. Since it is writable, you can also put files in there.

To reverse this, and make it available on your host machine:
  1. cd /
  2. umount /update
  3. modprobe g_multi

Then pull the usb cable and re-insert it, at which stage the disk should re-appear on your host machine.


How can we flash a new image ?


2.     Flashing a new image on Intel Edison

You may buy a Edison with a certain image pre-installed and later find out that a new image has been released. In this case, you may want to upgrade to the new image. The following steps are to be followed in order to do so in Windows

You first need to delete the existing image.

  1. Open a Command Prompt Window
  2. Type the drive letter of Edison(For example E:, in case Edison is on E: Drive) and Press Enter
  3. Type in del * and press Enter.
  4. You will be prompted to say “Yes” to continue performing the delete action. Type y and press Enter.
  5. All Files should now be removed. Type in dir to check that all the files have been deleted.

You can now download the latest image and flash it to Edison.

  1. Download the latest image.zip file from here - choose the "Edison Yocto complete image".
  2. Unzip the contents and move these files into the Edison drive - *note – copy and replace any conflict files*
  3. Your Edison Drive should now look like this –
image

  1. Open Device Manager By clicking Start and typing Device Manager
  2. Scroll down to “Ports (COM & LPT)” and take note of the COM number listed under “USB Serial Port (COM#)”. 
  3. Open PuTTy.
  4. Putty will launch the session screen.
  5. Check the Serial radio button under Connection type.
  6. Enter the COM port number that was assigned to your board under Serial Line.
  7. Set the Speed (Baud-rate) to 115200.
  8. Click Open to start your puTTy session.
  9. Press Enter twice to see the login prompt.
  10. Type in root and press Enter – *note, if you have previously configured Edison, use root and your password credentials that you configured*
  11. Type in reboot ota and press Enter (*warning* this will erase everything on your Edison including configuration settings)
  12. Your Edison will reboot and begin the flashing process with the latest image
  13. When Edison is done flashing, you should see this screen – IMAGE
  14. Note, since you have just flashed the image on Edison, any previous configuration settings (name, password, WiFi networks) will need to be configured again.

Connecting to Edison using Windows

1.     Connecting to Edison using Windows

Make sure that your Edison drive (E:) is detected. Else check if the power and data cables are connected tightly and the Edison Board is power on.

If the LED on the board, blinks on and off, it means that there is a loose connection either with the cables or the Edison Platform has not been fitted properly onto the Edison Board.


Install Driver

Before you connect to windows, you need to download the USB-serial driver namely the FTDI driver.

1. You can download it here

2. Run the executable as an administrator.

3. You should see a new USB Serial Port under the “Ports (COM&LPT)” section of the Device Manager. Keep in mind the COM port number as it will be required while making a PuTTy connection.

IMAGE


Install and set up puTTy

PuTTy is required to communicate serially with the Edison platform over the computer’s serial line.

1. You can download puTTy from here
2. Double-click the installed file to run puTTy.
3. Putty will launch the session screen.
4. Check the Serial radio button under Connection type.
5. Enter the COM port number that was assigned to your board under Serial Line.
6. Set the Speed (Baud-rate) to 115200.
7. Click Open to start your puTTy session.
8. Press Enter twice to see the login prompt.
9. In case this is your first login, enter root for the login prompt and leave the password prompt empty.
10. If you have reset password using pwreset, you can login with the newly set password.
11. Type in "configure_edison --help" command, then press Enter. IF you see the following screen:



Congratulations, you are now successfully connected to the Edison.


12. If you see "configure_edison: not found", you will
need to update the firmware of the board to continue. Instructions to update
the firmware are found here

Introducing Intel Edison

Intel Edison Platform

A Brief Intro of Intel Edison

The Intel Edison platform is a solution designed to lower the barriers to entry for quick prototyping and productizing the connected computing devices driving the next industrial revolution.

What makes Intel Edison unique ?

Small, powerful, and adaptable hardware

• High performance, dual-core CPU and single core micro-controller supports complex data collection in a low power package.
• Integrated Wi-Fi, Bluetooth Low-Energy* (LE), memory, and storage simplifies configuration and increases scalability.
• 40 multiplexed GPIO interfaces with expansion board options for total project design and flexibility.

Software compatibility

• The Intel® IoT Developer Kit for Intel® Edison development platform adds C, C++, Python, and JavaScript support for developing connected sensor Internet of Things applications.
• Supports a variety of integrated development environments such as Arduino*, Eclipse*, Wyliodrin*, and Intel® XDK.

Supportive environment

• Managed online community for project ideas and engagement with other product users.
• Intel product-expert support and open source community software tools.
• Access to device-to-device and device-to-cloud connectivity framework to enable cross device communication and a cloud based, multi-tenant, time-series analytics service.

Key technical features

At the center of the Intel® Edison board is an Intel® Atom™ 22nm SoC with a dual-core CPU at 500Mhz and a MCU at 100Mhz. This allows the product to collect and preprocess data via the MCU in a low power state and hand the filtered data off to the CPU for analytics. The Intel® Edison board includes 1GB of memory, 4GB of storage and dual-band Wi-Fi and Bluetooth* 4.0 for communications. It supports 40 GPIOs with multiple configuration options.