loading

This instructable is written as a reference design for those who need to gather sensor data and send it over WiFi at a relatively high-speed. With this solution, rates of up to 1000 times per second are easily achieved. The methods used are also useful for those who are interested in connecting Edison and Microsoft Windows applications using socket-based programming over WiFi. Note:this is a LAN-based solution rather than using the Cloud.

The screen capture of EdisonViewer shows data capture from the Grove potentiometer connected to channel A0. During the capture, the potentiometer was cycled by hand to create the signal shown.

We used the following stock hardware:

  1. Intel Edison.
  2. Intel Arduino Breakout Board.
  3. Grove Starter Kit Plus - Intel IoT Edition, with miscellaneous digital and analog sensors.
  4. Suitable battery or wall-wart power supply.
  5. Windows PC running Windows 7 or later version OS.

This instructable includes two executables, one that runs as a client on a Windows PC and the other that runs as a server on the Intel Edison. Code is available for each at the following GitHub repositories:

https://github.com/aneedles/IntelEdisonClientApp

https://github.com/aneedles/IntelEdisonServer

The executable files are provided for each, so no compilation is required to give this a try.

Edison executable (EdisonServer) includes:

  • TCP/IP server with simple command handler
  • Time sequencer with preset speeds of 1, 5, 10, 50, 100, 500, and 1000Hz.
  • UDP packets are sent at the time sequencer rate and include one sample of analog and digital input data with each packet.
  • Digital I/O and analog inputs which are setup to use the channels available on the Grove Base Shield.

Windows application (EdisonViewer) includes:

  • TCP/IP client and UDP client sections.
  • Real-time graph of incoming digital and analog inputs.
  • Ability to enable/disable individual channels on each display.
  • UPD packet rate adjust which affects the EdisonServer's rate of sampling and broadcast. 1-1000Hz
  • UDP packet counters for visualizing packet count-up, loss, etc.
  • Pause/Restart button for pausing and resuming graphs.

Caveats:

  • As of 4/20/2015, the mraa library (used for the Edison's digital and analog I/O) has an issue that puts WiFi into a somewhat unstable state. This can be mitigated by not using either the Grove Base Shield channel D7 nor the Arduino Breakout board's on-board LED. (See https://communities.intel.com/thread/63188)

Step 1: Load and Run EdisonServer

  1. Obtain EdisonServer by downloading the attachment from here or from GitHub.
  2. Copy this to your Edison's home directory (or a directory that you prefer).
  3. Use putty to SSH into your Edison over WiFi (or other connection if you prefer).
  4. Use "chmod 755 EdisonServer" to make this file executable. "ls -al" should show permissions similar to: rwx r-x r-x
  5. Type "./EdisonServer" to run the server. It should indicate "Waiting for accept()...", indicating that it is listening for incoming TCP/IP connections on port 10000
  6. Go to step 2 for running the EdisonViewer Windows application. The connect request will be initiated from there.

Step 2: Load and Run EdisonViewer

Here's how to run the PC application, EdisonViewer, for interacting with the EdisonServer and displaying real-time digital and analog feedback. (See step 3 for a screenshot of the app.)

  1. Obtain EdisonViewer by downloading the attachment from here or from GitHub.
  2. Copy this to your desktop, or a directory of your choice. This file runs stand-alone on Windows 7 or later, and needs no other files to operate.
  3. You may need to get past Microsoft Windows or your anti-virus program's protections to run this file.
  4. Once EdisonViewer is running, select Configure... from the top menu. A popup will allow you to select the IP address of your Edison target. Use the same IP address you used for the SSH session in step 1.
  5. Verify the target IP on the bottom status line and then press Connect to connect to the target.
  6. If the connection times out, then you may have one of the following issues to resolve:
    1. Incorrect IP. Try opening a windows console (Run: cmd) and then ping your Edison's IP address to verify you have a connection.
    2. If ping is responding, then it may be Windows Firewall issue. This can be a little tricky, but is not usually difficult to resolve. You will need to troubleshoot this for your particular version of Windows. Windows Firewall may allow you to add an exception for TCP and UDP connections to ports numbered 10000 and 10001 as used by EdisonViewer.
  7. If EdisonViewer connects, but does not show incoming UDP packets, then it may be a Firewall issue. See 6.2 above. As time permits I will try to provide some links for resolving this issue.
  8. Wireshark can also be used on the PC to detect and display TCP and UDP packets, so is useful for diagnostics for those who are willing to go that route.
  9. Use the menu item "Detatch" to drop the TCP/IP connection. From windows this will also kill EdisonServer, so it will need to be restarted before attempting to Attach again.

Step 3: Using Sensors

IMPORTANT: Before connecting digital sensors, please read the following map and connect sensors accordingly.

Grove Base Shield ports configured as:

  • Digital Outputs: D2, D3 and D4.
  • Digital Inputs: D5, D6 and D8. (D7 is unused pending Intel fix of WiFi issue)
  • Analog Inputs: A0, A1, A2 and A3

If you prefer, you may modify the source code for EdisonServer to change the mappings for the Digital I/Os.

If sensors are not connected on some channels, you may see false readings appear on the EdisonViewer graphs as they reflect floating signals on the Edison's inputs.

I hope someone finds this useful. Please let me know if you have specific questions or comments, or see any errors that need correction. Thanks!

<p>Nicely done. Thanks for sharing this!</p>
Thanks seamster!<br>-Aaron

About This Instructable

2,010views

23favorites

License:

More by aaronneedles:Intel Edison as high-speed I/O server: Digital and Analog I/O transmitted over WiFi connection to PC client 
Add instructable to: