Community
cancel
Showing results for 
Search instead for 
Did you mean: 
KNils
Beginner
1,590 Views

Starting Socat, Python script and Arduino sketch on boot

Hello,

I have migrated a project of mine from a Raspberry + Arduino to the Edison.

It was a python script communicating with the Arduino over serial. This worked like a charm, but took too much space.

To migrate it without having to rewrite the code I found Socat as a solution from this guide: http://www.instructables.com/id/Intel-Edison-Arduino-serial-to-Host-process-serial/ .

This also works like a charm, but... I am not able to get this to run on boot. I need to start it manually to get it to work.

The python script starts fine, but the socat does not start properly and causing the python script to fail when trying to start serial connection.

Keep in mind that this works fine when starting the python script from command line.

Socat command

socat pty,link=$HOME/tty0,raw,echo=0 pty,link=$HOME/tty1,raw,echo=0

Python connection

ser = serial.Serial('/home/root/tty1', 115200, timeout=1)

Arduino connection

RingBuffer rx_buffer_S1;

TTYUARTClass mySerial(&rx_buffer_S1, 3, false);

mySerial.init_tty("/home/root/tty1");

mySerial.begin(115200);

Systemd script for boot

[Unit]

Description=My Script Service

After=multi-user.target

[Service]

Type=idle

ExecStart=/usr/bin/python /home/root/mata.py

WorkingDirectory=/home/root

[Install]

WantedBy=multi-user.target

Why is it not running on boot?

I'd be happy to provide more information if needed.

Any suggestions is appreciated

Thanks

0 Kudos
2 Replies
idata
Community Manager
106 Views

Hi Matafaka,

 

 

Thank you for reaching out.

 

I remember seeing this issue in the past, not with Socat but with a similar software. So I'm guessing this is a general issue when running a script on boot and trying to start Socat (or any similar software) at the same time. Have you tried developing a similar script using another programming language? This is just a suggestion, it would be interesting to see if it behaves differently.

 

 

Regards,

 

-Pablo
idata
Community Manager
106 Views

Hi Matafaka,

 

 

Do you have updates on this case? Do you need any more help?

 

 

Regards,

 

Pablo
Reply