Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

SNMP(Simple Network Management Protocol) Implementation on Arduino Ethernet Shield: Monitoring Room Temperature

By EG Projects July 8, 2019

In this tutorial i am going to teach you how to implement snmp over arduino Ethernet shield and monitor a remote system over a network. So what is snmp? Snmp stands for Simple Network Management Protocol. As the name depicts the protocol is used to monitor the equipment/peripherals connected to a network. Snmp can monitor and update the status of network peripherals such as routers, servers, printers, switches, hubs and other devices connected to a network. Today snmp protocol is widely used in telecom industry to monitor the status of remote BTS(Base Stations) sites and data centers. At BTS sites snmp is used to monitor the generator status, rectifier voltages, battery voltages and ups efficiency etc. Almost all the telecom industry is using snmp for their remote site telecom equipment monitoring.

A network that implements snmp protocol consist of two broad entities. 

  • SNMP Agents
  • SNMP Managers

An Snmp Agent is a program that is installed on a particular hardware. It gathers the data about hardware(Temperature, Status etc) and keeps the data with him. Snmp Manager is device that gets data from snmp agent. Snmp managers requests the agents to send particular data when ever is needed. Snmp protocol has a defined format for data fetching called MIB(Management Information Base). Manager’s call this mib for fetching data and agents gather data across this mib. Mib is a hierarchical structure of data placement and format etc. This tutorial will not go in deep details of snmp protocol rather it will only focus on implementing snmp on arduino Ethernet shield. If you are a newbie and want to learn more i suggest to google snmp details and structure.

Snmp(Manager) uses pull mechanism to fetch data from remote locations(Agents). Snmp is advantageous only if we do not need our data regularly. Since its a pull method so fetching data regularly will place heavy load on manager. In case we regularly and instantaneously need data we have to implement push protocols such as MQTT etc. In push protocol the agent sends data to manager when any condition is meet or an intrusion is detected. 

Demo Snmp over Arduino Project: LM35 Temperature monitoring over network

In the following demo project I am going to install snmp manager on my laptop and arduino will act like an agent. Arduino Ethernet shield is mounted on arduino uno and Lm35 temperature sensor is connected to analog channel-0 of arduino. Agent(arduino) will calculate the temperature and upon receiving the fetch request from manger it will send data to manager.
Snmp implementation on arduino

Snmp implementation on arduino

Snmp Manager Software

I used iREASONING mib browser as manager. Its easy to install and working with it is straight forward I installed it on my laptop. iREASONING offers a free student as well as trial version of mib browser. Its a great resource to check the agent behavior. You can download the free and trial version from this page. iREASONING Browser. 

Snmp Agent

At agent side we have arduino uno with Ethernet shield mounted on it.  I used Agentuino an open source library to implement agent functionality on my arduino. Agentuino is an open source library which helps in implementing agent functionality on arduino Ethernet shield. Snmp version v 1.2 is implemented by the library. It supports get, set and walk methods.

Project Circuit Diagram

Mount Arduino Ethernet shield on Arduino uno. Connect LM35 Vout pin to Analog channel-0 of arduino. Vout is middle pin of lm35. Ground gnd pin of lm35 with arduino ground. Apply vcc +5 volts to another pin of lm35, connect it to +5 volt pin of arduino. Insert on end of network cable in RJ45 port of arduino Ethernet shield and connect other end of network cable to PC or your lap top on whom you installed the snmp manager.
​
Note:
You can use any other arduino board if you want. Code is compatible with all arduino boards mega etc. Make sure to use TTL level boards. Arduino due is a +3.3v board, Ethernet shield will not work with it.
If you are new and don’t know about LM35 Pin out, its internal structure and formula derivation for arduino than i have some good tutorial for you.
Arduino Ethernet shield with LM35 temperature sensor- SNMP

Arduino Ethernet shield with LM35 temperature sensor- SNMP

Lm35 Pin out and Working

Lm35 with Arduino: Deriving Formula

