Sending data over WiFi between our PC application and the EV3 (part 4)

In the previous article about ‘Sending data over Wifi between our PC application and the EV3, part 3‘, I explained how the workaround works. This part describes the protocol that we are implementing to make sure that all data that is send, is correctly processed.

A major drawback of the workaround, is that you have to implement a protocol between the EV3 and the PC application to prevent data to be lost. The protocol for our application is as follows:

  1. The commands from the PC to EV3 are send by a regular mailbox. Since this functionality works, why not use it. For example, the command from the PC to the crane “LOAD BLUE” will be send to the Inbox mailbox at the corresponding EV3, the EV3 program reads the Inbox mailbox to process these commands.
  2. The commands from the EV3 to the PC are send by the ‘file’ workaround. For example, if the crane is ready with loading the blue candy, it wants to send back the message “LOADED BLUE READY” to the PC. This command will be written to a file, that can be read (polling) at the PC side.

Each command that is send to the PC, is written in a separate file, in our case we use the name “Outbox” plus a counter, e.g. ‘Outbox33’. The PC application polls the directory and reads the files. After a file has been read (and thus can be set to ‘processed’), a message is send back to the EV3 (mailbox) with the file name. The EV3 uses a separate mailbox that reads an incoming file number and then deletes the corresponding file (this number will always be one higher than the last one, otherwise something went wrong in the protocol). Therefor, with the use of two counters, we can reuse file names that have been removed before.

EV3 .NET on Track Comm Protocol

One item remains: in case the application aborts, the directory is left with Outboxnn files that need to be removed. In our current implementation for startup, an “INIT” command is send to all NXT and EV3 bricks to set the software and hardware in initial state again (for example, the crane moves to the grabber to an upper position, trains will stop). This INIT command will also remove all Outboxnn files by looping over a counter from 0 .. 99 and setting the array elements to ‘free’.


5 thoughts on “Sending data over WiFi between our PC application and the EV3 (part 4)

  1. Pingback: Plans for Lego World 2015 | Sioux .NET on Track

      • Hi! We ( also are interested in being able to use Wifi with the official firmware/Lego Mindstorms Education EV3. It’s a pity that there is not a straightforward path. In that regard these posts in your blog are VERY valuable. Thank you very much!! We wanted to ask you: Have you done any progress in this area since the publication of this post? Would you share the source code? Thanks! 🙂

        My mail is

        P.S: Please excuse my poor/bad English :-!

      • Hi JCarlos,

        Thank you for the kind words. I have not worked on the code since, been busy building the physical stuff. Programming is done by the others in our team.

        Please note that there was (and maybe still is) a huge difference with setting up a bluetooth connection and the Education version of the firmware: when I tested it the last time (about a year ago, don’t remember which firmware version), it only worked with the Home edition version of the firmware.

        Kind regards,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s