---
title: "LED On/Off Control Using SNMP with W55RP20"
url: "https://maker.wiznet.io/Hannah/projects/led-on-off-control-using-snmp-with-w55rp20/"
markdown_url: "https://maker.wiznet.io/Hannah/projects/led-on-off-control-using-snmp-with-w55rp20/md"
type: "WCC: WIZnet Created Content"
author: "Hannah Lee"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "Hannah Lee"
published: "2024-11-19"
language: "en"
hardware: ["WIZnet W55RP20-EVB-Pico"]
likes: 0
views: 1258
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# LED On/Off Control Using SNMP with W55RP20

> This project demonstrates how to control an LED's On/Off state using SNMP (Simple Network Management Protocol) with the W55RP20-EVB-Pico board.

Original author: Hannah Lee

## Components

- **WIZnet W55RP20-EVB-Pico** x 1 ([docs](https://wiznet.io/products/powered-by-raspberry-pi/w55rp20-evb-pico))

## Documents and links

- [SNMP example](https://github.com/WIZnet-ioNIC/WIZnet-PICO-SNMP-C) (code)

## Article

### **1 Setup board configuration**

Setup board to W55RP20_EVB_PICO in CMakeLists.txt in WIZnet-PICO-C-SNMP/ directory.

```plaintext
# Set board
#set(BOARD_NAME WIZnet_Ethernet_HAT)
#set(BOARD_NAME W5100S_EVB_PICO)
#set(BOARD_NAME W5500_EVB_PICO)
set(BOARD_NAME W55RP20_EVB_PICO)
#set(BOARD_NAME W5100S_EVB_PICO2)
#set(BOARD_NAME W5500_EVB_PICO2)
```

### **2 Setup board configuration**

Setup network configuration such as IP in 'w5x00_snmp.c' which is the Web I/O example in 'WIZnet-PICO-C/examples/snmp/' directory.

Setup IP and other network settings to suit your network environment.

```plaintext
/* Network */
static wiz_NetInfo g_net_info =
    {
        .mac = {0x00, 0x08, 0xDC, 0x12, 0x34, 0x56}, // MAC address
        .ip = {192, 168, 11, 2},                     // IP address
        .sn = {255, 255, 255, 0},                    // Subnet Mask
        .gw = {192, 168, 11, 1},                     // Gateway
        .dns = {8, 8, 8, 8},                         // DNS server
        .dhcp = NETINFO_STATIC                       // DHCP enable/disable
};
```

```
/* SNMP */
uint8_t manager[4] = {192, 168, 11, 162}; // manager ip, (is your pc ip or others managers)
```

OID and callback function are registered to control the status of the user LED in SNMP.

![](https://maker.wiznet.io/upload/ckeditor5/534509812%5F1732032162%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/534509812%5F1732033653%2Epng)

### **3 Run**

[![](https://github.com/WIZnet-ioNIC/WIZnet-PICO-SNMP-C/raw/main/static/images/snmp/snmp.png)](https://github.com/WIZnet-ioNIC/WIZnet-PICO-SNMP-C/blob/main/static/images/snmp/snmp.png)

After the burning is successful, configure the parameters of the serial port and open the terminal with "Windows+R".

[![](https://github.com/WIZnet-ioNIC/WIZnet-PICO-SNMP-C/raw/main/static/images/snmp/snmp_connect.png)](https://github.com/WIZnet-ioNIC/WIZnet-PICO-SNMP-C/blob/main/static/images/snmp/snmp_connect.png)

Enter a command at the terminal to control the light on and off. If there is an error in sending the command, it is likely that Net-SNMP is not installed or the command is wrong.

```plaintext
/* SNMP get command */
> snmpget -v1 -c public 192.168.11.2 .1.3.6.1.4.1.6.1.4

/* SNMP set command */
> snmpset -v1 -c public 192.168.11.2 .1.3.6.1.4.1.6.1.5 i 1			//LED ON
> snmpset -v1 -c public 192.168.11.2 .1.3.6.1.4.1.6.1.5 i 0			//LED OFF
```

![](https://maker.wiznet.io/upload/ckeditor5/534509812%5F1732031364%2Epng)![](https://maker.wiznet.io/upload/ckeditor5/534509812%5F1732031364%5F0%2Epng)

---

Source: https://maker.wiznet.io/Hannah/projects/led-on-off-control-using-snmp-with-w55rp20/
