Skip to content

Instantly share code, notes, and snippets.

@fooqri
Last active August 29, 2015 14:26
Show Gist options
  • Save fooqri/8ada61811a060b55da14 to your computer and use it in GitHub Desktop.
Save fooqri/8ada61811a060b55da14 to your computer and use it in GitHub Desktop.

Intel Edison Setup

Flash Edison with latest Image (Linux)

  • Plug both micro USB cables from Edison Dev board into linux pc, no power wall wart needed

in terminal (ttyUSB0 is example, could be ttyUSB1, etc based on usb port used.)

  • open a terminal and type sudo screen /dev/ttyUSB0 115200
  • reset edison using reset button
  • keep hitting a key until stop boot at a boot prompt
  • type run do_flash
  • now start flashing in a second terminal

in a second Linux terminal

  • go to directory with the latest edison image
  • make sure flashall.sh is execuatable (sudo chmod 777 flashall.sh)
  • type sudo ./flashall.sh
  • you will be prompted to reset the device - so press reset button
  • you will see the flash start in terminal 1

all should be flashed!

Setup the Edison

Start with a newly flashed edison

Turned on bluetooth BLE mode

  1. Stop the bluetoothd daemon: systemctl stop bluetooth
  2. Change the Bluetooth* system service file (/etc/systemd/system/bluetooth.target.wants/bluetooth.service) Add the –d option: ExecStart=/usr/lib/bluez5/bluetooth/bluetoothd –d
  3. Restart the Bluetooth* service: systemctl start bluetooth

Update MMRA

 echo "src mraa-upm http://iotdk.intel.com/repos/1.1/intelgalactic" > /etc/opkg/mraa-upm.conf
 opkg update
 opkg install libmraa0

Install bluetooth modules

 opkg update
 opkg install bluez5-dev

Install desired npm modules

 npm install -g async
 npm install noble       
 npm install bleno
 npm install sensortag cylon cylon-intel-iot cylon-gpio cylon-i2c cylon-ble node-uuid uri-beacon 

Setup Bluetooth startup service

Setup Bluetooth startup script Create a script (/home/root/btup.sh) with the following three lines.

 #!/bin/sh
 rfkill unblock bluetooth
 hciconfig hci0 up

Make /home/root/btup.sh script executable

 chmod +x /home/root/btup.sh

Create a new service file (/lib/systemd/system/btup.service) with following text.

[Unit]
 Description=BTUP
 After=bluetooth.target
 Before=systemd-user-sessions.service
 [Service]
 Type=simple
 RemainAfterExit=true
 ExecStart=/home/root/btup.sh
 Environment="HOME=/home/root"
 WorkingDirectory=/home/root/
 [Install]
 WantedBy=multi-user.target

Enable the service

systemctl enable /lib/systemd/system/btup.service

###Create codebox startup script

Create a /home/root codeboxup.sh file with the following 4 lines

 rfkill unblock bluetooth
 hciconfig hci0 up
 sleep 2
 nohup node /home/root/codebox/bin/codebox.js -p 8088 -u root:test1234 run /node_app_slot > codebox.log &

Make codeboxup.sh excutable

 chmod +x /home/root/btup.sh

Create a new codebox service file (/lib/systemd/system/codeboxup.service) with the following text.

[Unit]
 Description=BTUP
 [Service]
 Type=idle
 RemainAfterExit=true
 ExecStart=/home/root/codeboxup.sh
 Environment="HOME=/home/root"
 WorkingDirectory=/home/root/
 [Install]
 WantedBy=multi-user.target

Enable the service

systemctl enable /lib/systemd/system/codeboxup.service

Install VIM

wget ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2
tar -jxf vim-7.4.tar.bz2
cd vim74
make
make install

Install Git

edit /etc/opkg/base-feeds.conf (add 3 lines) by adding the lines

 src all     http://iotdk.intel.com/repos/1.1/iotdk/all
 src x86 http://iotdk.intel.com/repos/1.1/iotdk/x86
 src i586    http://iotdk.intel.com/repos/1.1/iotdk/i586

Update Package Manager

 opkg update

Install Git Package

 opkg install git

Change default web service running on port 8080

Edit edison configuration script (/usr/lib/edison_config_tools/edison-config-server.js)

change port numer on createServer

Change last line createServer to use port 8080

Installed CodeBox Editor

 git clone https://github.com/CodeboxIDE/codebox.git
 cd codebox
 npm install
 npm install gulp -g
 gulp build
 mkdir -p /home/root/.codebox/packages
 node ./bin/codebox.js -p PORT -u USERNAME:PASSWORD run WORKINGDIR

setup node_app_slot for gihub

Create a ssh key: (with your email address)

 ssh-keygen -t rsa -b 4096 -C "[email protected]"

Add keys to github repo under: settings-> deploy keys

With"add deploy key" add a key. Your public key should be found in /home/root/.ssh/id_rsa.pub on he edison from creatin in earlier step.

Clone your nodejs project repo into the edison /node_app_slot directory so it will automatically start on reboot.

 cd /
 git clone {repolink.git} node_app_slot

Pull updates to edison (to get latest verion at any time)

 cd /node_app_slot
 git pull origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment