In a later blog post I will describe how I am using a TL-MR3020 router as low-cost wifi shield for my Arduino to transmit sensor data over wifi. In this post I just want to show how you can script a restart of the arduino by powering off the USB port that the Arduino is connected to. In need this because sometimes the arduino does not send anymore data to the ttyUSB0 device. So as a workaround I’m restarting the Arduino from time to time by cron job.
#!/bin/sh echo 0 > /sys/class/gpio/gpio8/value echo 1 > /sys/class/gpio/gpio8/value echo "$(date)" >> /tmp/restart.log