go_away

Author Topic: Help me with Microcontrollers!  (Read 3090 times)

0 Members and 1 Guest are viewing this topic.

Offline harrypotterjkwTopic starter

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
Help me with Microcontrollers!
« on: July 04, 2007, 10:34:54 AM »
 :)Hi,
I am quite a newbee to robotics ( i have only made one BOT, a differential drive based 2 DC Motor driven wire controlled speed boat for a robotics competition in my college Techno India in Kolkata in India on March '07).
There was an event in the competition called LINE FOLLOWER where you have to make an autonomous robot that follows a white patch of thick line on a black surface. I know that its done with the photoresistor thing to identify where the line is going to the left or to the right. This thing really fascinated me but unfortunately I could not participate in it because I had no knowledge of Microcontrollers which are the brains of these kind of robots.
         


       I would like to add that I am a second year onto third year computer science engineering student and I have a background of BASIC ELECTRONICS and programming languages like GW BASIC, C, C++, and am going to learn Java soon in my 3rd year 6th semester.
       Thus I humbly ask you people to help me learn all about Microcontrollers (recently I have been surfing a bit about it and have learned the basics, but the real hitch is the ATTACHING THE MICTOCONTROLLER WITH THE DIFFERENT SERVOS AND THE OTHER SENSORS AND PROGRAMMING IT), so that I might be able to make my own LINE FOLLOWER by the end of January '08 so that I can take part in the college robotics compition.



    The first edition of the college fest (technilcal fest) was held in March '07 for more information about the fest
visit            www.edg.co.in                  :)

Offline KambeiX

  • Full Member
  • ***
  • Posts: 79
  • Helpful? 0
Re: Help me with Microcontrollers!
« Reply #1 on: July 04, 2007, 10:59:16 AM »
Well, basically, a microcontroller is a CPU with embedded peripherals, ram and storage, so if you know how to program, getting into microcontrollers won't be too hard.

Of course writing programs in assembler is more complicated but for example, here are some simple routines for controlling servos in CCS C (for PIC microcontrollers):

let's say you want to move a servo to the left when you get a signal on certain pin, that will be a bit in a register. The compilers have aliases for this pins so you don't have to always remember that. For example, pin 2 will be PORTA.1 or PIN_A1 (constant).

then you make a routine like this: (very simple)

if(PORTA.1==1)
{
for(i=0;i<10;i++)
{
output_high(PORTB.1); // servo output pin = high. This varies from compiler to compiler, some are like PORTB.1=1 or in BASIC is something like high PIN3
delay_us(1300); // Again, this varies from compiler to compiler, we are making a delay of 1500 uS (1.5 milliseconds)
output_low(PORTB.1); // servo output pin = low.
delay_ms(18); // 18 milliseconds delay for a total of 19.3 ms... this works ok on a 20ms servo but you can also use delay_us
}
}

Ok, so we just sent a 1.3 ms pulse 10 times if a pin (sensor) was on.

There are better ways to do this of course but you will have to learn that. (Like using Interrupts or a RTOS).


You can try getting some samples from Microchip (I recommend getting 18f1320, 18f1220 and any 28 pin like 2431 or 2580 since they are small but powerful and you can use the free C18 Compiler from Microchip). You will also need a programmer, but I think your college will have one somewhere if it's making robotics challenges.

Offline sotu

  • Supreme Robot
  • *****
  • Posts: 350
  • Helpful? 0
  • ´BB - Eye Biped Bot
Re: Help me with Microcontrollers!
« Reply #2 on: July 04, 2007, 12:51:40 PM »
I dont really get it, if u have learned about how to program microcontrollers so long u dont know what microcontrollers are?
How to build a biped bot:

Offline Steve Joblin

  • Supreme Robot
  • *****
  • Posts: 405
  • Helpful? 2
Re: Help me with Microcontrollers!
« Reply #3 on: July 04, 2007, 02:16:09 PM »
One of the best ways to learn about microcontrollers and how they interface to sensors, servos, etc. is to buy a Parallax BOEbot.  A complete BOEbot kit will provide you with all the hardware and electronics you will need.  One of the best parts is the documentation which walks you through the entire process step by step.  You can find out more at http://www.parallax.com/detail.asp?product_id=28132.  You can download the documentation for free at http://www.parallax.com/dl/docs/books/edu/Roboticsv2_2.pdf.  The software for the development environment is also free.

I think it is the best way to get started and develop a solid understanding of microcontrollers and robots.  They also offer a bunch of other great tutorials including
 - What's a Microcontroller?
 - Understanding Signals
 - Basic Analog and Digital
 - Smart Sensors & Applications
 - Process Control
 - Applied Sensors

Offline S. Karim

  • Robot Overlord
  • ****
  • Posts: 155
  • Helpful? 0
Re: Help me with Microcontrollers!
« Reply #4 on: July 04, 2007, 02:19:12 PM »
Whats funny is I think parallax.com sells a "Whats A Microcontroller" kit with everything you need lol.

Offline sotu

  • Supreme Robot
  • *****
  • Posts: 350
  • Helpful? 0
  • ´BB - Eye Biped Bot
Re: Help me with Microcontrollers!
« Reply #5 on: July 04, 2007, 02:35:14 PM »
As u said S. Karim Parallax sell a kit named "Whats a microcontroller"
The book u get included in this kit is also online in a free PDF file, im on a different computer now but i can send it to u, would u like that?
How to build a biped bot:

Offline Steve Joblin

  • Supreme Robot
  • *****
  • Posts: 405
  • Helpful? 2
Re: Help me with Microcontrollers!
« Reply #6 on: July 04, 2007, 07:46:49 PM »
Yes, Parallax does offer a Stamps in Class curriculum called "What's a Microcontroller" as I noted in my response above.  I did not suggest that curriculum as harrypotterjkw was interested in both robotics and microcontrollers.  That is why I recommended the BOEbot curriculum instead.

Offline harrypotterjkwTopic starter

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
Re: Help me with Microcontrollers!
« Reply #7 on: July 05, 2007, 09:42:43 AM »
Thanx guys for all that!
as you see
what i wanted to learn is the MCU broken down to the simple logic gates that make them work
I already have a good understanding of the principles of BASIC ELECTRONICS that is gates , adders, MUX , decoders ADC, DAC and all that stuff and also a basic understanding of how RAM (both static and dynamic types) and ROM work that is the basic electronics behind their wirking.


And by the way as I am new to MCUs which MCU (I mean brand and type) would you people prefer me buying so that I might be able to reuse it again ( I know they are versatile, its the logic that you put that makes the difference, but what I mean is that which MCU should see me through demanding number crunching situations as well as provide adequate space in their EEPROMS and ROMS ,number of instruction lines that they can hold).

My budget is approx (Indian Rupee) INR 1500 to INR 2000 (thats roughly USD $40 to USD $50).

Also possible vendors in Kolkata,India. ( if any one of you know about it, while I  try to GOOGLE it anyway )

Offline harrypotterjkwTopic starter

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
Re: Help me with Microcontrollers!
« Reply #8 on: July 05, 2007, 10:19:40 AM »
And bye the way thanx steve joblin for that link to BOE BOT
I think its going to help me a lot
 Another question that I have is that
              1) the chips are called MCUs,right?
                            -then what are those green mother boards?
                             are they the same thing that ADMIN has been teaching how to build in his "$50 robot tutorial"?
               2) if so, then which is better (or say which way is it cheaper), to buy the assembler board (I think thats what its called) or to build one from scratch as ADMIN has shown in his tutorial.

Offline KambeiX

  • Full Member
  • ***
  • Posts: 79
  • Helpful? 0
Re: Help me with Microcontrollers!
« Reply #9 on: July 05, 2007, 10:59:18 AM »
Thanx guys for all that!
as you see
what i wanted to learn is the MCU broken down to the simple logic gates that make them work
I already have a good understanding of the principles of BASIC ELECTRONICS that is gates , adders, MUX , decoders ADC, DAC and all that stuff and also a basic understanding of how RAM (both static and dynamic types) and ROM work that is the basic electronics behind their wirking.


And by the way as I am new to MCUs which MCU (I mean brand and type) would you people prefer me buying so that I might be able to reuse it again ( I know they are versatile, its the logic that you put that makes the difference, but what I mean is that which MCU should see me through demanding number crunching situations as well as provide adequate space in their EEPROMS and ROMS ,number of instruction lines that they can hold).

My budget is approx (Indian Rupee) INR 1500 to INR 2000 (thats roughly USD $40 to USD $50).

Also possible vendors in Kolkata,India. ( if any one of you know about it, while I  try to GOOGLE it anyway )



Most common MCU's in the market are PIC (http://www.microchip.com) and AVR (http://www.atmel.com)

If you are on a tight budget you can try requesting free samples from Microchip (read the other post). The advantage of buying a preprogrammed MCU like a Basic Stamp from parallax is that they are easier to program (you only need a serial cable or usb cable depending on the model) and also that they have a free BASIC IDE for their controllers, but they are also more expensive.
 

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: Help me with Microcontrollers!
« Reply #10 on: July 11, 2007, 06:43:06 PM »
Quote
My budget is approx (Indian Rupee) INR 1500 to INR 2000 (thats roughly USD $40 to USD $50)

something like this? ;D
http://www.societyofrobots.com/step_by_step_robot.shtml
(just point the photoresistors down close to the ground)

Offline Steve Joblin

  • Supreme Robot
  • *****
  • Posts: 405
  • Helpful? 2
Re: Help me with Microcontrollers!
« Reply #11 on: July 12, 2007, 11:19:39 AM »
harrypotterjkw:  yes, MCU, Micro Controller Unit, Micro Controller, Micon are all different ways of saying the same thing.  the MCU is all contained in a single chip.  To use it, may require several other components (such as an EEPROM chip to store your program, resistors, capacitors, resonators, voltage regulators, and other components so it can accept your program as you download it from your PC to the EEPROM).  Some chips have many of these components built inside the MCU chip (for example, a PICAXE-08M MCU only requires two external resistors and a regulated voltage source to download and run a program), while others like the Parallax BASIC Stamp requires many external components to download and run a program.  The Parallax Stamp is actually a very tiny circuit board that contains all of these components.  The circuit board is actually the size of some chips, about the size of a postage stamp, which is where it got it's name!

The point is that you don't build a MCU, you buy them.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: Help me with Microcontrollers!
« Reply #12 on: July 12, 2007, 12:36:46 PM »
Quote
The point is that you don't build a MCU, you buy them.
The confusion is that people refer to augmented microcontrollers (a microcontroller with lots of goodies attached to it) as just a microcontroller. I do it too, so it often results in this confusion . . .

 


Get Your Ad Here