Introduction: APDuinOS (Flashing) -- Arduino IoT (internet of Things) -- Aquaponic Application

Picture of APDuinOS (Flashing) -- Arduino IoT (internet of Things) -- Aquaponic Application

If you are reading this Instructable you are here for one of two reasons.

FIRST REASON:
Is because you know nothing about APDuinOS and interested in what it is and how it relates IoT (Internet of Things).  You can learn more about APDuino by going to http://www.apduino.org  or http://www.apduino.com for more detailed information regarding this product. In general it is a IoT developed application for aquaponics and hydroponics systems.  It has functionality as a environmental monitoring software as well.  It will also allow you to control and interact with your physical world using sensor inputs to trigger actions through an Arduino™ and/or Raspberry Pi®

SECOND REASON:
This reason is why I have written this Instructable.  It is because I am a non-technical person that wants to test and play with this concept of controlling my aquaponic units without having to be a software or firmware engineer to be effective in control of them.  This direction should allow for getting the systems I build on to the internet and control them with minimum effort, but have total control of any number of sensors and what they interact with and allow for data collection and display .

I still do not fully understand all that is going on with this application, but at least writing this instructable and being able to refer back to it as a guide will help me to duplicate this process as many times as I need to in the future.



Step 1: What Is Needed --

Picture of What Is Needed --

COMPUTER:
You will need a computer of some type.  It is my understanding that APDuino can be used with Windows, Apple and Linux machines.  I only work with Windows machines and currently working with Windows 7 on a laptop.  I know nothing about Apple or Linux machines.  So this instructable might not be able to help everyone, but the concepts and steps should give you a good idea of what is needed for non-Windows machines.  How you do it, I have no idea.


SOFTWARE:
Arduino IDE 1.X
Windows Command Prompt


HARDWARE:
Arduino Mega2560
Arduino Ethernet shield with data logging function
SD card


FILES:
avrdude
avrdude.conf
apduinos-headless.hex  -  downloaded from APDuino.org


OTHER:
Ethernet connection
USB cable

Step 2: Which Option?

Picture of Which Option?

The APDuino user guild list 3 options to accomplish getting the APDuinOS on to your arduino.

You can find the reference here:
http://apduino.org/projects/apduinos/wiki/Flashing_APDuinOS

Flashing APDuinOS
you can get a flashable APDuinOS binary in various means:

    1.  get a pre-built version of APDuinOS (headless only, currently)
    2.  get the library and build the demo app
    3.  get the library and develop your own APDuinOS-based app

OPTION 1:
This is the option that this Inscrutable is developed for.

OPTION 2:
you would need to be an arduino expert or software engineer to pursue this option. 

OPTION 3:
you would need to be an arduino expert or software engineer to pursue this option.

Step 3: SOFTWARE -- That You Will Need to Use

Picture of SOFTWARE -- That You Will Need to Use
Arduino 1.x software:
You will need to have version 1.x Arduino IDE installed and running on you computer.

Arduino 1.x relates to the version of the IDE you are running on your computer.  In this Instructable I will be using arduino-1.0.3 version.  There are later versions that are downloadable and used by a larger number of people.  You should know which version you are running by looking at the directory it is installed in.

If you need help to download and install version 1 Arduino IDE here is a reference that can help you:
http://arduino.cc/en/Guide/HomePage

WINDOWS COMMAND PROMPT:  (see picture 2 as to what this looks like)
In order to "FLASH" your arduino board you will need to use this software to make the loading of the binary hex file possible.

There is one of two ways to find "Windows Command Prompt" software on your computer.

FIRST WAY:
Use Windows "RUN" function window.  To get there you will need to click on windows ICON in the start area, then select  "ALL PROGRAMS", then select  "ACCESSORIES" menu option.  Next select the "RUN" option.  A "RUN" window will open -- Type "cmd"
in the "OPEN" box  and click "OK" and the command prompt window will open.

HERE IS A VISUAL OF THE ACTIONS:
http://youtu.be/ViV4JMIb-6M



SECOND WAY:
Use  "COMMAND PROMPT ICON" selection option.  To use it you will need to click on windows ICON in the start area, then select  "ALL PROGRAMS", then select  "ACCESSORIES" menu option.  Next select the "COMMAND PROMPT" option.  The Command Prompt window will open and you are all set.

HERE IS A VISUAL OF THE ACTIONS:
http://youtu.be/UKVZvTaWV8g





