element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Upcoming Project: LED IP Status Indicator. How?
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 14 replies
  • Subscribers 677 subscribers
  • Views 3337 views
  • Users 0 members are here
  • raspberry
  • pi
  • raspberry_pi
  • learning
  • raspberrypi
  • rpi
  • linux
Related

Upcoming Project: LED IP Status Indicator. How?

Kuya.Marc
Kuya.Marc over 13 years ago

The Situation

 

I've configured my Broadband Internet Router to have fixed DHCP addresses for allowed devices (being used by household relatives). Before shutting off the Internet (so I can sleep), I typically ping IP addresses to see if they're connected. These are Wi-Fi connections, therefore, I can't physically see a LED light up on the router, itself.

 

The Configuration

 

I have the Raspberry Pi, Model B at 512MB, that has a physical LAN connect to my Broadband Internet Router, which also is a Wi-Fi access point. I am able to manually ping IP addresses when logging in via SSH.

 

The Project

 

Having a LED (connected via GPIO with resistor) light up when a specific IP address is active, without requiring a SSH or direct login. In other words, its a hardware version of the ping utility.

 

The Questions

 

  1. Can this be a BASH script that runs without SSH login?
  2. Can this be compiled from C source code? (I'm not used to Python, yet.)
  3. Can this run as a system service, whereas it's transparent to Raspberry Pi operations (Raspbian, XBMC, etc.)?

 

The Summary

 

I am not asking someone to write the code as I'm a veteran C programmer with 15+ years of Linux experience. I've never written code to test, and constantly retest of a specific IP address is alive or not. This project may be anywhere from extremely easy to extremely hard, but I know the Raspberry Pi can do it.

 

I will give credit to those that wish to make the initial code for me, as this project can be beneficial in many ways, such as checking if a specific device (computer, smartphone, etc.) is online or not.  Thanks in advance!

 

Kuya Marc

  • Sign in to reply
  • Cancel
Parents
  • jhz
    jhz over 8 years ago

    Hi Folks, I am doing a project in which I required something same. I am using my Raspberry Pi as access point and I want to turn ON an LED (connected with GPIO) when a device connect with the Raspberry Pi. Please help!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • rew
    rew over 8 years ago in reply to jhz

    I would write  a shell script:

     

    #!/bin/sh

    the_IP=192.168.1.12

    thepin=1

    gpio mode $thepin out

    while true; do

        if ping -c 1 $the_IP ; then

           gpio write $thepin 1

      else

          gpio write $thepin 0

      fi

    done

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • jhz
    jhz over 8 years ago in reply to rew

    Hi, Thank you very much for the code. You made my day.

    Can you give me a hint if we don't know the IP of other device, then how it will look like?

    Once again thank you.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • rew
    rew over 8 years ago in reply to jhz

    Well then... Can you give me a hint as to how we could know it is THE device.... :-)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • gregoryfenton
    gregoryfenton over 8 years ago in reply to jhz

    How about something like this: https://github.com/drkblog/findmacs which scans an IP range and returns all the MAC addresses it finds.

    Simply parse for the desired MAC address and toggle the LED accordingly.

     

    It would be much easier to reserve an IP address for the device in your router though.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • gregoryfenton
    gregoryfenton over 8 years ago in reply to jhz

    How about something like this: https://github.com/drkblog/findmacs which scans an IP range and returns all the MAC addresses it finds.

    Simply parse for the desired MAC address and toggle the LED accordingly.

     

    It would be much easier to reserve an IP address for the device in your router though.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube