Audio Project Amplifier Speaker Loudspeaker Kit
diyAudio.com diyAudio Forums Archive > Top > Source > Digital
 
Need a PIC based Line Following Robot - Click HERE for Original Thread
Paswa
Hello Everybody,

I'm teenager DIYer. I'm a completely newcomer to the world of robotics. Can somebody please provide me a good PIC based scheamtic of a robot...which is not tooo much complex....preferably line following, wall following or anything else.

Please help:) :D ;) :cool: :angel:
dw8083
I Just saw some in "Nuts and Volts" magazing. I forget which issue. Search their website. Also check "Make" magazine. There are vendors to sells inexpensive kits with schematics and software.

-David
Paswa
Thanks friend

I decided to make http://www.diylive.net/index.php/20...llowing-robot2/http://www.diylive.net/index.php/20...llowing-robot2/

But can somebody tell me is it possible to program PIC 12C672 using a homemade "JDM Programmer"
analog_sa
quote:
Originally posted by Paswa

But can somebody tell me is it possible to program PIC 12C672 using a homemade "JDM Programmer"


Just make a Ponyprog - faster, better, more devices, etc.

And btw this thread should not be in "Digital"
awam
have a look at the arduino's- www.arduino.cc

Very easy and convenient to program and ideal for making simple robotics as you can easily interface stepper motors and servos.

A great intro to robotics.
Paswa
here's another question. Can somebody tell me which PIC programmer to make with support of programming PIC 12xxx series chips.....

1> EzPIC http://www.kmitl.ac.th/~kswichit%20/ezpic/index.html

2> http://www.diylife.com/2008/02/15/p...icrocontroller/
<<I selected it it>>

3> SI Prog
http://www.lancos.com/siprogsch.html
((I Like IT )):)

or anything else?
Paswa
can I use PIC12F683 instead PIC12C672....microchip advises to use it
S.G. Mahbub
Dear paswa,

Do not use pic 12c672, because you can use it only once as you can not erase it. Use flash pic which are of F series. You can use 12f683 which is of 8 pin and having 2k word memory and having internal oscillator. You can use 12f675 which is similar of 12f683 but with 1k memory and costs less.

These 12f675 and 12f683 is having some advance modules like adc, comparator etc. If you are new user, you may find problem to start from these.
If you are new in the embedded world, you can start from pic 16f 84a, which is of 18 pin and easy to learn. It is always better to learn the all pros and cons of the micro controller and then land up in the complex world of robotics. Just following and copying something from internet with out understanding it deeply will bear no long lasting result.

Making pic programmer is very easy and software is readily available in internate.
mako1138
I agree that the 16F84A is a good PIC to start with. It should be easy to find and is well supported.
Paswa
quote:
Do not use pic 12c672, because you can use it only once as you can not erase it. Use flash pic which are of F series. You can use 12f683 which is of 8 pin and having 2k word memory and having internal oscillator. You can use 12f675 which is similar of 12f683 but with 1k memory and costs less.

Thanks, friends. I dont know why diyaudio members were not responding to my this thread. But thanks, becoz there were all if you. PIC16F84, I'll get the sample. But my sample of PIC12F683-I/P is on the way. pic12c672 is just outdated. new EEPROM is on the way. But one thing; can I use the same programming code (which was written for PIC12C672) for PIC12F683?

Can you please suggest me a good ebook or webpage , from where i can learn basic PIC theories and programming?
quote:
Making pic programmer is very easy and software is readily available in internate.

What about this schematic....I'm going to make it...

http://www.diylife.com/2008/02/15/p...icrocontroller/
S.G. Mahbub
Yes, Pic 16F 84A is the right Pic for starting/learning and also you can program it erase it and program it many many times.

After learning that, go for Pic 16F 628 which is of 18 pin like 84A but having 2k memory and internal oscillator but costs less than 84A.
Then move to 12F675 which is of 8 pin with 1k memory/ 12F683 also 8 pin with 2k memory.
After that 16F 673A/ 16F676 which are of 28 pins and lastly 16F877A, which is of 40 Pins and real work horse of Pic 16F series. If you can learn these, and having knowledge in Electronics, you can do undo anything in Electronics. For using these you can collect free MPLAB IDE from Microsoft Company and you can write, edit , convert Assembly to Hex File and also simulate your written program. You can purchase a trainer board to test your programs in real world or you can make one for yourself if you have knowledge in Electronics.

You can make your own Programmer and Training Board. The satisfaction and pleasure you will get by doing yourself, that is immense and the confidence you will get, that is unparalleled.
If you have real and practical knowledge in Microcontroller and Modern Electronics, you can do anything - earn whatever you want.
I said Modern Electronics, because you will find people are still engaged in obsolete technology and ideas which is far behind modern tech. and know how.
S.G. Mahbub
Mistakenly mentioned MPLAB from Microsoft co. but it should be Microchip co.
You can convert program written for one chip for another but you have to do some modifications and for that you have to read and understand Data sheet.
You can do the JDM programmer but I have doubt whether it would work or not. I never made or use serial programmer but I made and used parallel port programmer and used EPic win and oshon soft software. For different pic with different pin no., I made different socket and changing socket, I programme different pics with same programmer.
Thanks.
mako1138
I have used a JDM on several models of PICs without any problems.

I learned PIC programming from this series of tutorials:
http://www.mstracey.btinternet.co.u...ial/picmain.htm

You probably want to read a bit about basic computer architecture, and assembly language, if you haven't already.
Paswa
OKKKKK!Thank you alll:)

I'll get a PIC16F84A for starting my PIC projects just between a few days.

But I have a PIC12F683, which I wanna use in building a coooool line following robot. I got this circuit...

And this code was written for PIC12C671, but I'm using new flash based PIC12F683. Can I use the same code for PIC12F683////the code is

list p=12c672
#include <p12c672.inc>
count equ H'0025' ;defines count variable and gives a memory address
resss equ H'0030' ;defines resss variable and gives a memory address
org 0x00 ; defines the start of memory as 00h
reset
goto start
; initialize the settings of the A/D converter, and picks input/output pins
start org 0x05 ; defines where to start the code
bsf STATUS, RPO ;selects bank 1
movlw 0x04 ; moves 04 hex into working register
movwf ADCON1 ; moves working register into functional register ADCON1
movlw 0x03 ; moves 03h into working register
movwf TRISIO ; moves working register into TRISIO
bcf STATUS, RPO ;selects bank 0
movlw 0x89 ; moves 089h into working register
movwf ADCON0 ; moves w into f

;subroutine that starts A/D converter, and checks results
loop movlw 0x10 ;put 10h into the working register
movwf count ;move contents of working register into f register
good decfsz count,1 ;decrements count by one, skips next if zero
goto good ;if not zero go to good
bsf ADCON0,GO ;starts A/D by setting GO bit of ADCON0
one btfsc ADCON0,GO ;tests to see if A/D is done, skips next code if 0
goto one ;if not zero go to “one”
movf ADRES,0 ;
movwf resss ;moves results into ress
btfss resss,7 ;tests to see if results bit 7 set, skips next if set
goto Toff ;calls Toff subroutine
goto Ton ;calls Ton subroutine
Toff bsf GPIO,4 ;sets GP4 to high output
bcf GPIO,2 ;sets GPIO2 to low output
goto loop ;jump to loop subroutine
Ton bsf GPIO,2 ;sets GPIO2 to high output
bcf GPIO,4 ;sets GPIO4 to low output
goto loop ; starts A/D conversion over again
end

mako1138
The short answer is: probably. If you feel like winging it, just change the target and see if it compiles in MPASM.

But for the sake of learning something, you should go through the code step by step and understand what it does. Look at the datasheets for the two parts and compare the register settings. Ultimately, you should aim to understand the entire design.
Paswa
quote:
just change the target and see if it compiles in MPASM.

target means? registers?
MPASM? what's that? I heard microchip's MPALAB
S.G. Mahbub
Dear Paswa,
Don't bother. MPASM is the Assembler inside MPLAB. Do you know how to write Program in MPLAB IDE? Do you have programmer to load the Hex File from MPLAB to the PIC? You should have, otherwise no use of writing the Program.

There is some difference between pic 12c671/672 and pic 12f683. 12c672 is having 4mb internal oscillator but 12f683 is having internal oscillator of 8 mb. So, timing calculation will be different.
Whenever changing over to new pic, you have to change the header file.
So, when you go to pic 12f683 from 12c672, you should write,

list p = pic12f683
#include <p12f683.inc>
config???
If you don't mention configuration bits according to pic 12f683, program will not respond.

Then change the program according to pic 12f683.
Your schematic is also not clear to me.
What is the purpose of 2x 9v inputs to Pic?
Try to find the full schematic.
Thanks.
S.G. Mahbub
Hi,
The program of 12c672 you have given is not fully correct and hence if it is converted to pic 12f683, it will not work.
In the Header File, Configuration bits are not given and hence Programmer can not detect what type of PIC it is.
After org 0x00, it is written reset. In PIC 16F series, there is no instruction as reset. Moreover, you cannot reset the PIC after 0x00, because 0x00 is the reset vector address and hence whenever pic resets with Master Clear switch or any other means, it will return to 0x00 address.So, it will remain in reset vector address and will not move forward to carryout further instructions. Reset should not be used and after org 0x00, next should be goto start.
In your schematic, it is found that pin2 and pin3 of Pic 12c672 is used as input/output pin and hence it is clear that external oscillator is not used and so internal oscillator is used. But in the Program, there is no instruction is written to bring the internal calibrated frequency through bringing the data incorporated in the Program memory. So, the Pic will not work as it will not have any oscillator working for it.
Find out the original schematic and the program. If you are not acquainted yourself, in most cases you will find difficulties in following the program/schematics in the Net.
With thanks.
S.G. Mahbub
Hi Paswa,
Where are you? What is your progress regarding Robot?
Thanks.
Paswa
Thanks friend for your help.....I sorry for my delay....My broadband connection was gone for duck for 3 days due to severe storm and rain..I just got ya back today.:cannotbe:

NOW, I can't take final decision at this time. Because I'll tell my father to look for PIC16F84A and Atmel Atmega8 at kolkata. There is a really nice line following robot with Atmega8 at here

I can make it only if I get the Atmega8 .

BUT IF NOT:rolleyes:

:( Then I've to correct my current schematics and codes for these robot. Don't know why but I love PIC more than AVR. Thanks for your help without it, I could never get inspirations for robot-building.

I've changed the schematic a bit...I hope now it is correct. And again, the scheamtic is not mine it's just from a website. there was only one 9V battery but the schematic-drawer made a error, he put 2 9V batt. I've a more advanced plan to use 2*AAA batteries instead of a bulky 9v batt. and 7805.

If you can write out the code for me or correct the previous one, there would be a lots of help...because I have a plenty of xperience in analog and digital circuity(though I'm a school student) but I'm just a learner of Microcontroller programming..Please help here... :)


Thanks
THEO
S.G. Mahbub
Hi
Pic and atmega both are available in Kolkata. I always like Pic. If you like to do well in Microcontroller, first stick to one type, learn Assembly Language and afterwords you can try C Language.

Collect the original program and then I may rewrite the program for you if I get time. Pic 12F 675 and 12F 683 are beautiful piece of controllers and I made lot of Program with those.
Microcontroller is the future of Electronics. If you want to be in Electronics, learn Microcontroller. With Microcontroller, you can create wonder in Electronics.

With thanks.


____________________________________________
IDEAS ARE MONEY IF THEY CAN BE USED ON GROUND.
বাস্তবে ব্যবহারযোগ্য চিন্তাধারাই মানুষের প্রকৃত সম্পদ।
Paswa
well...thats no problem.....See what happens with ATmega8..

Can you give me the programs that you wrote for 12F683.

Can you tell me about the programmer that you used to program 12683? Can you give me the link/schematic or anything else about the programmer?



I agree with u বাস্তবে ব্যবহারযোগ্য চিন্তাধারাই মানুষের প্রকৃত সম্পদ।
S.G. Mahbub
Hi,
I will provide you tips and a program written by me and also schematics and software particular regarding programmer.. I am too busy and hope to provide you by tomorrow.
Thanks.
Paswa
No problem:) ......