Step 4: Hardware -- That Will Be Needed to Use APDuinoOS

Picture of Hardware --  That Will Be Needed to Use APDuinoOS

Arduino Mega2560:
This is one of the core components for setting up your APDuino API.

I have gone with an official Arduino Board to insure a successful outcome for this learning experience.  I have found I need to minimize as many variables as possible when working with new technology.  It makes it a lot easier to trouble shoot problems when I know I am working with standard components.

Here is the arduino board being used in this instructable:  (as viewed in picture 2 of this set)
http://www.amazon.com/Arduino-MEGA-2560-R3/dp/B006H0DWZW



Arduino Ethernet shield with data logging function:
This is one of the other core component for setting up your APDuino API.

I again have gone with an official Arduino Board to insure a successful outcome for this learning experience for the same reasons as above.

Here is the arduino board being used in this instructable:  (as viewed in picture 4 of this set)
http://www.amazon.com/Arduino-Ethernet-Shield-R3/dp/B006UT97FE


SD card:
I decided to go with 16GB micro SD card as it was a good value with should be enough space until I figure out how much storage will really be needed once I go fully operational with a larger scale system.  It can be viewed in picture 3 of the picture set.

http://www.amazon.com/Sandisk-16GB-MicroSDHC-Memory-Class/dp/B001F7AJKI

Step 5: Files Needed --

Picture of Files  Needed  --

In order  to accomplish the task of flashing your arduino with the APDuinOS 3 files are required and used.

Here is a discussion of them and what there function is in this process.


avrdude:
This is the file that is responsible for uploading of APDuinOS to your arduino mega2560.

This file is installed when Arduino IDE is installed.  You need to verify that the file is in fact installed (see picture 2 in the picture set).  If not, you will get an error message when you attempt to upload the APDuinOS file .  Should "avrdude" not be found uninstall Arduino IDE and reinstall until "avrdude" can be verified in the correct sub-directory.

If you want to learn more about "avr" in general here is a link with more technical details and a tutorial about this type file.
http://www.ladyada.net/learn/avr/


avrdude.conf:
This file contains configuration data used by AVRDUDE which describes the (chip) programming hardware pinouts and also provides part definitions.

AVRDUDE's "-C" command line option specifies the location of the configuration file.

The "-c" option names the programmer  configuration which must match one of the entry's "id" parameter.

The "-p" option identifies which part AVRDUDE is going to be programming and must match one of the parts' "id" parameter.
(source: avrdude.conf)


This file is also installed when Arduino IDE is installed, but in a different sub-directory than "avrdude".  You need to verify that the file is in fact installed (see picture 3 in the picture set).  If not, you will get an error message when you attempt to upload the APDuinOS.   Should "avrdude.conf" not be found uninstall Arduino IDE and reinstall until "avrdudeconf" can be verified in the correct sub-directory.


apduinos-headless.hex  -  downloaded from APDuino.org
The most current apduinos hex file needs to be downloaded to your computer.

This file once downloaded is the file that contains the hex code that will be uploaded to the Arduino Mega2560 and allows the arduino to interact with the APDuino API.

It can be downloaded here:
http://apduino.com/firmwares?search[platform_like]=Arduino

Once downloaded "apduinos-headless.hex" needs to be located in the same sub-directory as "avrdude"
(see picture 4 in the picture set).

Step 6: OTHER ITEMS REQURIED

Picture of OTHER ITEMS REQURIED

Ethernet Cable or Wireless connection:
In order to download "apduino-headless.hex"  you will need a internet connection.  But everyone knows this, but just had to cover it in case there are people that are very new to all this.

USB Cable:
Will need a A type to B type to connect computer to the arduino.

Step 7: Working With "COMMAND PROMPT" -- If You Need Help

Picture of Working With "COMMAND PROMPT"  -- If You Need Help

For me this has been the hardest part of the whole project.  I have worked with command prompt way back in the past and was able to get around just OK.  There is no way around flashing the arduino mega2560 without using command prompt.  So if you know how to get around with a C:> you can skip this section of the instructable.

Here is a resource for learning or refreshing your command prompt skills:
http://www.youtube.com/watch?v=7Mu9ZxUHa-w

Here are some additional resources for helping with "Command Prompt"
http://www.guidingtech.com/12909/brilliant-command-prompt-cmd-tricks/

http://www.howtogeek.com/howto/25590/how-to-enable-ctrlv-for-pasting-in-the-windows-command-prompt/


