Community
cancel
Showing results for 
Search instead for 
Did you mean: 
GCay
Beginner
992 Views

Displayin graph on computer without using serial communication

Jump to solution

Hi all,

I am using Intel Edison Breakout Board. I am getting data from photodetectors and my aim is displaying these signals as a graph. I can do it on my computer via serial port, however; I want to do it wirelessly.

I programmed Edison with Python and MRAA library to receive the data and plot but since breakout board does not have any display, it cannot show the graph. Can I see the graph on my computer without using serial communication?

Here is the code that I use:

# !/usr/bin/env python

import mraa

import time

import sys

import urllib

import re

import matplotlib.pyplot as plt

import matplotlib.animation as animation

plt.ion()

fig = plt.figure()

ax = fig.add_subplot(111)

data = []

led = mraa.Gpio(13)

led.dir(mraa.DIR_OUT)

det = mraa.Aio(0)

while True:

led.write(1)

time.sleep(2)

value = int(det.read())

print value

led.write(0)

time.sleep(0.5)

value = int(det.read())

print value

data.append(value)

secPlot = ax.plot(data)

fig.canvas.draw()

What should I add it to send the graph to computer wirelessly?

Tags (1)
0 Kudos
1 Solution
idata
Community Manager
89 Views

Hi GCay,

In order to do this, you will need to store the data from the photodetectors and then use some kind Wireless communication protocol in order to transfer this data to the computer and then graph it. One protocol that may be useful is the P2P connection this documentation might be of interested to you:

- http://download.intel.com/support/edison/sb/edison_wifi_331438001.pdf http://download.intel.com/support/edison/sb/edison_wifi_331438001.pdf

 

-

Hope you find this information useful, have a nice day!

Best Regards,

 

-Jose P.

View solution in original post

14 Replies
idata
Community Manager
90 Views

Hi GCay,

In order to do this, you will need to store the data from the photodetectors and then use some kind Wireless communication protocol in order to transfer this data to the computer and then graph it. One protocol that may be useful is the P2P connection this documentation might be of interested to you:

- http://download.intel.com/support/edison/sb/edison_wifi_331438001.pdf http://download.intel.com/support/edison/sb/edison_wifi_331438001.pdf

 

-

Hope you find this information useful, have a nice day!

Best Regards,

 

-Jose P.

View solution in original post

idata
Community Manager
89 Views

Hi GCay,

 

 

Do you have any more questions? Please let me know in order to assist you.

 

 

Have a great day!

 

 

Best Regards,

 

-Jose P.
GCay
Beginner
89 Views

I could not try it yet because of internet connection problem. I will try it and let you know.

I have another question actually. Does Edison Breakout Board have MAC address? If so, how can I find it?

idata
Community Manager
89 Views

Hi GCay,

Is there a reason why you need the Edison MAC address? If you are looking just to pair up the Edison with another device you can use the BlueZ commands in order to achieve this. (https://software.intel.com/en-us/articles/intel-edison-board-getting-started-with-bluetooth Intel® Edison Board Getting Started with Bluetooth* | Intel® Software )

We will be waiting for your reply, have a nice day!

Best Regards,

 

-Jose P.
GCay
Beginner
89 Views

Thank you, I found it.

I still could not make any progress for networking, I keep working.

idata
Community Manager
89 Views

Hi GCay,

 

 

Please let us know your results!

 

 

We will be waiting for your reply, have a nice day!

 

 

Best Regards,

 

-Jose P.

 

GCay
Beginner
89 Views

I installed nmap 7.50 both Edison and my computer. it has ncat inside it.

I am using it in Edison as connect mode by typing ncat and it connects properly.

But in Windows, I am trying to connect it as listen mode by typing ncat --listen . It gives this error.

"The requested address is not valid in its context. . QUITTING."

I scanned Edison's IP address by nmap and it returns without any problem.

So do you have any idea about the reason of getting this error?

I am using Windows 10.

idata
Community Manager
89 Views

Hi GCay,

Personally, I don't have too much experience with Nmap, I would encourage you to post your questions on this community http://seclists.org/nmap-dev/ Nmap Development Mailing List . They might be able to help you further with your inquiries.

Best Regards,

 

-Jose P.
GCay
Beginner
89 Views

Ok, I sent them an email.

Also I am trying to install Virtual Machine on my computer with Ubuntu. I'll let you know about the results.

idata
Community Manager
89 Views

Hi GCay,

I think that this link might be useful to you: https://help.ubuntu.com/community/VirtualMachines VirtualMachines - Community Help Wiki .

We will be waiting for your results, have a nice day!

Best Regards,

 

-Jose P.
GCay
Beginner
89 Views

I was able to establish TCP/IP connection between Edison and computer. It is sending string successfully now.

The problem is that I cannot send integer value.

Here is my code:

TCP Server

import socket

import mraa

import time

# file = open("data2.txt","w")

host = '172.30.212.118'

port = 22

x = mraa.Gpio(20)

x.dir(mraa.DIR_OUT)

s = socket.socket()

s.bind((host, port))

s.listen(1)

c, addr = s.accept()

print "Connection from: " + str(addr)

while True:

for i in range(0,20):

x.write(1)

data = int(x.read())

if not data:

break

print "sending: " + str(data)

c.send(data)

for i in range(0,5):

x.write(0)

data = int(x.read())

if not data:

break

print "sending: " + str(data)

c.send(data)

s.close()

TCP Client

import socket

import urllib

import sys

import re # for regular expressions

from time import sleep

from collections import deque

import matplotlib.pyplot as plt

import matplotlib.animation as animation

# import serial

plt.ion()

# Turn on interactive plotting

fig = plt.figure() # handle to figure

ax = fig.add_subplot(111) # handle to axis

data = []

host = '172.30.212.118'

port = 5000

s = socket.socket()

s.connect((host,port))

while True:

data = s.recv(1024)

print 'Received from server: ' + str(data)

# secPlot = ax.plot(data, 'b-')

# fig.canvas.draw()

s.close()

It should send 1 and 0. It establishes the connection, turn on the LED, get the value '1' and print it to screen but then I am getting this error:

Connection from: ('172.20.34.172', 9037)

sending: 1

Traceback (most recent call last):

File "tcpServer.py", line 27, in

c.send(data)

TypeError: must be string or buffer, not int

How can I send 1 and 0? Or float value because in further, I need to send analog values like 0.1, 0.3 etc.

Thanks.

idata
Community Manager
89 Views

Hi GCay,

 

 

Personally, I don't have too much experience with TCP/IP. I looked for the error "TypeError: must be string or buffer, not int" and in most cases this was because libraries that you are using only accepts a string. My advice would be to create a decoder, so that when a string arrives, it will be able to give the correct analog value.

 

 

Hope this helps, have a nice day!

 

 

Best Regards,

 

-Jose P.
GCay
Beginner
89 Views

Hi, I managed to establish TCP/IP communication between Edison and computer so I can connect them wirelessly now. Thanks for your help.

idata
Community Manager
89 Views

Hi GCay,

 

 

I'm glad to hear that is working now! Please don't hesitate to come back if any questions come up.

 

 

Have a great day!

 

 

Best Regards,

 

-Jose P.
Reply