Go Down

Topic: Measuring if the Yun is internet connected (Read 3373 times) previous topic - next topic

DarkBen

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.

PCWorxLA

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

Ralf

DarkBen

#2
Jan 08, 2014, 11:01 pm Last Edit: Jan 08, 2014, 11:05 pm by DarkBen Reason: 1

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.  

PCWorxLA



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


PCWorxLA


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

sonnyyu

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

Go Up