I have found the biggest help in using command prompt is knowing what it is you want to do and where you want to be on your computer.  Just take your time and concentrate on where the files you need are located and work to get there.  Once there you can accomplish your task.

In my case I need to get to where I have my "avrdude" file to start.

Here is the path command I will have to use to get to the correct directory holding the "avrdude" file.  Again my directory could be installed differently than where yours is, so make sure you know how you installed your  Arduino IDE application.

Here is the path I need to use:
C:>Program Files\arduino-1.0.3\hardware\tools\avr\bin:>





Step 8: "-cwiring" VS "-cstk500v2"

Picture of "-cwiring"   VS  "-cstk500v2"

Things change almost daily in the technical world.  What worked one day might not work the next time you start it up.  Versions change, systems requirement change, hardware upgrades.  Almost anything at anytime.  So as things change so do the commands we use to get things to load-up.

It is important to read the on-line documentation in the user guide for all the latest updates and follow the instructions and keep trying until you get it right.  Make sure you contact tech support at APDuino should anything not work the way the documentation talks about.  APDuino's founder is very interested in knowing how to improve and make things better.  So let them know issues you encounter.  They will work to resolve any and all issues for you.

Here are the current notes as of this writing about differences in versions of Arduino IDE and changes needed to be tried if things don't work at first for your version of Windows or Arduino IDE.

UPDATE: recent feedback is that using Arduino IDE 1.0.2 on Windows 7, the "-cwiring" instead of "-cstk500v2" was leading to successful upload...


Link to apduinos flashing documentation:
http://apduino.org/projects/apduinos/wiki/Flashing_APDuinOS

Going forward with Windows 8 and new Arduino IDE releases things will require new an different solutions.


SCENARIOS - to use
These scenarios will be dependent on the version of Arduino IDE that is being used and what Directory  you installed the program files in.


SCENARIO ONE:
Using "-cstk500v2"
Work with this one first then move to next one if not successful. Mine looks like this, but your PATH could be different.

It is important that all spaces, quotes and special characters are all correct in the string.  The string has been cut due to  formatting issues with this instructable, but it should be one continuous input string when done in "Command Prompt" window :

SHOULD LOOK LIKE THIS:
C:\Program Files\arduino-1.0.3\hardware\tools\avr\bin\avrdude -patmega2560 -cstk500v2 "-P\\.\COM3" -b115200 -Uflash:w:apduinos-headless.hex:a "-CC:\Program Files\arduino-1.0.3\hardware\tools\avr\etc\avrdude.conf"



SCENARIO TWO:
Using  “–cwiring”
feedback has been to use "-cwiring" with Arduino IDE 1.0.2  and higher on Windows 7.

Move to this scenario if using “-cstk500v2” was not successful for you. Mine looks like this, but your PATH could be different.

It is important that all spaces, quotes and special characters are all correct in the string.  The string has been cut due to  formatting issues with this instructable, but it should be one continuous input string when done in "Command Prompt" window :

SHOULD LOOK LIKE THIS:
C:\Program Files\arduino-1.0.3\hardware\tools\avr\bin\avrdude -patmega2560 -cwiring "-P\\.\COM3" -b115200 -Uflash:w:apduinos-headless.hex:a "-CC:\Program Files\arduino-1.0.3\hardware\tools\avr\etc\avrdude.conf"

Step 9: MAKING IT ALL HAPPEN NOW --

Picture of MAKING IT ALL HAPPEN NOW --

This is the step that it all comes together and we actually make it happen.  You can visit SECTION 11 to see what a successful up-load looks like.
 

STEP 1:

Connect up your arduino Mega2560 to your computer with a USB Type A to Type B cable.


STEP 2:
If you have not already installed Arduino IDE 1.x and configured the board and COM port do so now. 

Start up your Arduino IDE



STEP 3:
Verify  you have downloaded the most current HEX file and your "avrdude" file and "avrdude.conf" are located in the correct sub-directory's. (as talked about in SECTION 5 of this Instructable.



STEP 4:
Open "COMMAND PROMPT" window. 

See SECTION 7 for details on how to accomplish this task, if you are unsure or don't know how.



STEP 5:
In "COMMAND PROMPT" window enter the command string needed to load-up the APDuinOS.

Start with Scenario One then move to Scenario Two should it not work for you. 

Should you encounter "ERROR" message check for missing charters or mistakes in your command string.  If correct and it does not work then move to scenario two and try it.  Should it not work and you are sure you entered it correctly then contact tech support at APDuino for help.

