Bridge breakdown? Using Bridge.begin() multiple times


I use my Yun to collect sensor-data with an Arduino-sketch, pass it via Bridge to the linux side and sent it to the internet using a shellscript. After the Yun was online working for 3 days, it stopped sending data. Apparently both the Arduino-sketch as well as the linux side where working as they should (indicator-LEDs were working , I could also log into the linux shell and execute my shellscript manually), but there was simply no transmission from the ATmega to the linux-side.

Like adviced in the documentation of the Bridge-library, i used Bridge.begin() once in the setup-routine. Maybe this initialisation failed after some time. Is it a problem to use the begin command frequently every time before a transmission is made? What exactly happens when Bridge.begin() is executed? Can I see a process running on linux side?

Or would it be better to frequently reboot the whole system when using it for long-term datalogging?

Thx for your advice! :)


You could try restarting the Bridge, but before doing that, I would try and figure out where the failure is happening. It's better to solve the actual problem rather than apply a work-around to fix an unknown problem.

The Bridge library communicates with a process on the Linux side. In simple terms, Bridge.begin() starts by attempting to terminate that process, by sending it a special command sequence, then a CTRL-C, then a few newlines. It then assumes it is talking to the Linux command prompt, and simulates typing the "run-bridge" command that starts the Linux side process. It then continues to talk directly to that process.

So yes, you can call Bridge.begin() again, and it should restart the Bridge process. But there is a fair amount of overhead involved, and you can expect it to take several seconds each time you call it.

On the Linux side, you can check to see if the Bridge process is running by using the [color=blue]ps[/color] command. Look for a line that looks something like:

2490 root      7524 R    python -u

Thank you for the answer!

As mentioned, I found only that Arduino as well as Linux-side are working, so I assumed there was a communication problem. The arduino sketch an the scripts are rather simple, so I don´t think the problem is there (e.g. memory leaks).

Let´s see how long Yun will be sending data when I restart the bridge before transmission; because there are only a few transmissions a day it does not matter if this takes extra time. I only worried that if I restart bridge over and over the linux side might eventually run out of memory.

Thank you also for so many answers to other users like for example, which also helped me a lot! :)