more simple Discovery protocol

64 views
Skip to first unread message

Holger Lembke

unread,
Nov 30, 2016, 7:07:34 AM11/30/16
to Developers
Hi.

I have a proposal for a much more simple board discovery protocol.

After spending some time in getting the ESP8266 to show up in the ports network section I failed. I googled around. There is a lot of stuff about esp8266mdns (is it working or not?), the same goes for javas jmdns and the implementation of Arduinos discoverers. I found the concept with creating timers very confusing.... At the end of the day it is very frustrating not to get the board visible in ports.

My idea is to have a way easier protocol that can be implemeted way faster on all board platforms and does not use any "high level" componets and concepts like in mdns. Why not simply broadcast the existance of the board into the world?

void PostMyself(void) {
 
IPAddress broadcastIp(WiFi.localIP() | ( ~WiFi.subnetMask()));

 
WiFiUDP udp;
  udp
.begin(8765);
  udp
.beginPacket(broadcastIp, 8531);
  udp
.write("1\nesp8266\n");
  udp
.endPacket();
}

This could be called within a simple "if (millis()-ticker<5000)" inside loop(), simple, straight forward.

On the IDE side I made e simple threaded receiver. Currently it is very very basic, just a proof of concept. It works!


To sum it up:
- on the board side less code involved (no mdns)
- on the IDE side less code involved (no jmdns)

Opinions?

Thanks.

Abraham Pineda

unread,
Nov 30, 2016, 10:24:28 AM11/30/16
to devel...@arduino.cc
It looks genius to me! Simple straigh tforward , yet powerful. I'll try it out myself!!

--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+...@arduino.cc.

Massimo Banzi

unread,
Nov 30, 2016, 10:27:06 AM11/30/16
to Arduino Developers
Looks good, I haven’t had the chance to try it but it reminds me of the way we implemented discovery in the
first ethernet boot loader we released (aka the Unfinished ethernet boot loader)

m

--
Massimo Banzi <m.b...@arduino.cc>
Arduino LLC



Abraham Pineda

unread,
Nov 30, 2016, 10:32:38 AM11/30/16
to devel...@arduino.cc
Mazzimo?! Maybe we can take this to the next Arduino IDE release?!

Let's give a go, which version of support for ESP8266 are you using currently? The community, sparkfun?? So I can use the same environment.

Let's kick this up!!!

Holger Lembke

unread,
Nov 30, 2016, 10:37:36 AM11/30/16
to devel...@arduino.cc
I use esp8266 Community 2.3.0-rtc2 but it should not matter.

If it matters, I have to redesign it, because I want it plattform independant or at least very easy to adapt.

To unsubscribe from this group and stop receiving emails from it, send an email to developers+unsubscribe@arduino.cc.

--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+unsubscribe@arduino.cc.

--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+unsubscribe@arduino.cc.

Massimo Banzi

unread,
Nov 30, 2016, 10:38:24 AM11/30/16
to Arduino Developers
I was talking about adding it to the official arduino cores.

The ESP8266 has deviated from the standard Arduino API making a lot of code non portable.
It would be nice to converge back

m



--
Massimo Banzi <m.b...@arduino.cc>
Arduino LLC



Victor Aprea

unread,
Nov 30, 2016, 10:43:06 AM11/30/16
to Arduino Developers
Hi Holger, all,

Great to see some new ideas and contributions on the list, it's been quiet for a while. Please don't take this as me bursting bubbles. I actually don't think it's a big deal personally, but keep in mind that MDNS is a multicast protocol, where as this proposal is a broadcast protocol. As such, I'm pretty sure there are restrictions on broadcast on how far the packets are allowed to propagate in a network. I'm not going to pretend to be a networking expert or anything, or to fully understand these implications, but I wanted to share a word of caution. It still might be a great improvement for a segment of the Arduino community.

Kind Regards,
Vic

Victor Aprea // Wicked Device

To unsubscribe from this group and stop receiving emails from it, send an email to developers+unsubscribe@arduino.cc.

--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+unsubscribe@arduino.cc.

--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+unsubscribe@arduino.cc.

Holger Lembke

unread,
Nov 30, 2016, 11:04:05 AM11/30/16
to devel...@arduino.cc
Vic,

I'm with you on that.

SimpleUDPDiscovery.java does not replace the existing mdns solution, it is an alternative. I assume (out of nowhere) that in 99,954% of all cases the IDE/remote uploade development environmet is a small /24 net solution. And there broadcast should work well.

I could imagine it would be a nice addendum do have a dedicated connection point to point to the IDE to add a board in ports menu, too. (Changes in code would be minimal). But so far, I'd prefer first testing this in practice.

Adding to that I have a simple SerialUDP-class that replaces Serial. It simply does the same as Serial does and copy-sends the characters to an udp-listener (point to point, not broadcast).

Code in Arduino goes like this:

void setup() {
 ....
  Serial.begin(115200);
...
  if (the wifi net has been established) {
    SerialUDP.begin(0, "192.168.111.32", 1111); // 0 -> dont reinit Serial

And now simply use SerialUDP.print everywhere. (There is a SerialTCP but that does not work so well, esp8266 is too limited to waste tcp connections for that, too.)

/me being Windows user, I have a small powershell listener that displays the packets.

per1234

unread,
Oct 3, 2017, 5:06:22 PM10/3/17
to Developers
On Wednesday, November 30, 2016 at 4:07:34 AM UTC-8, Holger Lembke wrote:

It would probably be helpful to add a link to your pull request:

Paul Stoffregen

unread,
Oct 3, 2017, 7:19:51 PM10/3/17
to devel...@arduino.cc
Just wondering, is there a recommended way for 3rd party boards to provide their own discovery class?  Or is a patch to the IDE source the only viable way?
--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+...@arduino.cc.

Holger Lembke

unread,
Oct 5, 2017, 7:55:42 PM10/5/17
to devel...@arduino.cc
The IDE patch seems the only way. The java class base is clean and simple, so it is not too difficult.

There is another problem: with OTA update you lose the serial interface and serial monitor for nice and easy debugging. I wrote a SerialUDP/SerialTCP that replaces Serial with a quickly hacked powershell receiver. I thought about porting it to the serial monitor, but with the current lack of any feedback I feel it is a waste of energy.


To unsubscribe from this group and stop receiving emails from it, send an email to developers+unsubscribe@arduino.cc.

--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+unsubscribe@arduino.cc.

Paul Stoffregen

unread,
Oct 17, 2017, 11:53:16 AM10/17/17
to devel...@arduino.cc
FWIW, I also wrote a TCP-based serial monitor, which uses a localhost connection to talk to a helper program.  I use it HID protocols that can't be easily done from Java.  It's the bulk of my code that requires a special installer rather than using the new boards manager.  Someday finding a way to turn this (and ideally a discovery manager I intend to replace my ugly ISW hacks) into a regular package has been a low priority.  Still, I'm curious to hear from anyone else who's customizing this part of the IDE.  I would love to do things in a cleaner way, if such a way was supported.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+...@arduino.cc.

Tom Igoe

unread,
Oct 17, 2017, 11:59:07 AM10/17/17
to devel...@arduino.cc
The port monitor added the facility to do TCP socket monitoring in order to support the Yun board. The functionality should still be there, FWIW,

t.

Holger Lembke

unread,
Oct 17, 2017, 4:59:16 PM10/17/17
to devel...@arduino.cc
Yes, I have seen that while browsing around to build my "dump board settings tool" that creates stuff like

// Board: "ATtiny24/44/84"
// Prozessor: "ATtiny84"
// Clock: "Internal 8 MHz"

from the Tools-Menu. I can't remember with what settings I compiled the sketch after a week or so, so I needed some help...

Working with TCP it will still need some work to get it to UDP. And those IDE-things are not very well documented... I find some things quite hard to understand.



To unsubscribe from this group and stop receiving emails from it, send an email to developers+unsubscribe@arduino.cc.

Reply all
Reply to author
Forward
0 new messages