SNMP custom made device ESP8266 - networking

my company uses the application PRTG from paessler.com to monitor several SNMP sensors, I need to monitor the voltage of some devices and transmit it to the manager.
I was going to use an ESP8266 programmed via arduino to do it.
So far I've been able to send data to the ESP via UDP, and I configured it in the manager so it can retrieve the information from it and ping it.
The ping tests are successful however the monitoring does not work, by using the serial interface I can see that the ESP is receiving the data from the manager, with the OID that was set up. But the monitor shows it as inactive, I set up the ESP to send a simple string in the response.
When using a program called Packet Sender I am able to send the udp packets and receive the response as well, and everything works fine.
The ports I am using is 161 to receive in the ESP and I made it send to the 161, 123, 1023 as i saw specified in the prtg site
I may be sending the packets trough a port that is not the right one, or maybe I have to put a header before the message so the controller can Interpret it. I am not sure what the error can be. Any help will be apreciated

pretty easy - simply use the http push sensor from PRTG:
https://www.paessler.com/manuals/prtg/http_push_data_sensor
All best
Christian

Related

ESP-NOW with HTTPClient Request Returning Status Code -1

I'm building a project where I use 2 ESP8266 and 1 ESP32 devices, where I collect data with sensors on ESP8266's and send those gathered data to ESP32. Then, this ESP32 device sends an HTTP request (w/ HTTPClient) to my NodeJS Web Server, with the data received, which will eventually be processed there and saved to the database.
I'm having a problem though; when I use some mock data, and use only ESP32 without ESP-NOW and any other connection with other devices, I get status code 200, which indicates that my HTTP Request is sent succesfully. And when I use ESP-NOW to establish conenction between ESP devices, and not send any HTTP Request, I can successfully send and receive data.
However, when I use ESP-NOW to send and receive data, and send the data using HTTPClient request to my Web server on ESP32, I get status code -1 (refused connection). I couldn't find any other issues regarding this topic, so I figured I might ask for some help.
I have also used painlessmesh library to send/receive data between ESP devices, but that gave me the same exact issue. I'm using Wifi mode STA on my ESP32 device, which I connect it to my router to connect to the internet.
Thanks in advance for any help and support.
You cannot use ESP-NOW and WiFi in parallel at the same time; it's either-or. Exception: if you use the same channel for both (may not be possible)!
Option 1
You can alternate between the two protocols. So, as soon as the ESP-NOW transmissions from node 1 has completed (data fully received) you turn off ESP-NOW, connect to WiFi, publish via MQTT and then reverse. Needless to say that while your ESP32 is on WiFi you cannot receive data via ESP-NOW from either node 1 or node 2.
Option 2
Use some sort of gateway between ESP-NOW and WiFi. This product for example contains two ESP32 (connected over UART), one for ESP-NOW, one for WiFi: https://thingpulse.com/product/espgateway/. Disclaimer: I am a ThingPulse co-founder.
It is possible to run a web server and esp_now in the same esp32. Check my code here https://github.com/Servayejc/esp_now_web_server for the server
https://github.com/Servayejc/esp_now_web_server for the sender
This code make also automatic pairing of the nodes of esp_now.
This code is based on randomnerdtutorial…

How to spoof individual BLE packets

I'm doing a security analysis project on an IoT device that uses an unencrypted BLE connection (with ATT protocol) and I want to spoof an individual BLE packet with the source address of an already connected device. Is there some tool or API that would allow me to do this easily? I've already tried gatttool and spooftooph but they seem to be connection based and don't allow you to send out single packets with modified fields (as far as I could tell).
You will need some hardware where you can access the radio peripheral directly. What you basically need to do is to find or write a ble sniffer firmware, with the modification that it at a given moment sends a packet on the connection it is currently listening to. But note that the signal strength must be stronger than the original device's signal so it doesn't interfere.
The only open source project I'm aware of is Ubertooth. You will also be able to do this with an nRF52 but then you need to write your own sniffer firmware since Nordic Semiconductor's is closed source.
I can't comment on Emils reply yet, < 50 rep:
Nordic Semis nRF Sniffer v2 needs only the nRF52DK and wireshark to work as a general BLE sniffer. At 40$ it's not that expensive. I know for a fact they will release a new dongle soon that will sell for ~10-15 bucks if you can wait a a month or two.

Forwarding data from server to router to Arduino

