Edison-Scope

From wiki
Jump to: navigation, search

Edison-Scope

The Edison-Scope lets you run an USB based Oscilloscope/Logic Analyzer from an Intel Edison. The Oscilloscope is controlled via the browser on your smartphone, tablet, PC or MAC. The Intel Edison acted as the Wireless Access Point to the phone.

The Edison-Scope is similar to the PiMSO project on the client side, the server side is a complete rewrite using Node.js. The Node.js acted as a webserver and FCGI server thereby simplifying the WebMSO deployment at a slight lost of speed compared to the PiMSO implementation written in C. The client side html/css/javascript files are served as static files.

In this deployment, the Intel Edison will function as a wireless access point for smart devices to signed into. Once the device signed in to Edison, accessing the oscilloscope is as simple as opening up a web page from the browser.

There are two ways to configure the Edison WAP, stand alone or infracture. In this example we will configure the Edison-scope in the stand alone mode so it is not necessary to have a working wifi connection in the vicinity for the Edison-Scope to operate.

Getting started

What you'll need.

1. Intel Edison.

The Intel Edison is available directly from Intel in three forms, module only, breakout board and Arduino kit. We will be using either the breakout board or the Arduino kit. The breakout board has the advantage of small size but the Arduino kit has all the necessary connectors onboard. If you plan on using the breakout board, you'll need to obtain an USB OTG micro male to mini male cable or an USB OTG micro male to USB A female cable.

The breakout board combo does not come with a power adapter nor does it have a power connector on the PCB, you'll need to get the connector from Digikey. The Intel Edison Breakout board User Guide calls out for PJ-002BH-SMT-TR which is 2.5mmx5.5mm connector. But the connector used with the Arduino kit is the PJ-002AH-SMT 2.1mmx5.5mm. I recommend getting the 2.1mmx5.5mm version for interoperability with the Arduino kit. You will also need a power adapter that can source somewhere between 7-15V and 1-1.5A, the Arudino kit is shipped from the Intel with a 12V 1.5A adapter.

2. MSO-28 Mixed Signal Oscilloscope, http://linkinstruments.com/mso28.html

3. Additionally you'll also need an 1GB or larger USB drive or USB SD reader with an 1GB or larger SD card.

The easy way (Recommended)

The easiest way is to copy this pre-configured Edison image http://bit.ly/1KGXWV0 onto a blank USB drive or SD card and flash the image onto the Edison.

1. Copy the flash image onto the blank media.

2. Power up your Edison, access it via a terminal session. Examples below are done on ubuntu 14.04 LTS, adjust it per your OS of choice.

sudo screen /dev/ttyUSB0 115200

3. Log in to your Edison,

4. Plug the USB/SD drive into the USB OTG port, remember to switch the OTG switch on the Arduino kit board or use the OTG USB host cable on the breakout board. Check the existence of the USB device with

lsusb

check all your settings if you don't see the USB drive.

5. Mount the USB drive.

mkdir /mnt/usb
mount /dev/sda1 /mnt/usb

6. Expand and flash the image onto the Intel Edison. Be patience, it takes a while.

gunzip -c /mnt/usb/edisonscope-20150113b.img.gz | dd of=/dev/mmcblk0 bs=1M

7. Plug in the MSO-28 and Reboot the Edison.

shutdown -r now

8. Log into the Edison

user: root, pwd: edison-1

9. You should be able to see Node process, nodescope28

ps |grep node

10. You should also be able to see the MSO-28 attached to the USB port as 3195:f281 and enumerated /dev as MSO-28-0

lsusb
ls /dev

11. Now go to your smart device and look for an AP called edison-scope, the passkey is 'edison-1'

12. Open up a browser window and access http://edison-scope.local or http://192.168.42.1, you should see the the WebMSO control panel.

Roll your own (Advanced)

The MSO-28 uses the Silabs VCP driver which is not turned on by default on the Yocto distro shipped with the Intel Edison. In order to turn on the usbser support you'll need to follow the Intel Edison Board Support Package User Guide to turn on the usbser/cp210x support under menuconfig and bitbake a custom image.

