Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: winnie on April 17, 2008, 12:34:29 AM

Title: How many pins to use?
Post by: winnie 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?
Title: Re: How many pins to use?
Post by: paulstreats 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)
Title: Re: How many pins to use?
Post by: winnie 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?
Title: Re: How many pins to use?
Post by: paulstreats 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.
Title: Re: How many pins to use?
Post by: winnie 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?
Title: Re: How many pins to use?
Post by: paulstreats 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++
Title: Re: How many pins to use?
Post by: winnie 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)..
Title: Re: How many pins to use?
Post by: Admin 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)
Title: Re: How many pins to use?
Post by: winnie 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..
Title: Re: How many pins to use?
Post by: Admin 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.