Intel® Makers
Intel® Edison, Intel® Joule™, Intel® Curie™, Intel® Galileo
Welcome - This is a Peer-to-Peer Forum only. Intel has discontinued these products but you may find support from other customers on this Forum
9868 Discussions

How can Edison send serial output to PC COM port?

Community Manager

Inspired by this blog entry ( Gesture Recognition Using Accelerometer and ESP - Arduino Project Hub) , I want to connect Edison to my PC and send Edison sensor data to the PC App running ESP ( Example-based Sensor Predictions system). ESP will connect/listen to a COM port at 9600 baud. I have the Edison Mini-Breakout board available to me and also the Sparkfun Base Block for USB access but I'm not sure that is enough...

When I try to point ESP to 'Intel Edison Virtual COM port' enumeration like I do if I use the Arduino IDE, the app crashes. I believe this makes sense because this is the port used by the IDE to upload the sketches to Edison - it must not be the same as the Arduino IDE serial monitor? That's me just guessing...

- How can I get a COM port to enumerate to the PC that a program running on Edison could write/send output to?

- What /dev entry should the Edison program write/read to (e.g. /dev/ttyGS0, /dev/ttyMFD0, /dev/ttyMFD1, /dev/ttyMFD2, etc...what are each of these used for?)?

I've found a few links that help, but don't really spell it out for me....someone hold my hand here, ha... Intel Edison Arduino Serial to Host Process Serial Communication - All



0 Kudos
2 Replies
Community Manager

Searching these forums can be pretty difficult sometimes...

I just found this -

Which links to -

Trying to see if this solves my problem...I just thought you could use the console AND serial output thru another UART...

Community Manager

Looks like we can close this topic, but I plan to continue looking into it....

Steps to get Edison<-> ESP communicating...

HW: I have Edison (latest firmware EDISON-3.5 / 201606081705) + Sparkfun Base Block + Sparkfun 9DOF (LSM9DS0) Block

* both USB cables hooked up to PC from the Base Block

1) Reference post to disable serial-getty service on the usual COM port that you get Edison shell access to:

1. Connect the Edison through SSH and COM in 2 Putty sessions

2. Disable the serial terminal in the COM session typing these commands in the SSH session:

systemctl stop serial-getty@ttyMFD2.service  

dmesg -n 1

- As the post suggests, you can use Arduino IDE in this setup to use the Serial2 library from here out. I didn't do that because I haven't setup this sensor in Arduino. I probably will look back later. Until then, I can write up a MRAA program that will take it from here...keep reading...

2) You still have two sessions open, the COM one will not show or except any more input from your PC - it will just show you the traffic on Edison's /dev/ttyMFD2 port. You can verify this by sending an 'echo' command from your SSH session like ( programming - how to write characters to serial port - Ask Ubuntu )

# echo -e "HELLO" > /dev/ttyMFD2 // observe the string was written to the COM port

# echo -e "10\t50\t100" > /dev/ttyMFD2 // example string that ESP expects, you can use this to fool it to test

3) Close your COM session to free up /dev/ttyMFD2. Launch ESP on your PC and under the Configuration menu, select the same COM port you were just using.

- ESP will start listening right after selecting the COM port. You can see if it's working by sending the example string a few times that I put in step # 2

4) Wrote a little MRAA C program with the LSM9DS0 to open up /dev/ttyMFD2 and initialize the accelerometer. Reading the accelerometer every 10ms, it will write the readings in the "\t\t" string format to /dev/ttyMFD2. It shouldn't matter if ESP is running or not once the output starts coming from your program/Edison.

- references: linux - how to open, read, and write from serial port in C - Stack Overflow (only trace of C library LSM9DS0 I found on the internet)

5) ESP can now be calibrated and trained with data from the 9DOF block/LSM9DS0. It will send gesture predictions to localhost TCP port 5204 in the format "\n".

- if this address:port combo is not good for you, you can actually get more control if you use the ESP libraries to create your own Arduino IDE or Processing ESP mode sketches. ( GitHub - damellis/processing-esp-mode: A simple editor for ESP code that runs inside the PDE )

- Using the user_accelerometer_gestures_simple.cpp sketch in Processing, I can change the localhost to be my Edison IP. Using the socat command, I can do a quick listen on port 5204 (socat tcp4-listen:5204 -). Processing will launch its own instance of ESP, if you reload your calibration and training data or reset it all up, you can test it's predictions and see if it sends the gesture # back to your Edison. Ideally this port listen will be merged into the little C program that's sending the serial accelerometer data to ESP - just haven't gotten there yet.