Hi everyone,
I have decided to share a stand-alone program I wrote that allows wireless programming of Moteino nodes. I essentially decoded Felix's Python script and put everything in a single program. I have been testing it for a couple of days, and it worked perfectly. All the serial code is in a Class, and is event driven.
Now for the bad news: this is written in VB6 :P So I am supplying the source code so that anyone fluent in DotNet could port it. All the serial code is in a Class, and is event driven.
Not many comments or error checking in the code yet: I ran out of time, I am leaving for a vacation tomorrow...
You can find the EXE program and source files on GitHub at:
[Edit] https://github.com/msjfb/Moteino-Wireless-Programming
A direct link for the (larger) Runtime package (may not be required, see below) can also be found at CNET here:
http://download.cnet.com/Visual-Basic-6-0-Extended-Runtime/3000-2070_4-76018551.html
If you get a 'COMDLG' error when starting the EXE program you need to install VB6 EXTENDED runtimes. You will find the install package in the directory.
I tested this in Windows 7, SP1 and it ran fine. Just install the Run-times only (see enclosed screenshot), and ignore and 'STDOLE' error you may get (I did).
WARNING: If you decide to install the runtime, please create a restore point before. I cannot guarantee that the setup will not damaged your Windows installation!
I can only confirm that I installed it on a clean Windows7, SP1 machine and had no problems.
Usage is pretty simple: Choose the HEX file to upload, local serial port number and Baud rate, and finally the destination NodeId.
Press the START button and the bottom status bar will keep you informed.
Prerequisites have not changed from the Python method: you must have the 'magic code line' present in your destination node sketch to allow wireless programming, and you must have the Wireless Gateway sketch running on your local Gateway node (that is connected to your PC).
Enjoy and please report any bugs, difficulties, etc.
François
François,
Thanks for sharing this in the forum!
I will try to find some time to port this to .net where it should be less dependent on other libs.
I finally had the opportunity to test your wireless programming application. It works very well and gets read of all that messing around with Pyton.
I would like to ask you if you can make a small change in it: when you click on the HEX file to to look for, make the default directory open in the Temp directory where the build HEX are. Is it possible?
Hi Luis,
sorry for the delay but it looks like I am not getting notifications on this post. Had a great trip to Lisbon and Porto. Lots of walking up and down steep hills! Beats San-Francisco by a mile...
I will look into the change. Would remembering the last directory used fit the bill ?
François
Hello François. Hope you tried the "Francesinhas" in Porto.
Yes, remembering the last directory would be a major upgrade.
Luis
Luis,
You will find a version 1.1 of the program on Dropbox...
That version stores and retrieves(local INI file) the last path+file chosen.
François
Thanks ;)
It looks very nice. :)
@luisr320 Is it working for you?
It works very well. I had devoped my own solution to this problem but now I only use François's app. Much cleaner and no need to mess with Python, the easeast hardest programming language to use.
Being able to remotely program a node is a very convenient feature provided by the Moteino. You can even dip a Moteino in epoxy resin, Han Solo style, and still be able to change its software. And this app really makes it a no brainer.
You should check my video explaining the concept of Wirelessly programming the Moteino (http://youtu.be/tjYz24aFGJI), but use François app to do it.
@luisr320 Thanks! BTW, if you're not already aware of it, there's an easier way for creating and locating the .hex file, as compared to the way you're doing it in the video. I think you'll prefer it. If you're running Arduino IDE 1.6.5 and above, then
1. go to the Sketch menu on the sketch you want to convert to .hex. Click on "Export Compiled Binary"
2. Next, click on Sketch>Show Sketch Folder
Bang. There the .hex file is, right before your eyes. Even shorter, (Ctl+Alt+S) followed by (Ctl+K). Done! :)
I am thinking of adding command line support to enable 'hands free' programming.
Structure: MoteinoWirelessProgramming <port>,<BaudRate>,<TargetNode>,<FilePath>
Example (in a .BAT file for instance):
MoteinoWirelessProgramming 1,115200,6,c:\MyHexFile\TestHexFile.hex
would launch the program in minimized mode, run it with the supplied parameters and exit with an error code that a batch file can read (0=success, 1-9= error code) if needed.
What do you think ?
Francois
Quote from: msjfb on November 13, 2015, 01:39:13 PM
I am thinking of adding command line support to enable 'hands free' programming.
Structure: MoteinoWirelessProgramming <port>,<BaudRate>,<TargetNode>,<FilePath>
Example (in a .BAT file for instance):
MoteinoWirelessProgramming 1,115200,6,c:\MyHexFile\TestHexFile.hex
would launch the program in minimized mode, run it with the supplied parameters and exit with an error code that a batch file can read (0=success, 1-9= error code) if needed.
What do you think ?
That would be awesome!
@msjfb I notice that in Linux it's easy to "virtualize" your serial com port by specifying <ip address>:<port number> instead of the serial com port id, for example in the avrdude command line. If it were possible (?) to do the same with your proposed windows command line, that would be really handy because then you wouldn't need to have your Moteino Wireless Programming Gateway tethered to whatever computer you're using to invoke the wireless upload. I don't know whether doing that in Windows would be easy or hard, but it's nice to be un-tethered. ;)
Felix,
A command line option will be in the next revision :)
WhiteHare,
I have done this in the past i.e. open a socket to send out the data instead of a serial port. Let me look into it.
I also have another idea (also something I have done before): have the program run in 'server' mode and have it listen to commands coming in from a socket.
Ex of possible scenario:
- Start the program in server mode (gateway on local serial port or remote IP port per local configuration)
- Wait for a TCP socket connection request from anywhere on the network. Accept the connection.
- Receive a command from the 'remote' client: Remote Node number + filepath to send (could be a file on the network or shared directory as long at the account running the program has access to it)
- send the HEX file OTA to the node, with real time feedback on the progress (in %)
- send completed or error message
To initiate a transfer:
- Open a TCPsocket to the 'server'
- wait for a 'OK' response
- send command : "PUSH: File=yyy, Node=x"
- server sends progress until completed, then sends "COMPLETE".
This would allow launching an OTA update from anywhere on the network (manually with any terminal emulation program or through any type of program that can open a TCP socket).
Since this is a bit more involved, it would be nice to have a couple of beta testers before I release it. Any takers ?
Francois
Quote from: msjfb on November 13, 2015, 05:47:36 PM
Since this is a bit more involved, it would be nice to have a couple of beta testers before I release it. Any takers ?
@msjfb: I ordered a couple more moteino's earlier today, so I'd be happy to help beta test after they arrive. I wouldn't want that to slow you down though, so I also don't mind deferring to anyone who already has available gear on hand. Whatever helps.
To all,
I have just uploaded to Dropbox a version 1.2 of the program: this version supports a command line mode for unattended operation. Of course manual operation still works...
See the new Changelog.txt file I placed on Dropbox for further details.
Let me know if you encounter any problems with the new feature: I have tested this quite a bit in-house but one never knows...
Francois
I can now confirm that the v1.2 GUI works (as did v1.1 GUI before it). :) Nice work!
As further testing, I did try running the following from the Windows 8 command line:
MoteinoWirelessProgramming 13,115200,123,C:\Users\LR\Documents\Arduino\WirelessProgramming_node\WirelessProgramming_node_v001\WirelessProgramming_node_v001.cpp.standard.hex
and it didn't appear to work as expected. Rather, it just opened up the GUI within the Windows environment (same as if I had run the program with no parameters). Maybe the file path I gave it is too long?
OK, I see now that my first attempt (above) at the command line was overly literal in following the directions and consequently invoked an earlier version (not v1.2) of the .exe file.
So, I fixed that, and also I shortened the file path in case that was a factor. This time I invoked it with:
C:\mwpv1_2>mwp1_2 13,115200,123,c:\mwpv1_2\wpn1.hex
and it worked! :)
There's no feedback on the command line itself as to whether anything happened. However, it does launch the GUI app (and quickly shrinks it) with the proper parameters, runs it (diagnostic mode is off), and it closes upon exit.
So, it's a first step. My main interest isn't in that, per se, but in the virtual com port that might (?) be added in the future. i.e. using an <ip-address>:<port> instead of a serial com port on whichever computer is sending the hex file to the Wireless Programming Gatway. Actually, if that were in the GUI, it would be even better, but I'd use it wherever it is. Then there would be an excellent chance I could marry an esp8266 (acting as the virtual serial port) with a Moteino Wireless Programming Gateway and thereby have a cordless (and portable) Wireless Programming Gateway. No dongles anywhere! :) :) :)
Well you asked for it, here it is: Version 1.3 with support for TCP remote port ;)
Although I have tested it on my network, I would like to have one or two testers try it before I release it.
I only tested it with a windows program acting as a TCP-Serial bridge. It would be nice to have it tested with another type of setup.
So, please PM me if you want to try it out.
François
Hi everyone,
A new version 1.4 of the software is now ready and available on Dropbox. I also uploaded the source code.
After a bit of testing and cleaning up, this version now allows communication to the wireless programming gateway either through a local serial port or a remote TCP port.
This means the gateway no longer needs to be physically attached to the same machine as the one running the software.
Enjoy,
François
Thanks, msjfb!
@everyone: It works wonderfully!
msjfb (Francois),
Nice work, I'd like to post this in a github repository so there is some tracking of the history of changes to the code. Unless you'd like to do that yourself, I can post this on my own github repository (github.com/LowPowerLab).
What do you think?
Felix,
Had not really thought about Github, as I had never used it.
So I read up a bit and gave it a try. I created a repository "msjfb", with all the files in a commit (version 1.4).
Not sure if this is the proper setup, so if you see anything missing or out of place let me know what needs to be done.
Note:
I had a changelog file in the now empty Dropbox folder (I cannot quite remember deleting it...) but it contained a few notes on usage and version history.
I will try to see if I have local copy somewhere, if not I will put new comments in the Github Readme,md file.
François
François,
Below is the changelog text:
Version 1.4 (2015/12/09)
Added support for use of a TCP port to communicate with the Gateway.
This allows the gateway to be connected anywhere on the network using a Device Server (such as the Lantronix UDS-1000)
or a PC with a "Serial to Ip" software running (such as the free Serial-TCP program)
===============================================================
Version 1.2 (2015/11/14)
Added command line support for unattended mode: 4 parameters are required:
<COM port>,<BaudRate>,<TargetNode>,<Filepath>
Ex: MoteinoWirelessProgramming 6,115200,5,c:\Arduino\Hexfiles\MyHexfile.HEX
This would launch the program in minimized mode, using COM port #6 at 115200 baud, and transmitting file "c:\Arduino\Hexfiles\MyHexfile.HEX"
The program will automatically exit when finished with the following return codes that can be read from a .BAT or .CMD file for automatic processing.
Code Description
0 Success
20 Cannot open COM port
30 Cannot set Target on Gateway
40 Handshake NAK (Image refused by target)
50 Problem in processing HEX file
60 HEX file not found
===============================================================
Version 1.1 (2015/11/02)
Saves/reads last HEX file used in MoteinoWP.ini file
===============================================================
Version 1.0
Initial release
Great,
You can just put the content of the changelog in the readme.md file, that will display it when you open the repository link.
Also the dropbox links should be updated to this location.
Thanks!
Done!
I am trying this 1.4 program for the first time and I am getting this:
(http://i.imgur.com/9b1BGm5.png)
The COM port is free and I can run my usual python script to do the WP.
Also it was a pain to get the Runtime installed, all the zips I tried failed to open. Then I managed to find an older version of the runtime on sourceforge which worked and I could start the program.
Anyway I would suggest putting a link to this on the readme.md file so people can get it straigth from there: http://sourceforge.net/projects/vb6extendedruntime/files/Visual%20Basic%206.0%20Full%20Runtime%202.0.zip/download
Ooops, you just found a 'copy/paste' error in the error handling routine: You should be getting a more significant error message.
I have updated the files to version 1.4.1, correcting this error. I also removed the INI file (was there by error, it will be created automatically), and a couple of log files.
I will prepare a setup file that will include all the required runtimes.
BTW, is there a way I can edit the readme file directly without doing it locally and pushing it up through Github workstation ?
Cool!
A setup with all required runtimes would be great, would remove any requirement to install anything else.
Yes you can just click on readme.md and then click the EDIT button and it allows to edit it right into the browser.
Yesterday I replaced all my dupont wiring with soldered connections to a PCB, and today I just now added a female header for plugging a Moteino R4 into. As before, thanks to msjfb's tcp serial support, it all "just works." Anyhow, since I didn't previously post a photo, I thought I would now. The board layout could obviously be improved, but it doesn't seem to matter.
Thanks again, msjfb! :)
For anyone interested, here is a link to msjfb's cool tool on github:
https://github.com/msjfb/Moteino-Wireless-Programming