Hardware for the beginner.

Hey everyone.

I'm in 2nd year Engineering, and I'm taking a few circuits classes, so I've got a rudimentary knowledge of programming and discreet components. In my labs, I've worked with logic gate chips as well as the Altera MAX CPLD.

(As a side note, can the Arduino be coded with VHDL? I've barely studied the stuff, but it'll be on my final exam and it'd be great to mess with it at home on my own hardware)

As I'm on a student's budget, I'm hoping to start my own home setup on the cheap. I've ordered a (Bootleg?) Arduino Mega (http://goo.gl/pgSKd) and LED/7-segment display module (http://goo.gl/bbHeL), and some hookup wire from dealextreme.

Is there anything else I should get to be starting on basic projects? I'm thinking a breadboard should be on the list, as well as a few project boxes to semi-permanently mount switches and LEDs. Is a separate powersupply needed?

I have a ~200 various LEDs back at my parents place that I ordered off of eBay years ago. I never did much more then burn them out in various installations, as I didn't (and still don't to some degree) understand why they need a resistor in-line, even in an application where their voltage is proper. They came with some separate resistors I believe. Also I've got some small toggle switches.

I've got interests in cars and motorcycles, and would eventually like to build a digital dash (first for a computer racing sim and then an actual vehicle), but that's a little ways down the road.

Thanks for the read, and hopefully I can learn a lot from this community. Who knows, maybe eventually I'll be able to help out as well!

Thanks! -Panici

Hi Panici,

If you have done some assembly with cmos etc, the first thing ( no second thing - the series resistor for LEDs is first :-) ) to note that when Arduino talks about "pin 5" they are not talking about pin 5 of the chip, its more to do with the port numbers, download and have printed Gavin Smith's Arduino Cheat Sheet V.02c or later? Its got all the daily info on one sheet, including the pin numbers in one drawing.

A normal LED will pass current and start lighting up with a couple of milliamps, as you increase the supplied voltage, it gets to a point where the forward voltage stabilises at its Vf - forward voltage - it is a diode remember , if you keep supplyiing more voltage it will effectivly be shorting out any voltage higher than its Vf, so it will try and drag the supply down to its Vf.

Dead LED !

By calculating the resistor by Ohms law, the supply voltage - Vf / the max current for the LED, the LED will run within its limits.

As for hardware for various projects , you can buy "shields", but its cheaper just to make up a quick interface board from Vero or Perforated board, with header pins to plug into your Arduino. I have dozens of these now, all cut from one sheet of Veroboard.

All the end products I make I use a pcb and chip socket, but no USB. I program the chips in the Arduino socket, and plug them into the PCBs.

If you have a large enough breadboard, you don’t need a project box to mount the LEDs and switches on, just stick them in the breadboard and off you go. Add/remove as many as you need/want at any given time. A project box comes later, when you have something in mind that you want to build permanently. My two cents … someone is bound to tell you different of course. Ultimately, it’s your call. I never bothered with them though, just breadboards.

As for the LEDs you’ve burned out, the voltage you read off of their package, or datasheet, that’s the voltage needed to drive it. The resistor is there to control the amount of Amps flowing through it (or milliamps in most cases.) LEDs can only take so much. And you can not feed the exact voltage to a LED based on it’s specifications, you have to supply more.

One of the most common LEDs used have a voltage of 2V and 20mA max current. This means, the voltage drop across the LED is 2V and it’s upper bound for current is 20mA. In contrast, a single AA battery ranges between 900mA to 1700mA - that will most certainly fry the LED.

So, to figure out what resistor you need, we have a formula: R = (VS - VL) / I
Where:
R = resistor value (Ohms)
Vs = voltage supply (Volts)
Vl = LED voltage (Volts)
I = LED current (Amps)

So let’s say you decide to connect this specific LED to a 9V battery. The formula then is:

(9 - 2) / 0.02 = 350 Ohms
(you need to convert the milliAmps to Amps, so 20mA = 0.02A)

This means, this specific LED would need a 350 Ohms resistor when connected to a 9V supply. The resistor value changes based on the voltage supply.

You can certainly put a larger resistor in line, but that will simply limit even more current flowing through the LED causing it to be dimmer. You can use a smaller resistor, in which case you’re allowing more current to flow through the LED. Most of them have a max value for forward current, after which it will start to decay rather rapidly, and as you’ve already noticed, burn out completely.

