Wireless programming update

The initial code commit for wireless programming was a little sluggish and the performance wasn’t very good. I had to add delays to make sure everything was synch-ed and the protocol was working. The result was a rather slow wireless upload of a new sketch, especially if it was a large sketch. But it worked…

Today I worked on improving the protocol and was able to cut down the over-the-air upload time by a factor of ~5. The gains are mostly from improved serial communication. This will still take about twice as long as normal sketch uploads by means of an FTDI adapter. For instance, a 9,8Kbyte sketch takes me about 11 seconds to upload directly to a Moteino using an FTDI cable; wirelessly programming that same sketch takes about 22 seconds. Not bad given how involved the whole handshaking protocol works. And much better than almost 1 minute with the old code. So I’m classifying this new release as a beta. More improvements or bug fixes might be added later, but it’s definitely a functional release. I’ve uploaded different sketches of around 10KB several times without a glitch.

The wireless sketches examples (gateway and node) and the python script are in their github repo. The SPIFlash library was also updated (the WirelessHEX part of it), so get latest before you try this.

As mentioned before, the target node of the wireless programming protocol will need to have an SPI Flash chip attached (if they don’t have one already), and also run the DualOptiboot bootloader for this to work. Moteinos come with this bootloader (all orders since the other Wireless Programming post and code was released). If you have all these components right, any Arduino clone with an RFM12B transceiver and an SPI Flash chip of at least 32Kbytes of memory will do the job.

Just for fun, here’s how the end of a wireless upload looks like, notice there were 617 packets sent all the way from the PC (through the python script) to the attached Moteino (gateway), wirelessly to the remote Moteino (target node):

Transmission_end

9 thoughts on “Wireless programming update

    • Perhaps, but I would probably use something like the RaspberryPi + camera module that’s coming out for something like that. There’s just not enough CPU power and RAM to to a lot of video processing on an Arduino

  1. Actually I want to use a Moteino node + serial camera to take and fetch one picture on request, with the lowest power possible (for remote location powered with battery or solar cell + ultra capacitor)
    I want to keep the Moetino node in deep sleep (few ua) most of time and trigger a request to take and send one picture to a Moteino gateway (actually connected to a Raspberry Pi) . The power to take the picture + send it should be few 10 ma during few seconds or minutes then.
    I am thinking of first storing the picture on the node SPI flash then sending the jpeg file with the same protocol you designed to transmit the sketch.
    The picture will then simply be transferred by the gateway to the Raspberry and stored or processed there.
    I am not a programmer and I am reaching my limits to find out how to create these sketches, any advice will be welcome.

    • I didn’t try those serial cameras but they will probably need a driver, from what I recall reading they are not very good or easy to get data from…but do your own research before taking my word. Also powering the camera is another step you’d need to take to save the battery power. It would be a challending project that’s for sure…not to say it’s not possible.

  2. Hi there,

    Does this works with Moteino R3? Or need some modifications regarding RFM69?
    Thanks

    • All Moteinos come with DualOptiboot that supports writing a flash image from the external FLASH chip. However the WirelessHEX library is not yet ported for RFM69, so that will take a little while. If you can figure out a way to transfer your flash image into the FLASH chip (with the correct formatting) and reset the board, DualOptiboot will recognize it and reflash your Moteino.

  3. Hi, I just got started with my red hot R3:s 🙂
    I tried the RFM69 demo with node and gateway and got excellent performance! No problem communicating from a node inside my house to a node inside my garage which is 100m away – and there are two other houses in between!
    However I can’t get the wireless programming to work. It seems to be able to send a random amount of data successfully and then fails like shown below. Any ideas?

    Moteino: RFTX > 464c583a3230383aa5038091a50383508093a2038091a503
    Moteino: RFTX > 464c583a3230383aa5038091a50383508093a2038091a503
    Moteino: RFTX > 464c583a3230383aa5038091a50383508093a2038091a503
    Moteino: RFTX > 464c583a3230383aa5038091a50383508093a2038091a503
    Timeout, retry…

    TX > FLX:208:100D0000A5038091A50383508093A2038091A5033E
    Moteino: Timeout waiting for packet ACK, aborting FLASH operation …
    Moteino: FLASH IMG TRANSMISSION FAIL
    Moteino: SERIAL IN > FLX:208:100D0000A5038091A50383508093A2038091A5033E
    Timeout, retry…

    TX > FLX:208:100D0000A5038091A50383508093A2038091A5033E
    Moteino: SERIAL IN > FLX:208:100D0000A5038091A50383508093A2038091A5033E
    TIMEOUT, aborting…

    • Hey Lars,
      So there’s a timeout, meaning some packet gets lost or something like that. If your node is far away that might happen. I would try at closer range, I’ve always tested within a few feet away, to avoid such issues. The idea for wireless programming is to be able to program without wires, but close range will still be a necessity to avoid any dropped packets… for longer range the WirelessHEX library might need to be tweaked to allow more latency and more redundancy. I hope this makes sense.

Comments are closed.