Arduino on board

Arduino on Board
Arduino on Board
So the man at the Lab asked me for a prototype of my project because his men could not create the prototype at their lab. It could be due to some programming errors or some code errors which we tried to sort out over telephone but finally the result was negative and now he asks for the prototype.
But after burning 2 Arduino nano board due to my inadvertent experiment I'm left with only one Arduino Mega board and for sending him prototype of my “4 Chanel Servo controller for RC aircraft”, I need two Arduino boards – one for the transmitter and one for the receiver. An Arduino UNO board costs Rs:1400 ($21.5) in our country. Though there are china based supplier who delivers at the cost of $11 a piece but it takes more than 40 days to reach my quarter here in Vindhyanagar . It means if I try to save money then I will miss the publication in the coming month but do I really care for that ?
'Please give me some time to get it ready ', I blindly asked for some break though I don't know how to make him satisfied.
If only I can take out the microprocessor chip out of the UNO boards after programming and then put the project one a piece of Vero board ! Or if I could create an Arduino on a piece of vero board …... !
Meanwhile I kept exploring the Internet. Some people could be able to program raw microprocessor using Arduino UNO as in-system programmer but success with bigger microprocessor like ATMEGA chip is hardly proven consistently. The arduino.cc has got a chat boards where people could program Attiny 44, 85, 84 using Arduino as programmer.
Theprocessinvolvestwosteps – firsttransfertheArduinobootloaderontotherawfactorycutchipwhichrequiresnearly512bytesofspaceandoncethatisdonethenyouareonlyleftwithuploadoftheArduinosketchontotheremainingspaceofthechiptodothebullworksasdescribedinthesketch.TheATMEGA328Phas32Kbyteofflashmemoryforthewholeworktocarryoutandit'sadamngoodamountofmemory.
For this matter this is worth to mention that suppose you have an Arduino board which is built on ATMEGA328P or ATMEGA8A-PU like chip and due to some reason the chip has gone bad ! ( like my case). You buy another chip from market which comes for Rupees : 140 ($2.3 ) , take out the old chip and insert the new one and then start uploading some impressive sketch from archievemag.com .
Wow ! Nothing happens and the board behaves like a dead rock. This is right ! Because you have inserted a raw chip which does not have an Arduino boot loader preloaded. So the board does not know what is to be done with the chip and where to upload the sketch. Therefore, you should have bought an Arduino boot loader preloaded chip in the first place.
There are many variety of AVR programmer available in the market but most of them work with hex files or assembly level programming languages which I just hate to work with.
The fascinating thing is to use Arduino as AVR programmer and then upload Arduino sketch on to the chip using Arduino as the programmer. After trying and tweaking many nights here's what I got finally and this is just wonderful !
It's true to say that Internet has everything , only one needs to do some searching and tweaking to get the desired result !
I can now program ATMEGA328P, ATMEGA328 , Attiny 13A, 44, 45, ATMEGA8A-PU, ATMEGA8L-PU etc chips using my Arduino UNO board as programmer. Once the program is uploaded I take out the chip, put it on a piece of Vero board, put a 7805 voltage regulator , connect the devices like temperature sensor, 433 MHz radios, LCD character panel etc. thus recreate my project much smaller in size on vero board and then ship it to the lab as my project prototype. It's damn cheap now !
Thesoftwares:Allarelocatedhere..
[avr_isp.ino : This file has been developed over the years by a number of contributors, The development started sometime in 2008, then a number of modifications made until 2012,
once uploaded this will make the MEGA board a programmer.
avrdude.conf: is the file already there in your arduino IDE installation directory
boards.txt : is also there in your arduino IDE installation directory, however in this boards.txt I've added a few additional microprocessors]
avr_isp.ino:
avrdude.conf:
boards.txt:
[all these files included in the attachments]
ArduinoIDE:Version1.0isthemoststableversionthatIuseonmyUbuntulaptop.It'sassumedthatyoutoohaveoneofthestableArduinoIDEsinstalled&workingperfectlyonyourlaptop.
MakeyourArduinotheATMEGAprogrammer: This works for Arduino MEGA 2560 & Arduino UNO .Sofirstconnect the board,starttheIDEanduploadtheavr_isp.inofilefromtheabovelocationontoyour UNO or MEGAboard.Oncethisisuploadedyour UNO or MEGAboardisnowreadyforactingasaATMEGAprogrammer.
Partsrequired:ATMEGAprocessor(bootpreloadedornot),4,8or16MHZquartzcrystal,22pf(2nos),1uf10voltelectrolytecapacitor,anLEDandapushtoonswitch(fortheresetbutton)
Figure-1:
[Those are two of my Arduino UNO R3 board - programmed using another UNO board]
Connections:Thequartzcrystalof4MHZ/8MHZ/16MHZcanbeusedbutit'soptional.Thequartzistobeconnectedtopinno9and10andthe22pfcapacitoreachconnectedbetweenthequartzandtheground.Ifnoquartzisusednoneedtousethe22pfcapacitors. Once a chip is programmed with a quartz it won't be programmed without quartz again.
Figure-3
[Connections:CourtesyJoseMartin,2012,Internet]
Process:ATMEGA328chiphasanonboard8mhzinternaloscillator.Thatmeansinabsenceofaquartzthechipcanstillbeprogrammedandworkat8MHzspeed.Butunfortunatelythisisnotvisibleintheboardssectionunlesstheboards.txtfileischangedtomakeso.Replacethe/usr/share/arduino/hardware/arduino/boards.txtfilebythenewboards.txtfilethatyouhavedownloadednow.Ifcaseyouhaveadifferentlocationpleasefindouttheboards.txtfileandthenreplaceitbythisnewfile.
ClosetheArduinoIDEifitisalreadyopenandthenrestarttheArduinoIDE.Nowgototools – boardandlookatthetop3rdandyouwouldfindthe-ATmega328onabreadboard(8MHzinternalclock).Thetoponeis-Rotceh-hackQM7298w/ATmega48VxD.Allotherboardsarevisiblebelowtheselines.
Nowit'stimetolookatthechipthatyouhavepurchased.Ifit'sATMEGA328P,lookatthe'P'signthenitcanbeprogrammedveryeasilybecauseithasacommonsignaturewhichhasbeentakencareintheArduinoIDE.JustmaketheconnectionasshownandthenselecttheboardasATmega328onabreadboard(8MHzinternalclock)orArduinoUNOifyouconnectthe16MHZquartzandthenputthe1uf10voltcapacitorbetweentheresetpinandgroundpinoftheArduinoMEGAboard(nowcallittheprogrammerboard,asit'snowreallygoingtodothatjob..).Thecapacitoractuallypreventstheprogrammerboardfromselfresettingwhileuploading.
GotoTools – Board-(selectyourboard)
GotoTools – BurnBootloader
….andthemagicstarts …....
Now the lights on the programmer board will start blinking, if you have put the LED on the pin no 19 of the target board , it too will start blinking and after some time everything will stop. Be rest assured that the boot loader has been burnt on the new ATMEGA328P chip now. It's ready for getting programmed !
But the reality is always different, you have hardly got the right chip. In all probability the chip that you have purchased is ATMEGA328 , without a 'P' and that makes all the difference. The programmer window will say that the chip signature is different.
But don't worry it's always difficulty which has made us more wise in the fields of hobby electronics.
Go to the /usr/share/arduino/hardware/tools/ and replace the avrdude.conf file with the new avrdude.conf file that you have just downloaded. Keep a back up of the old file as it will be required again while programming the original chips. However, in your case if the avrdude.conf file is located at different location please go there and do so now. In fact we are just making fool of the IDE software now. Telling it to program the same ATMEGA328P (original ) chip with only a different 'signature' line.
[However, manually you can open the avrdude.conf file and then search for the block starting with 'ATMEGA328P' under it find the signature line and replace it with the new signature like this ]
# signature = 0x1e 0x95 0x0F; #bypassed by Bera
signature=0x1e0x950x14;#modifiedbyBeraforatmega328
# is for bypassing the line from execution.
Avrdude.conf is very big file and First time when I did it , I did it at a wrong location under the similar ATMEGA description and signature line and the result was a prolonged frustration for me. Therefore, I recommend you just replace the file by the new file and it will work for all version of the IDEs.
Now close the IDE if it was open and then reopen the Arduino IDE now and try to repeat the previous process of burning the boot loader. It should work now as it has worked for me and there is no other signature available for the ATMEGA328 chip unless you invent one ! Remember the 1uf capacitor will always be connected on the programmer board else it will give errors.
For the latest Arduino 1.5.8 Ide the avrdude.conf file is located at
../arduino-1.5.8/hardware/tools/avr/etc/avrdude.conf
../arduino-1.5.8/hardware/arduino/avr/boards.txt
Whatnext?:Allthefunisawaitingnext.Nowfindtheblinkprogramfromtheexampleandthenuploaditonthetargetchip.
GotoFile – UploadusingProgrammer[Rememberthisisnotacommonuploadprogram,youaretouploaditusingtheArduinoasaprogrammer]
All the LEDs on the programmer and the LED connected on pin no 19 will start blinking for some time and then everything will stop. The LED connected to pin no 19 is the LED connected to digital pin-13 which will start blinking now to show that you have successfully burnt the Chip with the new blink program !
void setup() {
pinMode(13,OUTPUT);//TheLEDconnectedtopinno19
}
void loop() {
digitalWrite(13,HIGH);//settheLEDonpinno19
delay(1000);//waitforasecond
digitalWrite(13,LOW);//settheLEDoffonpinno19
delay(1000);//waitforasecond
}
Once this is done you can transplant the chip to a new vero board , connect a 5 volt regulator, 7805 , a reset pin with ground to pin no 1 , connector pins and you are ready with a new Arduino board. The 16 mhz quartz is optional but once a chip is programmed with a 16mhz chip you cannot reprogram it back to 8mhz internal oscillator.
[Later I tried with Uno or Nano board and it works flawlessly !!!]
Figure-2
[Here's an LCD panel connected ]
Theboardworkswithallthesensors,LCDpanels,433MHZTx.&Rx,rotaryencoders,joysticks,servostherefore,itcanbeassumedthatit'sanormalboardandwillworklikeotherArduinoboards.[Nowsendingaprototypeissoeasyforme.EvenIcangiftthemtoo!!!]
figure-4
[PinupdiagramofATMEGA328,alsovalidfor328P/8A/8L/ATMEGA168]
[photocourtesy:www.instructables.com]
figure-5
[Schematic for Arduino UNO as programmer]
S. Bera
Vindhyanagar
Discussie (0 opmerking(en))