Pages: [1] 2   Go Down
Author Topic: Can a Arduino board simply be used to program?  (Read 1516 times)
0 Members and 1 Guest are viewing this topic.
Dallas
Offline Offline
Sr. Member
****
Karma: 3
Posts: 337
nephew as a kittens
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is my first foray into uC. I'm a total noob at digital electronics, but I have several projects that I can't do practically with analog circuits. I'm not even sure if I should be going Arduino. I installed the Arduino IDE from the Ubuntu repositories and I even wrote a simple program. I only know about programming what I remember from my college Java class, but I was able to look at the examples and understand a good bit, which is exciting. But anyway, now I need an Arduino board so I can see if my LED flashing program works (a textbook example of an open-source business model btw). I have nothing that has a serial port, so I had looked at buying a Duemilanove board.

Here's my core issue with buying a Duemilanove board. It seems like the board+chip are designed to be embedded in the user's robot/project/doomsday machine, and the board itself wired to the project. This would be awesome for a robot, but that's not why I'm learning about uC. For most of the projects that I want to use uC for (photographic light-meter, "disposable" model rocket stuff, electronic paintball gun, underwater temperature sensors, simple detection and logic circuits for farm equipment, replacing failed circuit boards in simple appliances, home automation etc.), the Duemilanove either will not fit the space, or it will not be economical. For these applications I had envisioned more of a uC soldered to a small piece of perfboard with whatever minor components (xtal, cap, power jack), with leads going to the transducers.

So my question is, after I write my program to the Arduino board+uC, can I then just remove the uC and place it in my properly-wired embedded application, effectively just using the Duemilanove board and Arduino IDE as a uC programmer, and convenient prototyper? Then I can just buy chips, stick them in the Duemilanove, flash the bootloader on there, write my program to the chip, and then cram the uC IC into my much-smaller-and-cheaper perfboard?

This probably falls under the category of a stupid question but I want to make sure I'm understanding this all before I actually place my order.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Not a stupid question at all. Many user use their system as you in visioned, development on a full blown Arduino board and then moving the AVR chip to a permanent application. The only support a AVR chip needs in it's final application is a 16mhz crystal/caps or resonator and a pull up resistor for the reset pin. Several vendors sell application boards, some including serial downloading capabilities or not and with various DC power options. Here is one I recently obtained that has just the bare minimum needed to run, plus I can down load to it using a hardware programmer using the ICSP pins provided:

http://store.fundamentallogic.com/ecom/index.php?main_page=product_info&cPath=15&products_id=29

Lefty
Logged

Dallas
Offline Offline
Sr. Member
****
Karma: 3
Posts: 337
nephew as a kittens
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for the info. I will go ahead and buy a Duemilanove and start hacking. Is it against the rules to ask who has the best price and service? Seems like a lot of places selling the Duemilanove online, and most seem to be around $30.
« Last Edit: April 01, 2009, 10:16:09 pm by BetterSense » Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The first project I built I did exactly what you are suggesting. I prototyped the project using my Freeduino and a breadboard. Then I purchased a Atmega168 w/ bootloader popped it into the Freeduino to program it and then popped it into a socket on my project board.

It works but making programming changes is slow.

What I've done since then is to buy a USBtinyISP from Adafruit. Now I can add the 6 pin ISP header to my project board and make programming changes without removing the Atmega168 from my project. I still use my Freeduino for prototyping but the ISP makes it easier to create standalone projects.

There are also Arduino runtime boards which let you put together a Atmega168 chip with the minimum number of components you need to add a Arduino to a project. There are several out there but this is one that I've used and it works well.

http://www.nkcelectronics.com/arduino-runtime-board-rev-b-10.html

I program these using the USBtinyISP although it is also possible to buy a USB to serial adapter which lets you program them exactly like a Arduino.

Hope this helps.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well I tend to have spread my money around and have purchased from many Arduino clone or compatible firms and so far have had nothing but satisfactory experiences. I also frequent E-bay as several vendors sell ARduino stuff there.

Being open sourced based the prices seem to be very competitive, I don't think anyone is making a great margin as it would tend to be pretty obvious. And quality does not seem to suffer in spite of the many competitive vendors, in my opinion.

I will have to admit that I've been spending more and more $$$ at the Sparkfun site lately then I probably should, but they carry such interesting items, document what they sell well, lots of data sheets, application notes, etc. Their site is fun to search through and they usually suck me into buying something.

http://www.sparkfun.com/commerce/categories.php

Lefty

« Last Edit: April 01, 2009, 11:01:08 pm by retrolefty » Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I will go ahead and buy a Duemilanove and start hacking. Is it against the rules to ask who has the best price and service?
It looks like nkcelectronics still has the duemilanove on sale for $22:
http://www.nkcelectronics.com/arduino-duemilanove-with-atmega168-22-prom16822.html

They also sell low cost runtime boards so have a look around their site for other things you may want.
Logged

0
Offline Offline
Faraday Member
**
Karma: 8
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I too use my arduino as a development platform and build custom flight hardware based on that.  Works great. I'll second the suggestion to use a programmer to burn the sketch on the custom hardware - much easier tan swapping ICs.

