Thursday, March 28, 2013

Upload sketch

Hi, guys!

You asked me to implement sketch upload feature and it's done starting ArduinoCommander v4.2.


With "upload sketch" advanced feature you don't need pc/mac in order to start working with ArduinoCommander. Now you can upload required for Arduino-side "StandardFirmata" sketch right from your android device.




1. FTDI-based (Duemilanove, Diecimila) and ATMega-based (Uno r3) are supported. Mega and Nano boards will be supported as soon as i have them (within a month i believe). I've tested uploading on Duemilanove and Uno r3 boards only, verification is not yet implemented (it will be done if this feature is popular enough).
2. Make sure your android device supports USB Host mode.
3. No root permissions required
4. Use it at your own risk.

Now let's start.

1. Tap "Menu" / "Upload sketch *" menu item:
2. Choose "StandardFirmata (Uno @ 57600) sketch" menu item
3. Plug in USB-OTG cable and external power source if needed (for Uno r3 f.e.)
4. Tap "Discover devices" and choose Arduino board:
5. Tap "Upload" button which becomes enabled after device selection.
You can see uploading progress:
6. See uploading result:
7. Now you can go back to "Connect to device" screen, set baud rate 57600 in app settings and connect to the board.

Try again if you failed to upload sketch.

Bundled and user sketches

Try to upload bundled "Blink" sketch just to check "upload sketch" feature is working for you.
You can also upload any sketch you want - just choose "User sketch (choose file)"
 menu item and choose compiled binary file (*.hex) on your android device. Read "Prepare user sketch" section to prepare user sketch for uploading.

Prepare user sketch

You have to compile binary file (*.hex) on your pc/mac first.

1. Launch Arduino IDE
2. Choose "Arduino" / Preferences menu item:

3. Click on filename (red, underlined):

4. Click "Cancel" button and close Arduino IDE
5. Edit preferences.txt file while Arduino IDE is not running:
add "build.path=path_to_folder" and save file
6. Launch Arduino IDE and open sketch
7. Click "Verify" button:
8. Copy "*.hex" file from build folder to your android device:

Launcher

Now you can use separate launcher for uploading user sketches - "Upload sketch":

Evaluation

"Upload sketch" advanced feature is available for 5 successful uploadings to evaluate.

Troubleshooting

Please contact me if it's not working for you for some reason.




  

8 comments:

  1. Wow... I've thought how the arduinocommander would be awesome with sketch feature. I appreciate the developers for make my imagination come true. Sadly, I still need PC to make ".hex" file. I wonder arduino IDE would be supported in this app. Please leave a reply. (Sorry for my poor English because I'm not a native English user.) :)

    ReplyDelete
    Replies
    1. I've been thinking about sketch compiling feature too. According to the latest opinion poll on this blog it's the second wanted feature.

      The only reason why it's not implemented is that It's pretty difficult feature to implement as it depends on android device arch (arm, x86) and requires compiler for AVR. I've found few similar project of porting Arduino IDE to Android and all them seem to be failed.

      So at this time it's preferred to use cloud IDE like Codebender (http://codebender.cc) to compile sketches though i still thinking about how to do this. Anyway i think that it should be stand-alone android app which is able to interact with 3rd party apps like ArduinoCommander to perform compile jobs.

      If you have any thoughts about it, let me know.

      Delete
    2. The upload sketch features works very well for the baked in sketches (I haven't tried external .hex files yet) on my TF700T. I'm down to 3 uploads left... ;-)

      I remember reading on the Arduino forum at one point that in their opinion the biggest block to getting some sort of ArduinoIDE type interface was porting avrdude to Android. Looks like you have a good solution.

      As far as compiling for Arduino, I wonder if it wouldn't be a good idea to work with the developers of the existing gcc compilers already on GooglePlay (two that I saw right away are "Terminal IDE" and "C4Droid") and work with them to add Arduino as a target for their compilers as well as some automated make support for the associated cpp/h Arduino libraries.

      Then provide Android hooks (intents?) in Commander to allow the sketch binary upload feature to catch an Android "Send To..." share event.

      Just throwing ideas out in to the ether in case something sticks.

      Delete
    3. Good idea, totally agree with you. I'm working over it and it seems to be pretty difficult, but not impossible.. I believe i have to spend a couple of weeks in order to define how difficult it is actually and decide if it will be implemented or not. Stay tuned

      Delete
  2. I have been looking into avr-gcc and avrlibc avrdude on the Asus tf201 trying with out root atm on the Sd to achieve a simple ish compile . Your coding knowledge is far better than mine, keep up the excellent work

    ReplyDelete
    Replies
    1. Thank you for suggestion! I will take a look.

      Delete
  3. Great job, maby you can do upload skech via bluetooth compability in next version, and arduino pro mini programing will be great to. Amazing job good luck.

    ReplyDelete