Install software:

opkg update
opkg install snmp-utils
opkg install snmpd 
/etc/init.d/snmpd enable
/etc/init.d/snmpd restart

Setup snmpset:

nano /mnt/sda1/snmp.sh
#!/bin/ash
snmpset -v 2c -c private 127.0.0.1 iso.3.6.1.2.1.31.1.1.1.18.1 s $1 2>/dev/null
chmod 755 /mnt/sda1/snmp.sh

Test snmpset:

root@Arduino:/mnt/sda1# /mnt/sda1/snmp.sh 70
iso.3.6.1.2.1.31.1.1.1.18.1 = STRING: "70"

Confirm with snmpget:

snmpget -v 2c -c public 127.0.0.1 iso.3.6.1.2.1.31.1.1.1.18.1  2>/dev/null

ATmega32u4 code:

#include <Process.h>
int temperature;
void setup() {
  Bridge.begin();  // Initialize Bridge
}
void loop() {
  temperature = 70 + random(0, 10);
  Process p;
  p.begin("/mnt/sda1/snmp.sh");
  p.addParameter(String(temperature));
  p.run();
  delay(5000);
}

Confirm receive data from ATmega32u4:

root@Arduino:/mnt/sda1# snmpget -v 2c -c public 127.0.0.1 iso.3.6.1.2.1.31.1.1.1
.18.1  2>/dev/null
iso.3.6.1.2.1.31.1.1.1.18.1 = STRING: "77"



Comments powered by CComment