Basically I have an Arduino UNO that I have connected via Ethernet to my router. I have logged the IP with my server and I would like to push data to my arduino. I guess the flow of data would be to send data (not sure the best way? Should I just open up a port and stream the data?) to the router that then forwards it to my Arduino at a local address assigned by my router.
How can I tell the router to forward this information on without logging in and changing anything with the router. The point of this exercise is to do everything with code and not do any other activities like logging into the router and setting things up. I want to do this as I have my Arduino recording temperature and I want to push data to state if it should switch sending the data from degrees or Fahrenheit or visa versa.
I would use a socket server with a publish/subscribe pattern. Probably several out there but I know XSockets.NET best.
A few hours ago I actually connected my Arduino to XSockets and communicated between webpages and my arduino both ways.
I will put the code on github when I am done, but you can look at a video showing the concept here: The Stuff For You Starts At 3:20
You dont need to open any ports as long as your arduino and server is on the same local network. Since IP adresses maps all devices on a network including your arduino.
The reason you want to open ports on your router is to make people outside your local network access a server on your network. Reasons why port forwarding exists is that when someone sends a packet of data to your public IP (which is your router) it doesent know which local IP to send the packet to. It then discards it, unless you port forward a port to a local IP, which means your router sends all packets with that port to that local IP adress.
You also need to make your own server program, for example a java program to act as a server.
I made something similar to what you are looking for, but i use a wifi shield instead. I've had some problems with maintaining connections with it, but so far it seems that it's a problem with the wifi libary.
You still might learn something from it though:
Maintaining communication between Arduino and Java program
If you want to know more about how the java server works in general, here is a great tutorial which explains a lot of the basics:
http://www.thenewboston.org/watch.php?cat=25&number=38

XBee Send To All

I have a simple xbee network operating where there are a bunch of slaves operating remotely and all talking to one master, who is connected to the server computer. That works no problem.
The slaves all send their ID as part of the packet and I'd like to have the master deliberately send an Ack after a delay. I'm trying to figure out how to do this efficiently and it seems that the only plausible way that doesn't involve reprogramming the master before each Ack is to send the Ack to all slaves and have them ignore the packet if it's not meant for them.
That solution is ok - I just can't figure out the command to use to do this. Is there some sort of Serial sendAll command? All of the devices are on the same ATID.
Typically in this situation, you would configure the master in API mode so you would get "Receive Explicit" frames with source addressing information, and could send with the "Transmit Explicit" frame type, and include addressing information in your frames.
If you use AT mode (transparent serial mode), then you're stuck having to change the DH and DL parameters on your coordinator every time you want to change who you send to. You should avoid using broadcast packets, since each one results in lots of network traffic (IIRC, each router will send the broadcast packet three times).
I do not know of a good XBee library on the Arduino, but it might be possible to port Digi's Open Source ANSI C XBee Host Library to that platform.

Wavecom GSM modem as a TCP client

I've been trying to do TCP communication using my Wavecom Fastrack modem. What I want to achieve is make the modem connect to a specified TCP server port to enable me to transfer data to and from the server. I found some information on than in the user's guide.
Basing on the information you can find on page 66 I created an application that opens the serial port to which the modem is connected and writes the following AT commands:
AT+WIPCFG=1 //start IP stack
AT+WIPBR=1,6 //open GPRS bearer
AT+WIPBR=2,6,11,"APN" //set APN of GPRS bearer
AT+WIPBR=2,6,0 //username
AT+WIPBR=2,6,1 //password
AT+WIPBR=4,6,0 //start GPRS bearer
AT+WIPCREATE=2,1,"server_ip_address",server_port //create a TCP client on port "server_port"
AT+WIPDATA=2,1,1 //switch do data exchange mode
This is exactly what the user's guide says. After the last command is sent to the modem, the device switches to data exchange mode and from then on everything what is written to the serial port opened by my application should be received by the server and everything the server sends should appear in the input buffer of that port.
The thing is that I did not manage to maintain stable bidirectional communication between the server and my modem. When I write some data to the serial port (only a few bytes), it takes a lot of time before the data appears on the server's side and in many cases the data does not reach the server at all.
I performed a few tests writing about 100 bytes to the serial port at once. Logging the data received by my server application I noticed that the first piece of data (8-35 bytes) is received after a second or two. The rest of the data appears in 2-5 seconds (either as a whole or in pieces of the said size) or does not appear at all.
I do not know where to look for the reason of that behaviour. Did I use wrong AT commands to switch the modem to TCP client mode? I can't believe the communication may be so slow and unstable.
Any advice will be appreciated. Thank you in advance.
what OS are you running? Windows does a pretty good job of hiding the messy details of communicating with the GPRS modem, all you have to do is create a new dial-up connection. To establish the connection you can make a call to the Win32 RasDial function. Once connected, you can use standard sockets to transfer data on a TCP port.
i have been using wavecomm modem for 2 years now.As far as i know from my experience is that if you are able to send some of the data then you can send all of the data.
the problem might be in the listening application which receives the data on the server side.
It could be that it is unable to deal with the amount of data that you are trying to send.
try sending the same data in smaller busts
with some delay in between them,then you might receive all data intact.

Resources