View SECTION 8 in this Instructable for details if you need help with this step.

Scenario One:
C:\Program Files\arduino-1.0.3\hardware\tools\avr\bin\avrdude -patmega2560 -cstk500v2 "-P\\.\COM3" -b115200 -Uflash:w:apduinos-headless.hex:a "-CC:\Program Files\arduino-1.0.3\hardware\tools\avr\etc\avrdude.conf"

Scenario Two:
C:\Program Files\arduino-1.0.3\hardware\tools\avr\bin\avrdude -patmega2560 -cwiring "-P\\.\COM3" -b115200 -Uflash:w:apduinos-headless.hex:a "-CC:\Program Files\arduino-1.0.3\hardware\tools\avr\etc\avrdude.conf"

Once done make sure you press "ENTER" key to kick the command off.


STEP 6:
If Errors are encountered double check your command and try again.  I made many mistakes before I got it right.  When it is right it will work.


STEP 7:
arduino-headless.hex file loads up on your Arduino2560 board.  There will be a number of things taking place in the command prompt window and this process can take a few minutes to get done.  So be patient with the process and wait until completed and you will be done.


STEP 8:
You are done.  You can now close everything down and move on to connecting to ADPuino via the internet.

Step 10: ERROR -- It Happens a Lot Using "COMMAND PROMPT" - for Me at Least

Picture of ERROR --  It Happens a Lot Using "COMMAND PROMPT" - for Me at Least

In this section I wanted to document ERRORS that I encountered during this process.  I even created some ERRORS just to learn what they would look like so when I flash additional arduino's in the future I will be able to refer back  to this Instructable as reference and not have to re-learn the same mistakes I had made.
 
CASE1:
It is suggested in the USER GUIDE for APDuinOS flashing to start using "-cstk500v2" but with versions of Arduino IDE 1.0.2 or higher and in combiniation with Windows 7 "-cstk500v2" might not work.  Well the question I had was that if it did not work what would that look like.  Well, I documented in CASE 1 what it looked like for future reference.

CASE 2:
I was wondering what an ERROR would look like if there was a problem with the USB cable or a connection problem.  So I created this situation so I would have documentation of this going forward.


CASE 3:
In this case it looked as if the command string was going to work.  Then a mistake was found in the string.  I had entered  "-Uflashing" instead of  "-Uflash". You can view the output in the CASE 3 picture.  It just shows you that care is needed to get the command string correct.

CASE 4:
Two mistakes were made in the command strings.  See if you can find the mistakes.  This will demonstrate what you will be dealing with in working out errors on your own.  This will give you a good feel as to where to look and how to correct mistake in command strings and the errors that  get displayed.  You really can not hurt any of your equipment, so just keep working at getting it right and you win out and be able to move on to the next phase of connecting up your sensors and controllers.
 

Step 11: SUCCESS -- What Does It Look Like

Picture of SUCCESS  -- What Does It Look Like
If you are here then you are interested in learning what happens when you are Successful in loading-up APDuinOS on to your Arduino MEGA2560 and Ethernet Shield and what that looks like.

You are at the right spot to validate that in fact this does work when you get the command string correct.


COMMAND PROMPT --  success




Watch this to view what is taking place on the actual arduino set-up:
http://youtu.be/gKyB_bsP8-c

Comments

jml2009 (author)2013-09-09

It seem I can only download the file: apduino-node.hex. All the apduino-headless seem to be ''not available to download'' . What should I try? By the way, very nice instructable:P

rik (author)jml20092013-09-09

@jml2009 -- with the last update the file changed. apduino-headless is no longer being used. the new version gives much more features and cleans up some outstanding issues that needed to be addressed. Check apduino.org for full details.

beic (author)rik2016-03-02

apduino.org says...

Forbidden

You don't have permission to access / on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

midnightcow (author)2015-04-13

Hi, rik.

It's so cool instructables.

I'm intrested in your instructable. I'm a Wiznet engineer. WIZnet provides the W5100 Ethernet chip to Arduino Ethernet shield. Can I introduce your instructable on my blog & WIZnet museum(http://wiznetmuseum.com/)?

Thank you in advance!!!

About This Instructable

15,265views

32favorites

License:

More by rik:RUNNING Arduino IDE on RPi @ 800 X 480 Resolution800 X 480 - 5" HDMI Display - Using Jessie With Pixel -  Resolution Issueaquaponic BALCONY GARDEN
Add instructable to: