Maker Pro
Maker Pro

Arduino vs raw PIC, Atmel etc

Old Steve

Jul 23, 2015
734
Joined
Jul 23, 2015
Messages
734
So, I thought I'd ask a question, for a change.
Everywhere I look, I see Arduino, Arduino, Arduino.

What are the advantages of Arduino vs simply using a PIC or similar chip, with the appropriate extra components?
Easier to code for? Cheaper? Definitely not smaller.

And are they really viable for production devices? Or is the idea to develop with Arduino, then swap to a micro chip without all the extra unused stuff?
Every time I see an Arduino, I'm reminded of the old Basic Stamp.
 

rickselectricalprojects

Feb 1, 2015
118
Joined
Feb 1, 2015
Messages
118
arduino is a lot easier to use. arduino is a development board that has an atmega 328 (if its the arduino uno. the arduino mega has a atmega 2560 i think) arduino is more designed for hobbyists.
 

Old Steve

Jul 23, 2015
734
Joined
Jul 23, 2015
Messages
734
arduino is a lot easier to use. arduino is a development board that has an atmega 328 (if its the arduino uno. the arduino mega has a atmega 2560 i think) arduino is more designed for hobbyists.
Thanks Rick, that's what I thought.
So they're useful for developing an idea, then swapping to the atmega chip for production?
No language problems?
ie Can code developed for the Arduino be directly programmed into an atmega without alterations?
 

rickselectricalprojects

Feb 1, 2015
118
Joined
Feb 1, 2015
Messages
118
Thanks Rick, that's what I thought.
So they're useful for developing an idea, then swapping to the atmega chip for production?
No language problems?
ie Can code developed for the Arduino be directly programmed into an atmega without alterations?
what i would do is get a atmega 328, burn the arduino code on it s it can read arduino and then program it for what you want to do. it is a lot cheaper and easier than getting an avr dragon or a pickit 3:)
 

Old Steve

Jul 23, 2015
734
Joined
Jul 23, 2015
Messages
734
Ah, right, so the Arduino language is an interpreted language? (As opposed to a compiled language.)
 

rickselectricalprojects

Feb 1, 2015
118
Joined
Feb 1, 2015
Messages
118
Ah, right, so the Arduino language is an interpreted language? (As opposed to a compiled language.)
no its complied. the arduino website says: "In fact, you already are; the Arduino language is merely a set of C/C++ functions that can be called from your code. Your sketch undergoes minor changes (e.g. automatic generation of function prototypes) and then is passed directly to a C/C++ compiler (avr-g++)."
you can program the arduino language into a chip using an arduino and the arduino IDE.
 

Old Steve

Jul 23, 2015
734
Joined
Jul 23, 2015
Messages
734
no its complied. the arduino website says: "In fact, you already are; the Arduino language is merely a set of C/C++ functions that can be called from your code. Your sketch undergoes minor changes (e.g. automatic generation of function prototypes) and then is passed directly to a C/C++ compiler (avr-g++)."
you can program the arduino language into a chip using an arduino and the arduino IDE.
Thanks Rick, I appreciate the info. Good to hear that there's no loss of speed in that regard, unlike the old Basic Stamps and their tokenised, interpreted language.
Gotta get used to this new term 'sketch', too. I had to look it up yesterday.
 

rickselectricalprojects

Feb 1, 2015
118
Joined
Feb 1, 2015
Messages
118
Thanks Rick, I appreciate the info. Good to hear that there's no loss of speed in that regard, unlike the old Basic Stamps and their tokenised, interpreted language.
Gotta get used to this new term 'sketch', too. I had to look it up yesterday.
no problem:)
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
@Old Steve Hey, welcome to the forums! It's good to see another "seasoned veteran" responding here. Also, now that the beard is gone, would you please post another profile picture? I used to shave my beard off once each year, just so I could see who was hiding under there. I can't remember the last time I did that. My wife loves my curly whiskers.
 

Old Steve

Jul 23, 2015
734
Joined
Jul 23, 2015
Messages
734
@Old Steve Hey, welcome to the forums! It's good to see another "seasoned veteran" responding here. Also, now that the beard is gone, would you please post another profile picture? I used to shave my beard off once each year, just so I could see who was hiding under there. I can't remember the last time I did that. My wife loves my curly whiskers.
Thank you for the welcome hevans1944. I'm already addicted to these forums. Great place.
And yes, I'll replace my profile pic when I get a chance. I still have the moustache, I've had that since my early 20s, but the beard was just a trial over Winter. More trouble than it was worth to take care of though, and it kept getting in the way, so out with the shaver.
 

Old Steve

Jul 23, 2015
734
Joined
Jul 23, 2015
Messages
734
I've been doing a little bit of reading since starting this thread.

So, if I buy an Arduino UNO, with a through-hole atmega328(p) rather than SMD, can I program up the chip, tear it out and put it on a custom PCB for a production project? I assume this bit will work.

Then can I just insert another completely empty ATMega328P into the Arduino board and program it, or do I need to buy chips with the bootloader already programmed into them. ie Does the Arduino software on the PC program in the bootloader?
I've never used a bootloader before, so am a bit unclear on this point, so can someone please help with outlining the basic process?

(It looks like I'll have to get into Arduino - there's a reasonably complicated Arduino library that I'll need to use shortly, and I don't want to go through the process of trying to rewrite/port it to a PIC.)

TIA,
Steve
 
Last edited:

Old Steve

Jul 23, 2015
734
Joined
Jul 23, 2015
Messages
734
what i would do is get a atmega 328, burn the arduino code on it so it can read arduino and then program it for what you want to do.
Just re-reading this, Rick, did you mean 'burn the bootloader code on it'? So the Arduino software can burn the bootloader onto a completely blank chip?
If so, that's pretty much what I was asking.

Edit: I just ordered a UNO w/ 328P, some 16MHz ceramic resonators and a couple of 328s (with the bootloader already programmed in, for now at least, until I fully resolve my question.)
 
Last edited:

Old Steve

Jul 23, 2015
734
Joined
Jul 23, 2015
Messages
734
Well, no need for any replies now. I have it all figured out. (I think)
It cost me an all-nighter, (4:21am now), but I got there.

For others who might be wondering:-
I installed the Arduino software, found the 'ArduinoISP' code in >File >Examples, and the 'Arduino as ISP' in >Tools >Programmer.
Also found some good instructions here, along with the circuit to use the UNO as a programmer:-
http://www.homautomation.org/2014/0...-in-a-standalone-mode-without-arduino-shield/

I don't have the UNO or extra chips at the moment, but when they arrive I shouldn't have any dramas.
I can't wait to have a play, but need to sit on my hands for a couple of weeks now until everything arrives. (And I didn't need to buy chips with the bootloader already burned after all. Not to worry.)

Meantime, I can make a couple of little PCBs - one for burning the bootloader into chips, then the second for actually programming them.
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
@Old Steve : Great link! When I purchased my Arduino UNOs earlier this year (along with a whole bunch of shields at Radio Shack) after receiving one as a Christmas present two years ago. I downloaded the datasheet for the Atmel ATmega 328P thinking maybe I could program this powerful μP with assembler. Not. Way too complicated for my simple tasks. PICs and old-school 8085 8-bit μPs are about my speed now.

It is good to know that this chip it can be programmed as a stand-alone to behave like an Arduino UNO, neglectling the USB interface that comes with the Arduino UNO board. My only gripe, with both Arduino and Microchip PICs, is they only support a single thread. So maybe it's time for me to resurrect the Raspberry Pi I received as a Christmas present several years ago, load that puppy up with a real-time Linux distro, and see what advantage multi-tasking might have... That's assuming I can find an affordable real-time Linux with pre-emptive multi-tasking and defined interrupt latencies like I used on an IBM '386 PC circa 1989 or thereabouts. I wish I could remember who the vendor was... not the usual Linux suspects.
 

Old Steve

