Current News

Moderator: Mmiscool

User avatar
By peridot
#55071 You may be misunderstanding, there will be no issues Sending broadcast from the Win 7 machine but there will be receiving broadcast from the ESP. I found this early on in the development of the PC app. Original development was done on XP and I was using broadcast generally but with each ESP named in the data packet.

I designed the program originally as part of a project for a colleague where a uMite had to respond to a network request from a PC and send a file from an attached SD card. This worked fine on XP but when we came to real world testing he was using Win 7 and it didn't work. Further testing determined that messages from the PC to the uMite were being received and processed but the returned data was being sent but could not be received by Win 7 machine, the broadcast packets were being blocked. Anyway this prompted some improvements to identify the ESP/uMite device and have it use unicast when returning data.

The code I have developed consists of 3 parts. What ever the uMite project the parts are always the same.
1, ESP8266-MCU is the ESP firmware, sends/receives UDP messages between network and attached MCU, in my case a uMite
2, uMite library for ESP communication
3, uMite "Hook" code into the user program running on the uMite.

I have developed a "protocol" that allows messages to be sent to/from ESP/uMites and or PC. The protocol structure allows for commands/data meant for the ESP or the uMite in the ESP/uMite device to be received and acted upon.
Basically the format is IP:Port|from|to|cmd|data however the IP:Port is fairly transparent and handled in the ESPbasic firmware. There are also a selection of commands from the uMite that tell the ESP what to do with the data or are direct commands like time: (gets NTP time from Internet) info: (gets basic system info from ESP, eg IP,Flash,Ram etc)
From the PC end you can Read and Set the time on the uMite, Command the uMite or ESP or Both to reset. These commands could easily be expanded to allow many more ESP specific functions. For a very simple experiment with the ESP firmware loaded and the ESP connected to a terminal (I use CoolTerm as it has a very nice popup screen for sending messages) you can send a commands like info: and time: the ESP should respond with this info. In this way you are emulating an attached MCU. If you then also start up the PC application you should be able to connect to the ESP device you have on your network (if they are in the same domain) and sent commands as well. No answer of course without a MCU attached to the ESP but you will be able to see the commands in the terminal. Baudrate is set at 230400 by the way. You should be also be able to reboot the ESP from the commands list.

[img]
2016-09-14%2015_06_54-Photos.jpg
[/img]

The uMite uses MMbasic , I suggest you may want to take a look at the the micromite site for more information. http://geoffg.net/micromite.html

I hope this explanation hasn't been to convoluted. For a live example of the functions this project has allowed weather data collected by a uMite/ESP and sent to Weather Underground directly https://www.wunderground.com/personal-weather-station/dashboard?ID=IVICYARR4
You do not have the required permissions to view the files attached to this post.
User avatar
By Electroguard
#55079
You may be misunderstanding, there will be no issues Sending broadcast from the Win 7 machine but there will be receiving broadcast from the ESP. I found this early on in the development of the PC app.

Just to clarify and avoid confusion here... are you saying you've had problems when trying to broadcast udp from the esp device to the win7 app?

Because that is not something I have noticed, and if I run the following snippet on an esp_basic device it results in both broadcasts being received ok in cicciocb's udp utility running on a Win7 pc.
Code: Select alludpbegin 5001
udpwrite "192.168.4.255", 5001, "subnet broadcast"
delay 1000
udpwrite "255.255.255.255", 5001, "global broadcast"

Or am I somehow getting hold of the wrong end of the stick?

Thanks for the info B.T.W. - and I found it so intriguing that I think I'll have to get a uMite and start exploring its potential for myself.
User avatar
By peridot
#55081
Just to clarify and avoid confusion here... are you saying you've had problems when trying to broadcast udp from the esp device to the win7 app?


Yes that's correct , if you do a G..... search "receiving broadcast udp messages on windows 7" you will find any number of chatter on the subject. There may be ways round the "security" but look the simplest way in the end is just to code a bit more whats more its quite easy and the facilities are right there in the ESPbasic anyway. For ESP to ESP UDP coms you just don't need it.

Now having said all that I did check out your code snippet and it I was able to receive the messages, however I am using Windows 10 and I also did say previously that I did not have any issues with XP. Windows 7 specifically was the problem and there was certainly enough on the internet to suggest broadcast messages on Win 7 are not always successful.

Its great to hear you interest in giving the Micromite and MMbasic a try, if I can be of any help please let me know. Also if your not aware the Micromite forum on the Back Shed is well worth a look. http://www.thebackshed.com/forum/forum_topics.asp?FID=16