2

I have an analog sensor which I want to send data from my Arduino Certified Intel Edison to PC, without using a Serial Monitor and preferably putting the data into a text file.

Avamander
  • 624
  • 2
  • 11
  • 35
BenSmith
  • 121
  • 1
  • 1
  • 2

3 Answers3

1

I believe you are looking for something like the Telemetry library.

Full disclaismer : I am the author

It allows you to send string, numbers, arrays, sparse arrays through the serial port for instance. Each sent data has a label, called topic, that is used to identify it.

The Pytelemety command line interface then allows you to connect to the serial port, plot received data in real time, write parameters to reconfigure the arduino from the computer, etc.

Example of arduino code thats send an incrementing counter

#include <Telemetry.h>

Telemetry TM;
int8_t counter;

void setup() {
  TM.begin(115200);
  counter = 0;
}

void loop() {
  TM.pub_i8("count",counter);
  counter++;
  delay(10); 
}

Overview of the CLI (Command-Line Interface) enter image description here

Overview of a graph (not produced by the arduino program above) enter image description here

Output to file is not implemented yet, although all received data is logged to a file (but this log also contains system information). However, this is an interesting feature, quite straightforward to implement, that I might add in coming days if you are interested.

Central documentation is available here.

Overdrivr
  • 185
  • 1
  • 5
0

There are a couple of ways you can communicate between a "Arduino' and a "PC"*.

1)Serial communication.

A serial port on your system is created and a program that reads and writes to the serial port is used as communication.
A program that does this is the "serial monitor" which comes in many flavours.
In linux dumping serial monitor incoming data to a file is as easy as:

cat /dev/ttyS0> myFile

2)Bluetooth (LE)
Bluetooth is a low energy consuming protocol that is commonly used for communication between a PC and a "device". The LE uses even less energy. I'm not aware of any "official Arduino" boards that contain the hardware for Bluetooth on board.

3) Network
Today network equals to WIFI of tcpip. These methods allow for huge distances between the pc and the device.

Of these methods the serial communication over USB is the best know because -in Arduino world- this method is most commonly used to upload the "sketch" to the "Arduino". As such all hardware is commonly available.

*I put quotes around Arduino and PC because in perspective of this answer both arduino and PC are to be interpreted as a device containing a cpu.

jantje
  • 1,392
  • 1
  • 8
  • 16
0

I know, I'm late, but I recommend, using python, as I most always do. The serial module is part of the basic python installation

import serial

S = serial.Serial('/dev/tty/USB0', 115200, timeout=1)

S.write("Hello")
print S.readline()

Should echo Hello, if the arduino sketch replies all incoming data.

Very handy in combination with ipython, where one can interactively poke around with the serial connection object.

moestly
  • 347
  • 2
  • 9