Jul 23, 2015
734
Joined
Jul 23, 2015
Messages
734
@Old Steve : Great link! When I purchased my Arduino UNOs earlier this year (along with a whole bunch of shields at Radio Shack) after receiving one as a Christmas present two years ago. I downloaded the datasheet for the Atmel ATmega 328P thinking maybe I could program this powerful μP with assembler. Not. Way too complicated for my simple tasks. PICs and old-school 8085 8-bit μPs are about my speed now.
It is good to know that this chip it can be programmed as a stand-alone to behave like an Arduino UNO, neglectling the USB interface that comes with the Arduino UNO board.
Yep. I'd hate to be stuck using the actual UNO boards for everything. It's a fairly simple task to set up for using them as a stand-alone chip. And I didn't want to have to only buy chips with the bootloader pre-programmed into them, either.
I'll make good use of the great support for these things in the way of existing libraries. That's why I'm buying it - I wanted to test out simple mind control using the Mattel Mindflex headset and the Arduino Brain Library - too hard to port to my usual PICs.
I appreciate the floating point and 32-bit variable support, too. My usual PICBasic Pro can only handle up to 16-bit positive values. I have a C compiler for PIC, but it's much harder to wrestle with than PICBasic and Arduino.
Not keen on the new terms 'shield' and 'sketch', borrowed from 'Processing', I guess, but I'll get used to them. I also downloaded a copy of 'Processing' to check out yesterday. Pretty alien so far though. I think I'll stick to C++ for my PC programming. I feel at home with that.

My only gripe, with both Arduino and Microchip PICs, is they only support a single thread.
Multi-threading in micros would be fantastic. It would sure make some tasks easier, rather than messing around with complex multiplexing, interrupts etc.

So maybe it's time for me to resurrect the Raspberry Pi I received as a Christmas present several years ago, load that puppy up with a real-time Linux distro, and see what advantage multi-tasking might have... That's assuming I can find an affordable real-time Linux with pre-emptive multi-tasking and defined interrupt latencies like I used on an IBM '386 PC circa 1989 or thereabouts. I wish I could remember who the vendor was... not the usual Linux suspects.
Raspberry Pi definitely sounds interesting to play with. I have absolutely no experience with Linux, though. It would take me forever to get it singing and dancing the way I'd like.

That's another thing I like about Arduino - it took all of 5 minutes to work it out. Almost over-simple, and so much like normal C that there's no real learning curve involved. I noticed that the libraries are written in C with header files, too, so not too hard to create.

I would have bought an Arduino Mega2560, but the ATMega2560 only comes in surface-mount, so I settled for the UNO. Gutsy enough for most things I'll be doing.
 

rickselectricalprojects

Feb 1, 2015
118
Joined
Feb 1, 2015
Messages
118
Just re-reading this, Rick, did you mean 'burn the bootloader code on it'? So the Arduino software can burn the bootloader onto a completely blank chip?
If so, that's pretty much what I was asking.

Edit: I just ordered a UNO w/ 328P, some 16MHz ceramic resonators and a couple of 328s (with the bootloader already programmed in, for now at least, until I fully resolve my question.)
"burning the bootloader" means installing the arduino software on the chip so it can read the arduino language:)
 

Old Steve

Jul 23, 2015
734
Joined
Jul 23, 2015
Messages
734
"burning the bootloader" means installing the arduino software on the chip so it can read the arduino language:)
Yep, I have it figured out now. Once I got hold of the Arduino software and then did a bit more searching and reading in the documentation and online, it all became clear.

Looking forward to playing with these things.
I got the Arduino Brain Library installed OK and the examples verify in the Arduino IDE without errors, so I'm good-to-go when my hardware arrives.

Thanks once again for your help. :cool:

Edit: I ordered some 28-pin ZIF sockets so I can put one on a little PCB for burning the bootloader code. I still need/want a 28-pin IC insertion tool for putting chips into the Arduino socket, but that'll have to wait for now. The only one I found on eBay was $14.40 + $30.69 delivery, from the US. :eek:
Maybe RS will have one.
 
Last edited:

Old Steve

Jul 23, 2015
734
Joined
Jul 23, 2015
Messages
734
So, just having a bit of a play, Arduino is a hog for code space to do a particular task compared with my old PICBasic Pro.
A very simple LED blink program uses 66 program memory words for the PIC, and the same thing in Arduino uses 1076 bytes. :eek:

