Posts Tagged ‘Yun’

Set clock on Arduino Yún

January 14, 2014

In my Arduino Yún project, I’d had the problem of sometimes writing to the log file before the clock had been set (so the log had the wrong date and time). To avoid this, I wanted to force the clock to be set as part of my Arduino sketch.

After poking about on the Linino side of the Yún, I figured it out.

You use ntpd, like this:

p.runShellCommand("ntpd -qn -p");

I figured this out by ssh-ing to the Yún and using ps to see what processes were running. I figured I might be looking for ntp, so I used

ps | grep ntp

I don’t know why the command uses the 0. in, but didn’t work, and the command I saw running in the results from ps used it.


Crazy Arduino Yun solution to a router problem

January 8, 2014

My father-in-law helps out with computer-related stuff at a coffee shop. They’ve been having WiFi troubles; the WiFi signal is strong, but they lose the internet connection. The solution has been to turn the router off and then back on; if they do that, things then work fine. He even installed a wall switch for this purpose, to make it easier.

He asked me whether I could build a device that would do this automatically. It sounded like an interesting project, and there’d be some useful things to learn in the process. Probably they should just buy a new router, but what follows here is a description of my crazy auto-router-resetter: my goal was to build an Arduino-based device that would check for an internet connection, and if the internet was down, use a PowerSwitch Tail (from Sparkfun) to shut off the router, wait 30 seconds, and turn it back on again.

Here’s a picture of the final product:

Arduino Yun project