First off, thanks for the quick reply guys!

Boffin1: ...download and have printed Gavin Smith's Arduino Cheat Sheet V.02c or later? Its got all the daily info on one sheet, including the pin numbers in one drawing.

Thanks for the resource! I've got that downloaded and ready to print.

A normal LED will pass current and start lighting up with a couple of milliamps, as you increase the supplied voltage, it gets to a point where the forward voltage stabilises at its Vf - forward voltage - it is a diode remember , if you keep supplyiing more voltage it will effectivly be shorting out any voltage higher than its Vf, so it will try and drag the supply down to its Vf.

Dead LED !

By calculating the resistor by Ohms law, the supply voltage - Vf / the max current for the LED, the LED will run within its limits.

Makes sense to me now.

As for hardware for various projects , you can buy "shields", but its cheaper just to make up a quick interface board from Vero or Perforated board, with header pins to plug into your Arduino. I have dozens of these now, all cut from one sheet of Veroboard.

All the end products I make I use a pcb and chip socket, but no USB. I program the chips in the Arduino socket, and plug them into the PCBs.

That's a little beyond my scope at the moment, but i'm sure i'll get there soon enough.

KirAsh4: If you have a large enough breadboard, you don't need a project box to mount the LEDs and switches on, just stick them in the breadboard and off you go.

My only thought was that the specific switches I have now will not mount onto a breadboard. I should probably buy new switches anyways, the ones I have are pretty bootleg.

As for the LEDs you've burned out, the voltage you read off of their package, or datasheet, that's the voltage needed to drive it. The resistor is there to control the amount of Amps flowing through it (or milliamps in most cases.) LEDs can only take so much. And you can not feed the exact voltage to a LED based on it's specifications, you have to supply more.

Is there any way to test the LEDs to see what their driving voltage should be? Furthermore what about testing for safe amounts of current? I mention this, because the ghetto LEDs I have at the moment never came with any datasheets or info. I do have hundreds of them though in various color batches, so I can run tests to figure things out without worrying about loosing a few (or ten) of each

I'll edit my original post, as you guys have solved some of my questions.

I do have a new question though. What is a popular online store for DIY things like breadboards? I'm in Canada if that makes a difference.

Panici: Is there any way to test the LEDs to see what their driving voltage should be? Furthermore what about testing for safe amounts of current? I mention this, because the ghetto LEDs I have at the moment never came with any datasheets or info. I do have hundreds of them though in various color batches, so I can run tests to figure things out without worrying about loosing a few (or ten) of each

The voltage drop across an LED is fundamentally linked to the colour - the electron has to give up enough energy across the junction to generate a photon of the right wavelength:

shorter wavelength = more energy = greater voltage drop.

You can therefore take a very good guess at what the working voltage drop for any LED should be based upon its colour. The further up the rainbow you go the more voltage you need.

To test them, start with a 5V suppy and a 500 Ohm resistor. This will give you between 4 and 8 mA through essentially any LED - enough to light it but not enough to burn it out. Use this to test the colour.

Once you know the colour you can guess the working voltage:

Infra-red* ~1V red - ~1.7V Yellow ~2V Yellowygreen ~2.4V Deep Green - ~2.8V Blue / White / Violet ~3.2V Ultraviolet** ~3.5V

Most LEDs can handle around 20mA but 10mA is usually enough to light them quite brightly. Therefore if you use the above voltage drops in the calculations given in the earlier replies, aiming for a current between 10 & 20 mA, then you will light your LEDs brightly without risking burning them out.

  • IR LEDs are not so easy to colour-test! **Normal UV LEDs show some deep violet light and will make a highlighter pen line fluoresce.