The PIC:-
Code:
LED var PortB.0

' Define constants:-
LEDState var bit

InitPorts:    ' Set up the ports:-
    PORTB=%00000000                    ' All Low.
    TRISB=%11111110                    ' Output to LED on RB0
                                    ' all others unused, (inputs).

Main:
    LEDState=1
    LED=LEDState
    pause 100
    LED=0
    pause 100
    LED=1
    pause 500
    LED=0
    pause 500
    goto Main

And the Arduino:-
Code:
const int LED=11;   // LED on pin 11
boolean LEDState;

void setup() {
  // put your setup code here, to run once:
  pinMode(LED,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  LEDState=1;
  digitalWrite(LED,LEDState); // On
  delay(100);
  digitalWrite(LED,0);        // Off
  delay(100);
  digitalWrite(LED,1);        // On
  delay(500);
  digitalWrite(LED,0);        // Off
  delay(500);
}

In both, I only used LEDState once - too much typing. :rolleyes:
Lucky the Arduino has so much program memory, (32K vs 1K), - I can see it'll be needed.
 

rickselectricalprojects

Feb 1, 2015
118
Joined
Feb 1, 2015
Messages
118
So, just having a bit of a play, Arduino is a hog for code space to do a particular task compared with my old PICBasic Pro.
A very simple LED blink program uses 66 program memory words for the PIC, and the same thing in Arduino uses 1076 bytes. :eek:

The PIC:-
Code:
LED var PortB.0

' Define constants:-
LEDState var bit

InitPorts:    ' Set up the ports:-
    PORTB=%00000000                    ' All Low.
    TRISB=%11111110                    ' Output to LED on RB0
                                    ' all others unused, (inputs).

Main:
    LEDState=1
    LED=LEDState
    pause 100
    LED=0
    pause 100
    LED=1
    pause 500
    LED=0
    pause 500
    goto Main

And the Arduino:-
Code:
const int LED=11;   // LED on pin 11
boolean LEDState;

void setup() {
  // put your setup code here, to run once:
  pinMode(LED,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  LEDState=1;
  digitalWrite(LED,LEDState); // On
  delay(100);
  digitalWrite(LED,0);        // Off
  delay(100);
  digitalWrite(LED,1);        // On
  delay(500);
  digitalWrite(LED,0);        // Off
  delay(500);
}

In both, I only used LEDState once - too much typing. :rolleyes:
Lucky the Arduino has so much program memory, (32K vs 1K), - I can see it'll be needed.
have you explored the sketch library the arduino has? go to >files>examples and you will find a large selection of sketches that might help you find inspiration for your first arduino project
my favorite arduino project i have built was a 3x3x3 led cube like the one shown here: http://www.instructables.com/id/Making-an-Arduino-3X3-LED-Cube-in-Less-Than-30-Min/
during the school holidays i might make a 4x4x4 cube:)
 

Old Steve

Jul 23, 2015
734
Joined
Jul 23, 2015
Messages
734
Yeah, I've had a bit of a look. A pretty comprehensive collection of samples. I can't do too much more just yet. Gotta wait for the Arduino to arrive.

I downloaded a trial of the Virtronics Arduino Simulator earlier, so I can do a bit more playing while I wait, for practice. I'll install it shortly.

I already have a first project in mind. Some tests of brain control using the Mattel Mindflex headset and the Arduino Brain Library. I was inspired by Spike124's mind and infra-red controlled robot car project.
https://www.electronicspoint.com/threads/mind-infra-red-controlled-robot-car.275281/

I've downloaded and installed the Brain Library, verified it in the Arduino IDE to make sure it compiles OK, and ordered a Mindflex headset, as well as doing a heap of research on the subject. Just gotta sit on my hands now and wait until everything arrives, then quickly get the feel of the Arduino. I'm reasonably experienced in C++ programming, so it won't take long to get the hang of things.

Edit: Just checking out the LED cube now. Looks like a pretty neat little project.
 
Top