Embedded C programming using AVR Studio on Arduino Boards

For those of you who have an Arduino development board and wanted to code in embedded c and upload your code on the board, this is the right post.

For starters you need to download following components:
1. Arduino IDE Download Link
2. AVR Studio Download Link or AVRDUDE download

We shall be using AVRDUDE utility for burning our programs onto the micro-controller.

Once you’ve installed above programs. We can begin the setup of AVR studio using AVRDUDE for burning our programs.

First you must locate following two files:

  1.  avrdude.exe : If you have installed Arduino IDE then a sample path for this file is as follows. C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude.exe
  2.  avrdude.conf : Similarly for Arduino IDE installation the path is as follows. C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf

If you are using AVRDUDE direct download, then these files shall be in the avrdude installation folder. example: C:\avrdude\avrdude.exe and C:\avrdude\avrdude.conf

We shall require both of these paths in the subsequent steps, so kindly ensure you’ve copied these two paths and kept it somewhere.

Next step is detecting which COM port your arduino board uses.

devicemanager

In my case the port used by the Arduino Board is COM3. Keep this information with you.

Now the AVRDUDE arguments is as follows:

  1. Arguments for Arduino Mega 2560
    -v -patmega2560 -cwiring -P COM3 -b115200 -D -Uflash:w:"$(ProjectDir)Debug\$(TargetName).hex":i -C"C:\avrdude\avrdude.conf"
  2. Arguments for Arduino UNO
    -v -patmega328p -carduino -P COM3 -b115200 -D -Uflash:w:"$(ProjectDir)Debug\$(TargetName).hex":i -C"C:\avrdude\avrdude.conf"

I shall explain few important command line options used in above commands. The detailed explanation for all the options is given in following documentation.
options
Now that we understand about the commands that shall be used, we can proceed with the creation of AVR Studio programmer.

avrstudioprogrammer

Steps:

  1. Open AVR Studio.
  2. Under tools select external tools.
  3. Press add.
  4. Name your programmer in the Title field.
  5. Paste the appropriate arguments in the Arguments field.
  6. Paste the avrdude.exe file path without the quotation marks in the Command field.
  7. Check the ‘Use Output window’ box.
  8. Press OK.

Now you have your programmer available in the tools menu above the external tools sub-menu.

You can upload a LED blinking program to your board to check whether everything is working.

Steps for testing

  1. Create a new GCC executable project
  2. Make your main.c file
  3. Build the project so that the hex file is generated
  4. Go to Arduino Programmer in the tools menu and click on it
  5. You should get an output window

If everything works you will have the hello world blinking LED.

Hope you liked the post. If you found it useful, please like and share! Remember sharing is caring 🙂

Advertisements

Patient Monitoring Smart Wheelchair

As part of my final year project our team chose the topic as Patient Monitoring Smart Wheelchair. We wanted to make something for the society. As a part of one of my earlier projects Improving Infrastructure for specially challenged citizens in Vashi we had conducted a survey. We found out that the existing infrastructure in Vashi(Navi Mumbai, India) is not at all disabled friendly and same is the situation in majority of India. On top of that the modern assistive technology is too expensive for the common man or aam aadmi.

proportion of diabled population

Above figure shows the percentage of disabled population to total population in India as per 2011 census. In states like Maharashtra, Andhra Pradesh etc. the percentage is very high.

type of disability

Above figure shows the proportion of disabled population by type of disability. We can see that disability in movement accounts for 20.3 % and multiple disability 7.9%. This led us to the idea of making a smart wheelchair.

rural vs urban

This shows that a major chunk of the disabled population lives in rural India. Our market analysis led us to the finding that all the modern electric wheelchairs available in the market have outrageous price tags.

market analysis

So we decided that our wheelchair would be affordable. Then depending on the analysis of disabilities we found out which all modes should be incorporated into this smart wheelchair.

The modes selected are :

  • Voice control mode
  • Gesture control mode
  • Joystick control mode

Patient monitoring was thought of as an added service. Initially the plan was to measure heart rate, body temperature and blood pressure. But due to time constraints we limited to just measuring body temperature and displaying it on a LCD.

Here is a short video of the completed project.

The bill of materials is as follows.

bom

As you can see we achieved the cost reduction. So that is all from my side in this post. Thank you for patiently reading this and reaching till the end. If you people want a post about the technical details I will require at least 10 Word press likes Winking smile. Share with as many as you can. Maybe someone will take this idea to the next level. Thank you once again for reading this post.

 

P.S: I just felt like sharing this news article with you all.

http://economictimes.indiatimes.com/news/politics-and-nation/government-set-to-bring-private-sector-under-the-new-disability-legislation/articleshow/48780998.cms