Arduino Forum

Products => Arduino Yún => Topic started by: DarkBen on Jan 08, 2014, 10:32 pm

Title: Measuring if the Yun is internet connected
Post by: DarkBen on Jan 08, 2014, 10:32 pm
Hi,

I'm making a product with 2 standalone units that both house an Arduino Yun.  In order to make them easy for the consumer to use I'd like to be able to display feedback about when the Yuns are connected to internet thus rendering the product ready to use.

Is there a way to do this?  I'm not aware of anything in the Arduino library.  The extent of this function would be to turn an LED on when the Yun successfully connects to the internet.
Title: Re: Measuring if the Yun is internet connected
Post by: PCWorxLA on Jan 08, 2014, 10:46 pm
How about pinging a known public IP address during the initialization of your software on the Yun until you get a response?  :|

Ralf
Title: Re: Measuring if the Yun is internet connected
Post by: DarkBen on Jan 08, 2014, 11:01 pm

How about pinging a known public IP address during the initialization of your software on the Yun until you get a response?  :|

Ralf
I'm really hoping there's an easier way of doing it :L  Already using two Temboo choreos per Yun, and still have yet to include sequences of code governing buzzers, buttons and LEDs.  
Title: Re: Measuring if the Yun is internet connected
Post by: PCWorxLA on Jan 08, 2014, 11:48 pm


How about pinging a known public IP address during the initialization of your software on the Yun until you get a response?  :|

Ralf
I'm really hoping there's an easier way of doing it :L  Already using two Temboo choreos per Yun, and still have yet to include sequences of code governing buzzers, buttons and LEDs.  
Sorry, but I don't think that there is any easier way than that.
Pings are the least of amount of data to be send and received in order to positively determine "Internet connectivity".
And using a know IP address, to an external host that is known not to block ICMP, even doesn't account for the possibility of having working DNS, which is in a lot of cases what people run afoul of when complaining about "not being able to connect to the Internet" (I am doing support for an Open Source firewall projects for almost 14 years now)...

Ralf
Title: Re: Measuring if the Yun is internet connected
Post by: ProfePaco on Jan 09, 2014, 05:53 pm
here a solution using the blue wifi led as an indicator

http://forum.arduino.cc/index.php?PHPSESSID=39l516cmpuovi9iv9i5qmmaf65&topic=202718.0
Title: Re: Measuring if the Yun is internet connected
Post by: PCWorxLA on Jan 10, 2014, 12:08 am

here a solution using the blue wifi led as an indicator

http://forum.arduino.cc/index.php?PHPSESSID=39l516cmpuovi9iv9i5qmmaf65&topic=202718.0
Sorry, but that is not what he OP asked for.

He asked for being connected to the "Internet". The "blue LED" thread only checks is the WiFi is connected, which is only a connection to a local LAN, no guarantee that you can actually get further up the chain and connect to/from the Internet...

Ralf
Title: Re: Measuring if the Yun is internet connected
Post by: sonnyyu on Jan 10, 2014, 10:13 pm
nano /usr/bin/internet-live-led

Code: [Select]
#!/bin/sh
HOSTS="8.8.8.8"
ping_attempts=1
sleep_time=5
while true
do
count=$(ping -c $ping_attempts $HOSTS | awk -F, '/received/{print $2*1}')
#echo $count
if [ $count -eq 0 ]; then
/usr/bin/blink-stop
else
/usr/bin/blink-start 100
fi
sleep  $sleep_time
done


Code: [Select]
chmod 755  /usr/bin/internet-live-led
/usr/bin/internet-live-led &


if need it start at bootup
nano /etc/rc.local
Code: [Select]
wifi-live-or-reset
/usr/bin/internet-live-led &
exit 0