There is also the mini series arduino, which is much smaller. I'm thinking of playing with one of those both to see if embedding the mini in the flight hardware is effective space-wise, and to see if some "mini shield" designs might be useful.

-j

Logged

USA
Offline Offline
Sr. Member
****
Karma: 0
Posts: 452
Freeduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
It looks like nkcelectronics still has the duemilanove on sale for $22:
http://www.nkcelectronics.com/arduino-duemilanove-with-atmega168-22-prom16822.ht...
The promotion is over, but I am leaving the product information page so customs all over the world can verify the price (like the case of nachtwind in forum posting http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1238493307)
Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

To avoid confusion, I suggest you add some text to the web page to say that the promotion is over.
http://www.nkcelectronics.com/arduino-duemilanove-with-atmega168-22-prom16822.html
Logged

Keynsham, UK
Offline Offline
Full Member
***
Karma: 0
Posts: 224
I like for loops and walks on the beach,
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So my question is, after I write my program to the Arduino board+uC, can I then just remove the uC and place it in my properly-wired embedded application, effectively just using the Duemilanove board and Arduino IDE as a uC programmer, and convenient prototyper?

This is a good idea that alot of people use. I have recently developed my A-Level electronics project with Aruduino. I used the board to prototype the major parts of the circuit e.g. LCD Screen, Joystick and button interface.

I then created a PCB with all the neccessary components and programmed the ATMega chip in the Duemilanove. This was a very simple plan.
Logged

"C++ : Where friends have access to your private members." - Gavin Russell Baker

UK
Offline Offline
Sr. Member
****
Karma: 1
Posts: 491
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
This is a good idea that alot of people use. I have recently developed my [glow]A-Level electronics[/glow] project with Aruduino. I used the board to prototype the major parts of the circuit e.g. LCD Screen, Joystick and button interface.

I then created a PCB with all the neccessary components and programmed the ATMega chip in the Duemilanove. This was a very simple plan.

I'm relieved to hear not all qualifications are being dumbed down! That probably would have been university level stuff a while ago.

Andrew
« Last Edit: April 02, 2009, 10:16:15 am by Andrew » Logged

Keynsham, UK
Offline Offline
Full Member
***
Karma: 0
Posts: 224
I like for loops and walks on the beach,
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, my teacher said that he hasn't such a project in his (very long) career. Compared to my friends' projects it could be deemed almost an A-Level project; certainly the leaving it to the last minute element!

 ;D

/me
Logged

"C++ : Where friends have access to your private members." - Gavin Russell Baker

Dallas
Offline Offline
Sr. Member
****
Karma: 3
Posts: 337
nephew as a kittens
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, I purchased a Duemilanove.

Since it's my thread and I'll hijack it if I want to, I now have a programming question. I've been reading the docs to learn about the various methods, but I have some questions about the arduino language itself.

1. what, precisely, is a "sketch"?

2.In java-land, you can create a lot of different classes with a lot of different methods. Then as long as you only have one main() method, all the classes can magically talk to each other and use each other's method's and stuff. You save a lot of copypasta this way.

I don't have a board so it might become clear when I do. But when I open Arduino and type my program in, I can save it (a 'sketch' I guess) in my sketchbook. But can I create other sketches and have them be their own sub-routines the way I did in java? Or should my entire uC program fit in one arduino sketch?

In arduino, there is this setup() and loop() phenomenon. It seems like the example progams, basically everything has an setup() method and a loop() method but I don't know why or what that means for my programs. It might be that upon startup, the uC just runs setup(), then runs loop(), period, and it's as simple as that, but if I have multiple programs, all with setup() and loop() methods, well that can't work.
« Last Edit: April 02, 2009, 11:26:31 am by BetterSense » Logged

0
Offline Offline
God Member
*****
Karma: 2
Posts: 854
Arduino rocks!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
1. what, precisely, is a "sketch"?

Just a firmware program for the Arduino.

Quote
But can I create other sketches and have them be their own sub-routines the way I did in java? Or should my entire uC program fit in one arduino sketch?

Arduino is C++, you can have external files with functions/classes just as you would in C++.

Quote
In arduino, there is this setup() and loop() phenomenon.

The way the Arduino language is set up, it has an implicit main function like:

main()
{
 setup();
 while (1 == 1)
 {
   loop();
 }
}

I suspect they set it up this way to be simpler for new users who might not quite understand that the mcu is always running its microcode.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

* A sketch is just the name used for the user written application program. That program when compiling may link to other library functions if desired.

* I don't talk Java (drink a lot though) so can't answer that one.

* Each sketch you develop can be saved in a folder for future use and is available to be downloaded to the Arduino board, and is completly independent to any other sketch you may have completed. You can't directly link or call functions from one sketch from another, however you can develop your own library functions that can be linked when a new sketch is being compiled. Only one sketch can be downloaded to the Arduino board at any given time.

* Startup and loop sections in a sketch are available to separate things that only have to happen once as in a initialization phase or things that will run continuously under the programs direction. Either section can be left empty although it would make no sense to have them both empty  smiley-wink

Hope that helps somewhat, I'm more comfortable talking the hardware side then the softy side.

Lefty
Logged

Pages: [1] 2   Go Up
Jump to: