I have begun to work with
Intel Edison
in order to adapt machines with limited or even none connectivity to the movement of
IoT
.
This tiny platform is already prepared to work with Python but, if you want to work with Python, you want to work with pip . Pip is an amazing package manager where we can find almost all python libraries that we are going to use. |
Getting Started
Firstly we connect two micro-usb cables to the mini breakout board and we run a Linux Terminal.
The easiest way to communicate to the board is through the Serial Port:
The easiest way to communicate to the board is through the Serial Port:
user@machine:~$ sudo screen /dev/ttyUSB0 115200
Press Enter and you’ll get a login prompt. Type
root
and no password is needed. Now you are connected to the Edison through the Serial port.
To activate the WiFi is very easy, type:
To activate the WiFi is very easy, type:
root@edison:~#
configure_edison --wifi
Wait for a few seconds, select your network and type your password.
Add Unofficial Repository
Intel Edison is powered by
Yocto
but pip is not in the official repositories, therefore we need to add the unofficial repositores.
We began getting the latest Intel® IoT Developer Kit libraries .
We began getting the latest Intel® IoT Developer Kit libraries .
root@edison:~#
echo "src intel-iotdk http://iotdk.intel.com/repo/1.1/intelgalactic" > /etc/opkg/intel-iotdk.conf
root@edison:~# opkg update
root@edison:~# opkg upgrade
root@edison:~# opkg update
root@edison:~# opkg upgrade
Open the vi and add the unofficial repositories:
root@edison:~#
vi /etc/opkg/base-feeds.conf
paste the following:
src/gz all http://repo.opkg.net/edison/repo/all
src/gz edison http://repo.opkg.net/edison/repo/edison
src/gz core2-32 http://repo.opkg.net/edison/repo/core2-32
close the file and update:
root@edison:~# opkg update
paste the following:
src/gz all http://repo.opkg.net/edison/repo/all
src/gz edison http://repo.opkg.net/edison/repo/edison
src/gz core2-32 http://repo.opkg.net/edison/repo/core2-32
close the file and update:
root@edison:~# opkg update
Install Pip
root@edison:~#
opkg install python-pip
After running the above command, everything seems to be fine. You already have your pip and you will be able to install everything that you want, for example
Flask
.
root@edison:~#
pip install flask
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
But we get an error. This error means that we do not have
setuptools.py
, so we try to install. If we try to use
wget
, the Edison will not be able to download because it can not download from https. Therefore, we could download to our PC and use
scp
to copy the library to the board.
root@edison:~#
scp user@machine:/home/user/Download/setuptools-12.2.tar.gz /home/root
root@edison:~# tar zxf setuptools-12.2.tar.gz
root@edison:~# python setuptools-12.2/ez_setup.py
root@edison:~# tar zxf setuptools-12.2.tar.gz
root@edison:~# python setuptools-12.2/ez_setup.py
Or use the insecure way (but faster and easier way):
root@edison:~#
wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py
root@edison:~# python ez_setup.py --insecure
root@edison:~# python ez_setup.py --insecure
After having installed setuptools.py we can install whatever we need:
root@edison:~#
pip install flask
...
Successfully installed flask
Cleaning up...
...
Successfully installed flask
Cleaning up...