Use an ESP8266 to OTA program a Moteino?

Started by WhiteHare, October 12, 2015, 02:29:48 AM

WhiteHare

#30
I just now came across the MAX890L switch chip, which Maxim claims will "typically" consume just 0.1ua when switched off:  http://datasheets.maximintegrated.com/en/ds/MAX890-MAX890L.pdf

Not an ideal zero, but close enough.

Looks as though these types of chips tend to be used in charge controller circuits, energy harvesting, and long-life battery powered applications.

As it turns out, for a total of $2.99, I ordered 50 of these yesterday:  https://www.fairchildsemi.com/datasheets/FD/FDC6329L.pdf
which the datasheet says will lose a maximum of 1ua when in its OFF state.  Not as fancy, but at 6 cents each I can't complain.  It resembles jra's design in the sense that it incorporates both a p-channel and n-channel mosfet into a single integrated circuit.

WhiteHare

#31
I hadn't realized the ESP-13 was out already, but it is, and it appears to be the one with superior RF. 



An ESP-13 has a 4 MegaByte Flash, whereas the ESP-12 has a 1 MegaByte Flash.  Most of the other models have 512K of Flash.  Hence, the ESP-13 is preferable for "future growth," as some firmwares are becoming quite large.  For example, Version 2 Beta of ESP-LINK requires  an ESP8266 with an minimum of 1 MegaByte Flash.  Also, with 8x the flash of earlier models, I expect the ESP-13 will manifest more sophisticated server software, MQTT, web interface, etc.

In a thread on a different Forum, ESP-Link's author has written " In the long run a 4MB flash will be required."  So, I've cancelled my ESP-12E order and have ordered ESP-13's instead.  It has the same pins exposed as an ESP-12, plus two extra ground pins.  ESP-13's cost about $2.15 each on Aliexpress, so only a small uptick from the ESP-12E price.

WhiteHare

Current status:
I have ESP-LINK installed on the Huzzuh now. It now connects automatically with my wifi network as soon as it powers on.  I can connect to the Huzzuh through a browser to reconfigure its wifi if I ever want to, but fortunately it does remember its settings if powered off.  I can see the serial output from a Moteino in the browser window if I choose.  I can also reboot the Moteino if I want to by clicking on a browser button.

The last step needed to achieve OTA programming of the Moteino by the ESP8266 is to redirect the output of AVR-Dude to port 23 of the Huzzuh's IP address instead of to a serial com port.  The command to do it is of the following form:
avrdude -p m328p -c arduino -b 115200 -P net:192.168.1.123:23 -U:yourHexFile.hex

That's all well and good in theory, but it leaves me up a creek without a paddle:   I normally interact with avrdude only indirectly through the Arduino Windows IDE, not through a command line.  So, although the fundamental mechanism is now in place, at the moment I'm not really sure how to make this patch so that it all works transparently from within Arduino Windows IDE.  I guess I'll have to dig into that next.


WhiteHare

#33
Brainstorming a bit, there are at least six ways to possibly solve the last step of the solution:
0. Somehow (?) have windows redirect serial communications to an IP:port instead.  There appears to be paid software that will do this.
1.  Do #0, but in Linux, where the OS supports it directly.  So, switch to using Linux Arduino IDE.
2.  Maybe there's a way to redirect codebender to the desired port 23.
3.  Connect an ESP8266 to the serial port, and use that to virtualize the com port communications  over wifi with the target ESP8266.
4.  Use special hardware dongles to virtualize serial communications.  For instance, for some home automation applications, i use some Global Cache dongles to virtualize RS-232 serial into ethernet IP, and they work flawlessly.
5.  Hack the Arduino IDE makefile to point at the IP+port# rather than to a serial com port.

Obviously, I'd rather not use dongles, so I'll likely use a software solution of some kind.  I'm leaning toward solution #5, but at the moment it's still a WAG as to whether it will work easily or only with great effort.

In any event, one of the above should work. 

I'll see this through to the end.  However,  lately I'm the only one here advancing the topic, and that's no surprise, because judging from the pushback it appears almost everyone else is generally happy and content with the status quo.   For that reason, this will likely be my last post on this thread, as  I'll be switching to other venues where there is already positive momentum, and more DIT, toward completing the last step.

My thanks to jra for his posts. 


jra

Since most of this thread is really more about the ESP8266 than Moteinos, I agree you will probably get more traction on http://www.esp8266.com

Felix

Quote from: jra on October 22, 2015, 10:20:57 AM
Since most of this thread is really more about the ESP8266 than Moteinos, I agree you will probably get more traction on http://www.esp8266.com

::) Thank you ...

kobuki

Although personally I'm not really getting excited about this possibility either, I still think it would be interesting to see it till the end, since it's about programming a Moteino using a new approach.

OTOH, an easy way would be to define a new programmer tool in the IDE config, see examples here: https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/programmers.txt

It's a matter or writing a suitable batch/schell script and calling the appropriate tools. Since avrdude seems to support TCP-based probramming, it might be even simpler.