But where to start?:( I'm too much confused:bigeyes: . I mean there are many highways,alleyes, doors and windows to learn about microcontroller.Can you give me suggestions where to start first?
Will I learn C programming first? Or will I learn the assembly language first? Or something else?
Tahmid
Hi Paswa,
I am also a school going kid like you.
I am learning microcontroller and am using the PIC 16F84A.
First I learnt Assembly and now I am learning C.
My advice to you is that you first learn assembly and then go for C. If you know assembly, you will know everything that is going on in your controller. But if you use C, you will be ignorant about many details regarding the controller and program. When you come to Bangladesh, you can use English, but to make most of the people understand you have to use Bangla. Microcontroller is also like that. You can use C but to understand most, you have to use assembly language.


_____________________________________________________________________________

The strongest man in the world is one, who stands alone for achieving something good.
পৃথিবীতে সেই সবচেয়ে শক্তিশালী ব্যক্তি, যে ভাল কিছু অর্জনের জন্য একাই নিরন্তর চেষ্টা চালিয়ে যায়।
wakibaki
I used this programmer:-

Sercon II

and the program (progpic) from the same site for several years, but serial ports are getting rarer, and the device library is limited.

The USB PicKit 2 is good value for money, does ICSP and integrates with MPLAB. This is less complicated than generating a hex file with MPASM and then shifting to another program to program(!) the chip, which can be a step too many for a beginner with no-one to demonstrate it.

If you can get a PicKit 2, or one of the clones from ebay, then you can avoid the complication of building the hardware. The circuits may be simple, but debugging one that doesn't work first time can be very difficult if you have never proved the software workflow (done the programming with one that works previously).

You can also get a board along with the PicKit with the ICSP pins on it. You can swap chips into and out of it to program them, or copy the connections for a new board. You can be sure you've got it right then, which again can be difficult for a person working from a circuit diagram for the first time. It also has a few LEDs, a pot and a switch so you can demo or test simple programs. The switch on mine went faulty tho'.

w
Paswa
Thanks Tahmid...
:) From where did you learn assembly? form anybook? or from internet?
Tahmid
Hi,
Paswa,
Actually I did not learn from any specific book or the internet.
I learnt from my dad who is one of the best PIC microcontroller programmers in Bangladesh.
It is very difficult to learn by oneself, but if you stick to it, you will certainly be successful. I can help you on the way.
It is not possible to learn from only one source, but from many different sources.
Stick to it. Do not give up and in the long run, you will certainly be successful.

লেগে থাকলে তুমি নিশ্চয়ই সফলকাম হবে। যারা পরিশ্রম করে এবং ধৈর্য ধরে, সাফল্য তাদের নিশ্চিত। ধন্যবাদ।
_____________________________________________________________________________

The strongest man in the world is one, who stands alone for achieving something good.
পৃথিবীতে সেই সবচেয়ে শক্তিশালী ব্যক্তি, যে ভাল কিছু অর্জনের জন্য একাই নিরন্তর চেষ্টা চালিয়ে যায়।
S.G. Mahbub
Paswa,
Wakibaki has given you a sincere and good suggestion on one sense.
Tahmid is also correct in his perspective. If you want to learn to program Pic, you can purchase Pic kit2 and the board. But are you in a hurry? You are a school going kid and enough time is there in front of you. Instead of lighting some LED etc. with the help of ready made board and programming with pic kit2, you may try to build one by yourself and also can make your own Training Board and by doing so, you will be learning valuable lessons, which will be useful for you throughout. You may be unsuccessful for 1/2 times but ultimately you will be successful. I will provide you the design of my programmer, will provide the source of software, from where you can collect and if cannot, I will mail you the software. You can get these from internet also. If you are interested in Assembly Language, I can post you some of my programs written for 16F84A and these I can post through this Forum, so that others who are interested can see.

When I started Pic Programming, I also faced lot of problems with programmer as it was not available in my country and no office or agent of Microchip are here and hence I went to self making route. I made those with lot of hard work but that effort gave me lot of benefit. Afterwords, I earned lot of money by selling my programmers and Training Boards for different Pics. I furnished my Laboratory lavishly with those money.

Hardwork never goes in vain and shortcut may not help you in the long run.
I will take 3/4 days more and then I will start helping you.

Thanks.

____________________________________________
IDEAS ARE MONEY IF THEY CAN BE USED ON GROUND.
বাস্তবে ব্যবহারযোগ্য চিন্তাধারাই মানুষের প্রকৃত সম্পদ।
wakibaki
Of all conventional programming, assembly language programming is the most difficult place to start (has the steepest learning curve), and in some ways has the narrowest application.

A good introduction to programming nowadays is HTML or web page construction. It is the most accessable, and at the same time most exciting discipline for an all-round programmer. It extends through xml, ASP(.NET), php, javascript, Java, SQL, the whole range of high level languages and even assembly language, and encompasses operating systems, networking and web technology.

You can get an immediate result and build up your confidence and programming skill.

There is an outstanding series of tutorials at w3schools.

You should still try to learn assembly language too as this provides the ultimate level of machine control. After that you can learn VHDL.

w
Paswa
Thanks everybody...S.G Mahbub,Wakibaki, Tahmid :)
And special thanks to Tahmid because I always get inspiration from him as he is just a school going boy like me.

I got my the electronic components of my dream. Like I got a PIC16F84A, a ATmega8, a 16x2 LCD module called "JHD 162A". who need more things to start microcontroller programming.

I have started assemblyt lang. learning from net....Hope I'll overcome it.

PIC Kit 2 ? I'll try to get this one...but I could make it out myself.

Now I need the simplest PIC16F84 programmer which only supports 16F84. After burning some programs to PIC16F84 I'll build a universal JDM programmer or the programmer that my friend, Mahbub built.

Along with PIC I've to build a Atmel AVR programmer later.

And projects with LCD module is always very interesting to mee......oh HElllo Worldd
:rolleyes: :rolleyes:

The simplest 16F84 programmer of the world must be THIS I'll build this one fitst..

Thanks everybody..
Come again next day...
Theo(my name)
Paswa
Hey friends....I failed everywhere... My PIC programmer didnt worked...my AVR Atmega8 programmer failed after reading twice,,I'm not sure if I have destroyed my microcontrollers.


PLEASE please share something good programmers for me please and please:confused: :confused: :bigeyes: :confused: :clown: :dead: :whazzat: :apathic
wakibaki
Paswa, don't give up.

It is very common to have difficulty programming a PIC first time especially with a home-made programmer.

I had experience programming a Z80 system with an EPROM, 80x86 assembler, 68000 and other systems. Still it took me hours to get it to work. One error in your program or setup or soldering fault can mean nothing will work, but you don't know where the fault is. If you knew that the program and setup were OK, then you could say the problem was in the soldering, but 3 unknown things is too many.

This is the same all over computing and electronics. One small thing is changed, and maybe your broadband stops working.

One small thing is changed, and your programmer starts working. But which thing?

This is why it is better for some beginners to buy a programmer and a demo board with some working example programs.

When you have a working setup, then you can modify it and start to really learn. You change one thing at a time. Now if you get a problem, you know where it is.

It is also very common to destroy processors by accident, but yours may still be OK. You have to accept this cost as part of the learning process. Perhaps you will be luckier or more careful than me, I always need to have spare processors.

What kind of serial port do you have? Is it on a card or motherboard in a desktop or is it on a laptop or is it a USB-serial adapter?

What are you going to test your programmed processor in?

The PicKit 2 low-pin-count demo board will run from the USB power. This is convenient. Any low-power board you build will also run the same way.

The circuit you referenced looks a bit simplistic, but it may well work. The SERCON 2 circuit I referenced earlier definitely works with a conventional serial port.

Keep trying.

w
mako1138
quote:
Originally posted by wakibaki
Keep trying.

Absolutely.

Can you tell us what you've done so far, in greater detail?
Paswa
Thanks everybody. Thanks

I've to forget the days of failure and have to start again with new hopes.

First I built the simplest PIC 16F84 programmer that I mentioned on a breadboard. And i'M SURE THAT THERE WAS NO ANY CONNECTION MISTAKES. I hooked up the serial port (which is in my motherboard D945GNT). I started the program that they suggested to use. But It didn't worked. While writing, after 28% done, it said write error.

There may be reasons behind it. I measured the voltage in Vdd (respect to GND) was 5.6Volt. PIC16F84A datasheet tells that the max. operating voltage should be <5.5V and maximum voltage should be 8.5V on Vdd pin. The MCLR voltage waw correct....It was 12.75V

I forget to shoot any pic of my setup. I dont know have I destroyed my MCU.

Now to the story of Atmega. I used a programmer called "Sercon II-mini". I arranged everything correctly on my breadboard and connected thr Atmega8. the program bundled successfully managed to detect the programmer and the chip. It managed to read from the flash memory twice and saved it. But I deleted the file accidently. But I remeber that the first line was 0000...second line was the same but the other lines was filled up with a jungle of binary (or hexadecimal number, I dont remeber clearly)100101010101111010 etc... And when I clicked on a option called "data window" then everything gone died. The software failed to detect the atmega8...and I tried in various way
but nothing seemed to work....DOnt know if I have destroyed my mega8.

BUT I gonna make the sercon II....But you have to confirm me, does it work? I'm thinking where to make on a veroboard or a perfboard or in a PCB..But no breadboard in this time

It's a Hard Rains A-gonna Fall.......

Thanks
Theo

Page generated in 0.11143398284912 seconds with 17 queries,
spending 0.00988841 doing MySQL queries and 0.10154557 doing PHP things.

Powered by: Search Engine Indexer and vBulletin
Copyright ©1999-2008 diyAudio.com