Author Topic: How many pins to use?  (Read 4665 times)

0 Members and 1 Guest are viewing this topic.

Offline winnieTopic starter

  • Jr. Member
  • **
  • Posts: 24
  • Helpful? 0
How many pins to use?
« on: April 17, 2008, 12:34:29 AM »
Does it matter if the pins used are less or more than required? How would I know how many pins to use?

paulstreats

  • Guest
Re: How many pins to use?
« Reply #1 on: April 17, 2008, 06:29:36 AM »
you need to decide on what sensors and actuators you need.

if you are using modified servos to drive the vehicle, then you need 1 digital pin per servo.
motors usually need 2 digital pins each
photoresistors / ir detectors / rangefinders etc... need 1 analog pin each
a lot of sonars need a 2 wire i2c bus

Without knowing what you are planning on using, nobody can tell you the answer.

An mcu with less pins is usually smaller in size and quite often easier to learn but usually come with less features
an mcu with a pin count of around 40 is bigger, has more features, has more pins but will take a lot more learning because of the features.
an mcu with more than 40 pins is normally surface mount and therefore smaller than the above 2 but not recommended for the beginner because they are extremely difficult to hand solder.

Take a look at the microcontroller board of the $50 robot and see if it might be what you need (click on the society of robots logo at the top of the page)

Offline winnieTopic starter

  • Jr. Member
  • **
  • Posts: 24
  • Helpful? 0
Re: How many pins to use?
« Reply #2 on: April 17, 2008, 09:29:06 PM »
thanks.. i think we should finalize first the model of the car and how many sensors to be used so that it is much easier for us to decide..

but you mention a digital pin and an analog pin.. how can we differentiate between the two? did you mean that a microcontoller has either a digital or analog pin?

paulstreats

  • Guest
Re: How many pins to use?
« Reply #3 on: April 18, 2008, 05:04:44 AM »
they usually have a mixture of the 2 but in different ratios(analog pins can usually be used as digital pins), analogue pins allow you to read a voltage level and get a value that you can use in programming, so with a distance sensor that changes its output voltage depending on the distance of an object, an analog port can convert that voltage into a number in the microcontroller and allow you to asses the actual distance through programming.

Digital pins on the other hand only have 2 states - either on or off. These are good for turning on lights or motors or sevos.

Offline winnieTopic starter

  • Jr. Member
  • **
  • Posts: 24
  • Helpful? 0
Re: How many pins to use?
« Reply #4 on: April 19, 2008, 01:25:12 AM »
if we buy a microcontroller, are there any manual which come with it where we can identify the analog and digital pins?
can you recommend a microcontroller where we can use the C++ language?

paulstreats

  • Guest
Re: How many pins to use?
« Reply #5 on: April 19, 2008, 02:30:05 AM »
Microconrollers all have datasheets availalefrom themanfactrers websites, these tell you all you need to know about them.

Check the software section of the forum for c++ topics but the long an short of it all is that there are a couple of c++ compilers available but dont expect them to be fully object orientated multitasking machines. Most microcontrollers are programmed now in C or basic, this is where you should really be looking . Plain microcontrollers dont usually have enough memory to be able to implement languages as high level as c++

Offline winnieTopic starter

  • Jr. Member
  • **
  • Posts: 24
  • Helpful? 0
Re: How many pins to use?
« Reply #6 on: April 19, 2008, 03:16:31 AM »
we will try the C language.. if we learn the basic language we'll never graduate.. :D

but i read in an article that he already made a robotics project using Bloodshed C++ ( although i forgot that particular site)..

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: How many pins to use?
« Reply #7 on: April 20, 2008, 03:46:43 PM »
Quote
but i read in an article that he already made a robotics project using Bloodshed C++ ( although i forgot that particular site)..
I used C with Bloodshed, and it was just for a simulator:
http://www.societyofrobots.com/programming_wavefront.shtml
(very bottom of the page)

Offline winnieTopic starter

  • Jr. Member
  • **
  • Posts: 24
  • Helpful? 0
Re: How many pins to use?
« Reply #8 on: April 20, 2008, 11:00:46 PM »
Quote
but i read in an article that he already made a robotics project using Bloodshed C++ ( although i forgot that particular site)..
I used C with Bloodshed, and it was just for a simulator:
http://www.societyofrobots.com/programming_wavefront.shtml
(very bottom of the page)

did you mean that we can still compile a C language using Bloodshed C++, but how about if we use the C++ language are there any differences? because we really can't use basic and java.. we're so lack of time..

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: How many pins to use?
« Reply #9 on: April 21, 2008, 09:05:53 AM »
Bloodshed can do both C and C++

But I almost always use C because my code tends to get ported to robots, and I'm just more used to it.

A quick way to get started would be to look at my code and reverse engineer it. I always keep my code easy to understand with lots of comments.