Panici: (As a side note, can the Arduino be coded with VHDL? I've barely studied the stuff, but it'll be on my final exam and it'd be great to mess with it at home on my own hardware)

No, VHDL is a hardware description language. The Arduino is a microcontroller which is a set hardware implementation.

In theory, you could use VHDL to describe the ATmega328s hardware, but you would still need to write software to do anything with it. (this is how ARM processors get embedded into ASICs and FPGAs).

Re the LED voltage, if you have a general purpose multimeter switched to continuity, and connect the leads across the LED, It will light dimly ( the right way round ) and the display will give you an idea of the forward voltage ( for a dim LED ) add 10% to the reading displayed.

Of course modern multimeters might be different, mine is 20 years old ! ( thats when I upgraded to a digital meter ! )

Dr_Ugi: The voltage drop across an LED is fundamentally linked to the colour - the electron has to give up enough energy across the junction to generate a photon of the right wavelength:

shorter wavelength = more energy = greater voltage drop. ...

Great info!, it does make sense, wavelength relating to voltage.

[quote author=James C4S link=topic=80206.msg606055#msg606055 date=1322234683] No, VHDL is a hardware description language. The Arduino is a microcontroller which is a set hardware implementation.

In theory, you could use VHDL to describe the ATmega328s hardware, but you would still need to write software to do anything with it. (this is how ARM processors get embedded into ASICs and FPGAs).

Ah, gotcha. [/quote]

Boffin1: Re the LED voltage, if you have a general purpose multimeter switched to continuity, and connect the leads across the LED, It will light dimly ( the right way round ) and the display will give you an idea of the forward voltage ( for a dim LED ) add 10% to the reading displayed.

Of course modern multimeters might be different, mine is 20 years old ! ( thats when I upgraded to a digital meter ! )

Interesting idea. I'll give that a go and let you know!

I'm just going to restate my unanswered questions here -Is there anything else I should get to be starting on basic projects? Basic pack of resistors / other discreet components?

-Will I need a seperate powersupply?

-What is a popular online store for DIY things like breadboards? I'm in Canada if that makes a difference.

Here is a very good deal for a good assortment of components to get you started: http://arduino-direct.com/sunshop/index.php?l=product_detail&p=109

This is a good Canadian source for components: http://www.dipmicro.com/store/

Also check out Adafruit and Sparkfun. A little more expensive than the other sources but they have some good and unique offerings.

An appropriately rated wall-wart makes a good power supply for projects.

again resistors

understanding you are on a student budget, you may want to keep your eye out for a free old pc, you can cheaply convert a desktop pc's power supply into a bench supply offering more voltages and amps than a wall wart.. if interested google "convert atx power supply bench" this is good if later on you want to control larger things like motors.

you can also find many old thru hole parts in other things like vcrs or very old printers.. many times I find old printers at garage sales for like 2$, I take the cartridges to a place called office depot that gives my 2$ of credit for each cartridge. I basically get my money back for the printer and can find some motors and gears. if your lucky its a old printer with some stepper motors, new models are using regular dc motor more and more often..

Yankee: Here is a very good deal for a good assortment of components to get you started: http://arduino-direct.com/sunshop/index.php?l=product_detail&p=109

This is a good Canadian source for components: http://www.dipmicro.com/store/

Also check out Adafruit and Sparkfun. A little more expensive than the other sources but they have some good and unique offerings.

Thanks for the sites. Any suggestions on a good breadboard to buy?

razrburn: understanding you are on a student budget, you may want to keep your eye out for a free old pc, you can cheaply convert a desktop pc's power supply into a bench supply offering more voltages and amps than a wall wart.. if interested google "convert atx power supply bench" this is good if later on you want to control larger things like motors.

I've got old computers at my parents place. I've definitely used the powersupplies before for +12v (jumper the green mobo wire to ground). Is the +5v rail suitable to power the Arduino unit?

Both Digi-Key (www.digikey.com) as well as Mouser (www.mouser.com) have a Canadian online store (which will give you Canadian prices.)

I'm having trouble finding breadboard specific components on Digi-Key and mouser. The sites aren't geared towards the beginner.

How does this look, as a starter kit of sorts. From Digi-Key.

Breadboard w/sized wires Twin Industries - TW-E41-1020

Resistor kit Yageo - Q15703

Couple of dip switches TE Connectivity - ADE0604 TE Connectivity - ADE0404

Some slide switches E-Switch - EG1218

Some push buttons E-Switch - 320E11BLK

Ok, none of those links work, at least when I click on them, it tells me part not found. When you find an item that interests you, it's best to post its part number. Each vendor has their own numbering system, but both Mouser as well as Digi-Key also give you the manufacturer's part number, so either should be fine. That way anyone can copy and paste and look it up on their web site.

As for breadboard specific parts, you have to tell it. For example, let's say I want to look for resistors.

I start off by typing either 'resistor' in the part search box, or the actual value that I want, say 100 ohms. From there, it gives me a listing of all the categories where that term shows up in. Since I'm only interested in resistors, I will scroll down to that section and pick 'Through Hole Resistors'. Voila, that's breadboard specific.

Now let's search for an LDO, or Low Drop-Out regulator (in case you want to take 12V down to say 5V, or to 3.3V). I start off searching for 'regulator'. They fall under 'power management integrated circuit', or 'PMIC'. Under the Integrated Circuit section, you'll see a line that says PMIC - Voltage Regulators - Linear (LDO). After clicking on that, you're faced with a display of everything available and options to narrow down your search at the top of the page. Since you're looking for breadboard specific only, your first criteria should be exactly that. Scroll to the right and you'll see one of the options is 'Mounting Type' - change it to Through Hole, and hit Apply Changes. Now your search results went from 36,000+ to 3,000+ ... BIG difference.

At this point you can refine your search even more and everything returned will be through hole, or breadboard friendly. Over time, you will start to understand the mayhem when it comes to the different components, and how places like Digi-Key and Mouser allows you to refine your search to drill down their extensive catalog. You could always order a catalog from them ... I have a Mouser one. It's big, it's thick (~ 3"), it's heavy. But it also contains everything they sell, in all their gory details. So you can sit in your most boring class and flip through it to find what you want (this is NOT my suggestion. :] )

KirAsh4: Ok, none of those links work, at least when I click on them, it tells me part not found. When you find an item that interests you, it's best to post its part number. Each vendor has their own numbering system, but both Mouser as well as Digi-Key also give you the manufacturer's part number, so either should be fine. That way anyone can copy and paste and look it up on their web site. .....

Thanks! That's a really good explanation. So Through-Hole is for breadboards, good to know.

I've edited my post to have manufacture part numbers instead of links.

Looks good enough. On the resistors though, you will soon find out that you want different values, especially when you're dealing with LEDs. More than just the '82's like that kit offers. Also, 10Ks are handy to have a bunch of.

You can get a few trim pots to act as variable resistors. You don't have to connect all 3 contacts. I get them 10 for US$1 which by now is about 25 cents Canadian?

You'll lose in the shipping on small orders but have a look at allelectronics.com. They're kind of a salvage house, don't have everything but mostly good prices on what they do which is much.

You want practice with VHDL? Maybe this will help, "GHDL -- Where VHDL meets gcc ". http://ghdl.free.fr/

GoForSmoke: You can get a few trim pots to act as variable resistors. You don't have to connect all 3 contacts. I get them 10 for US$1 which by now is about 25 cents Canadian?

Got a part number for trim pots that work well in a breadboard/with the arduino voltages?

I was able to -force- TPR-1k's into a breadboard without breaking anything, but it wasn't real easy. I was using them to adjust leds with 5Vcc. And... I actually only got 5 per $1. :-(

http://www.allelectronics.com/make-a-store/item/TPR-1K/1K-VERTICAL-ADJUST-TRIMMER/1.html

Some others, no, they would need wire leads soldered on. None of them I know can't take 5V 40 mA.

When you see leads on 5mm centers, 1mm is very close to .04" where breadboard holes are .1" apart. I had more trouble with he width of the legs but even without squeezing the legs in a crimp tool, they fit.

They have some with pins on .1" spacing but more expensive and the ones 10/$1 don't all just fit.

http://www.allelectronics.com/make-a-store/category/470100/Potentiometers/Trimmer/1.html

How much they can take, I don't know but I can say; more than a poor little IR led! Consider 5V 20mA is .1W

If you call and ask they do have an 888 number and I have gotten info when making phone order long ago.

Panici: I've got old computers at my parents place. I've definitely used the powersupplies before for +12v (jumper the green mobo wire to ground). Is the +5v rail suitable to power the Arduino unit?

yes the 5v+ rail is regulated at 5 volts which is safe, the 3.3v rail is unregulated so stick to the 5v rail, in my setup I have a arduino clone teensy from pjrc. running some 12 volt motors. all off the same power supply. in my conversion I added a few 5 amp fuses to prevent being slapped around with all 20 amps for long periods of time.