Coming to the code portion. In the code i defined 2 OID’s. Across one OID agent is gathering temperature in Celsius/centigrade and across another in Fahrenheit. Also their are some system OID’s across which system information is hard-coded. You can see the system information hard-coded in the code in the code below. Their are total 5 systems OID’s containing information about system contact,name,location,services and general system description. 

System OID’s

const char sysDescr[] PROGMEM      = “1.3.6.1.2.1.1.1.0”;  // System Description
const char sysContact[] PROGMEM    = “1.3.6.1.2.1.1.4.0”;  // System Contact
const char sysName[] PROGMEM       = “1.3.6.1.2.1.1.5.0”;  // System Name
const char sysLocation[] PROGMEM   = “1.3.6.1.2.1.1.6.0”;  // System Location

const char sysServices[] PROGMEM   = “1.3.6.1.2.1.1.7.0”;  // System Services

Custom OID’s

const char temperatureC[]       PROGMEM     = “1.3.6.1.3.2016.5.1.0”;     //Temperature in Celsius
const char temperatureF[]       PROGMEM     = “1.3.6.1.3.2016.5.1.1”;     //Temperature is Fahrenheit

The function pduReceived() defines the information about the OID’s. Agentuino.listen() function is listening to snmp requests. This statement is present in the loop function to execute for ever. When ever any snmp request arrives the Agentuino.listen() function identifies it and passes the control to pduReceived() function. pduReceived() function extract’s the OID from the manager request, compares it with the OID’s it has, if matched than perform next step. Sends back the needed information if the request is get and sets the new parameters if the request is set.   

Testing the Snmp Agent and Manager

Before beginning with the test let me clear you some more general concepts. When ever we use Ethernet shield with arduino we define the mac address of shield and assign it a IP in code. Any device on network has an IP and mac address. So if Ethernet shield is going to be used on network it must have one. I assigned my Ethernet shield    

static byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };  //Mac Address for Arduino Ethernet Shield
static byte ip[] = { 192, 168, 20, 6 };                                           //IP Address for Arduino Ethernet Shield

To establish communicate between two network devices both must on same network. So we must bring our agent and manager on same IP series. Agent(Ether Shield) is at 192.168.20.6. So we must bring our PC or laptop at the same series 192.168.20..… I assigned my manager laptop IP 192.168.20.5. How i assigned this IP is Go to > Open Network and Sharing Center > Local Area Connection > Properties > Internet Protocol Version 4 > Insert IP and Sub net click OK. 
Snmp manager IP settings

Snmp manager IP settings

Now we have uploaded code to the arduino and made all the necessary settings its time to test the diy project. Open the MIB Browser insert the agent address, insert OID whose data is required set operations to GET and click go. Results will appear in the widow below.
iREASONING MIB browser settings for snmp

iREASONING MIB browser settings for snmp

Download the project code and please give us your feed back on the project. In case you have any queries please write them below in the comments section.

Watch the project video and results here

Project files/code


Filed Under: Arduino Projects, Microcontroller Projects

 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: 5G Technology
This Tech Toolbox covers the basics of 5G technology plus a story about how engineers designed and built a prototype DSL router mostly from old cellphone parts. Download this first 5G/wired/wireless communications Tech Toolbox to learn more!

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Inconsistent Charge Termination Voltage with battery charger
  • 21V keeps getting shorted to my UART line.
  • Voltage mode pushpull is a nonsense SMPS?
  • Voltage mode push pull with extra DC blocking capacitor
  • NXP library issue in awr

RSS Electro-Tech-Online.com Discussions

  • Is AI making embedded software developers more productive?
  • Why can't I breadboard this oscillator?
  • using a RTC in SF basic
  • Parts required for a personal project
  • Cataract Lens Options?

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • GigaDevice launches GD32C231 MCU series with 48MHz Cortex-M23 core and 64KB Flash
  • Advanced Energy releases 425 W CF-rated medical power supply in 3.5 x 6 x 1.5-inch format”
  • LEM combines shunt and Hall effect sensing in 2000 A current measurement unit
  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe