Requirements for Moteino Wireless Programming?

Started by JimSmith, February 15, 2014, 12:06:00 AM

JimSmith

I am ready to order the parts for the GarageMote, but have a question of exactly what to order.  I also want to verify I have the correct understanding of how all the parts fit together.

When I first install the sketches into the two Moteinos, I will use the Arduino IDE and the Adafruit FTDI cable from my PC.  Once programmed, I then hook the "master" Moteino to a Raspberry Pi and the remote "slave" Moteino to the GarageMote in my garage.  With my fingers crossed, I think I can get all that working with Felix's excellent documentation.   

At a later time, I may wish to reprogram the two Moteinos.  On the "master" Moteino it will be easy to connect it to my PC with the FTDI cable.  On the "slave" Moteino, I want to be able to leave it in the garage and download a new sketch over a wireless connection.

I understand that if I want to download a sketch over a wireless connection, I need to order the slave Moteino with the 4Mbit flash chip option.  So, my questions:

  • What actually sends the new sketch to the remote Moteino?  Is it the inside "master" Moteino talking to the outside "slaver" Moteino saying "Hey, here is another sketch I want you to start using?"
  • Do I need the 4Mbit flash chip on the inside "master" Moteino or just on the remote "slave" Moteino?
Thanks for any info you can provide to educate this newbe.

Jim Smith
Jim Smith
Dallas, TX

KanyonKris

Your description of how the GarageMote system works is correct.

Quote from: JimSmith on February 15, 2014, 12:06:00 AM
I understand that if I want to download a sketch over a wireless connection, I need to order the slave Moteino with the 4Mbit flash chip option.  So, my questions:

  • What actually sends the new sketch to the remote Moteino?  Is it the inside "master" Moteino talking to the outside "slaver" Moteino saying "Hey, here is another sketch I want you to start using?"
  • Do I need the 4Mbit flash chip on the inside "master" Moteino or just on the remote "slave" Moteino?

(Note: I'm going to use the terms gateway instead of master, and remote instead of slave, because those are the common terms used by Felix and on the forum.)

Felix's examples have the new sketch stored on the Raspberry Pi (or other computer). A Python program sends the new sketch to the gateway Moteino over the FTDI cable a line at a time and each line is immediately transmitted by radio to the remote Moteino which stores the sketch lines in its flash chip. There is some handshaking going on - when the remote Moteino receives a line it sends back an acknowledgement to the gateway to let it know it got the line and is ready for another. After the whole sketch has been received, the bootloader on the remote Moteino transfers the sketch from the flash chip to its internal program storage and reboots to run the new sketch.

You only need the flash chip on Moteinos that will receive a new sketch. The gateway does not need a flash chip. If you have a Moteino without a flash chip you can order a flash chip and solder it on yourself.

Be aware that the GarageMote sketch example does not include wireless programming so you'll have to add it yourself. The good news is, it shouldn't be hard to do. From my very quick look at the GarageMote sketch I think you'll just need to include the wireless programming library and add a call to check for a new sketch being sent in your main loop (probably at the end of the loop), here are the lines:

#include <WirelessHEX69.h>

CheckForWirelessHEX(radio, flash, true);


See this wireless programming example - https://github.com/LowPowerLab/RFM69/blob/master/Examples/WirelessProgramming_node/WirelessProgramming_node.ino

JimSmith

Thanks KanyonKris! 

You cleared up some of my mental static (I have a lot...) concerning the big picture of how this is all going to work.  And thanks for the programming tips too!  I'm looking forward to getting into this project.

Felix, you'll have a new order coming in by tomorrow.
Jim Smith
Dallas, TX