Alternately, you can grab a pre bitbaked image from here http://bit.ly/1xOI0wa and flash it

mkdir /mnt/usb
mount /dev/sda1 /mnt/usb
gunzip -c /mnt/usb/3.10.7-poky-edison-silbser.img.gz | dd of=/dev/mmcblk0 bs=1M

Once you've flashed an image on the Edison with the usbser/cp210x support, you'll need to add the following packages.

1. Login root/ , setup Edison

configure_edison --setup

setup edison name and password, this will also be the WAP SSID and WPS Key.

2. Configure opkg source feed by adding the following lines to /etc/opkg/base-feeds.conf

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
src/gz all-ed 	http://repo.opkg.net/edison/repo/all
src/gz edison 	http://repo.opkg.net/edison/repo/edison3. 
src/gz core2-32 http://repo.opkg.net/edison/repo/core2-32

You can add it with vi editor or create the base-feeds.conf file on your pc and scp it into the Edison. (adjust the IP address for the location of your Edison)

sudo scp base-feeds.conf root@192.168.1.101:/etc/opkg/.

3. Update your packages

opkg update upgrade

4. Install git

opkg install git

5. If you are like me, can't remember any vi commands, install the nano editor.

wget http://www.nano-editor.org/dist/v2.2/nano-2.2.6.tar.gz
tar xvf nano-2.2.6.tar.gz
cd nano-2.2.6
./configure
make
make install

6. Grab and install the WebMSO-config.git so the Edison will recognize MSO-28 and MSO-19.

cd ..
git clone git://github.com/tkrmnz/WebMSO-config.git
cd WebMSO-config
cp /home/root/WebMSO-config/74-linkmso.rules /etc/udev/rules.d/.

7. At this point plug the MSO-28 into the Intel Edison's USB OTG port, you should see it listed under /dev as MSO-28-0.

ls /dev/MSO*

8. Download and copy the nodescope28.js into the NodeScope28 directory.

cd ..
git clone git://github.com/tkrmnz/NodeScope28.git
npm install express finalhandler serve-static serialport hex async fs comma-separated-values line-reader path

9. Download the WebMSO28 content.

cd ..
git clone git://github.com/tkrmnz/WebMSO28Node.git
cd WebMSO28Node
mkdir /home/root/NodeScope28/public
cp -rf * /home/root/NodeScope28/public/.

10. Create a temporary ram drive for the nodescope28 to store the captured data.

mkdir /mnt/tmp
mount -t tmpfs -o size=20m tmpfs /mnt/tmp
ln -s /mnt/tmp	/root/home/NodeScope28/public/fcgi-bin/tmp 

11. Determine the IP address of the Intel Edison.

ifconfig

12. Start the NodeScope28 server

cd NodeScope28
node nodescope28.js

You should be able to access the scope via a browser, http://IP of Edison:2880

13. At this point the Edison config server listens to port 80 and the EdisonScope28 listens to port 2880, you can change the listening ports by performing the following steps.

change the last line of the edison-config-server.js so it listens to port 8080 instead of 80.

nano /usr/lib/edison_config_tools/edison-config-server.js

Change the last line of nodescope28.js so it listens to port 80 instead of port 2880.

nano /home/root/NodeScope28/nodescope28.js

14. Reboot the Edison to confirm that the edsion-config is listening to port 8080

shutdown -r now

upon reboot, log in and confirm that the USB root hub is active, if is not, unplug and plug in the MSO-28 to trigger the USB OTG detection.

lsusb

15. To autostart the nodescope28 on bootup. Add the node_scope.service to /lib/systemd/system

cp /home/root/NodeScope28/node_scope.service /lib/systemd/system/.
systemctl enable node_scope.service

Reboot the Edison. The NodeScope28 accessible from a web browser via port 80.

shutdown -r now

16. To configure the EdisonScope as WAP(Wireless Access Point). Press and hold the SW1 button for 5 Sec on the breakout board or the PWR button on the Arduino kit. To revert back to the infrastructure mode.

configure_edison --wifi