Author Topic: More basic electronics and $50 robot questions.  (Read 3637 times)

0 Members and 1 Guest are viewing this topic.

Offline ribsTopic starter

  • Jr. Member
  • **
  • Posts: 24
  • Helpful? 0
More basic electronics and $50 robot questions.
« on: June 19, 2007, 02:38:13 AM »
Hi, everything is going great with the $50 robot so far.  Thanks so much for everybody's help so far (and the admin for setting up the tutorial in the first place!).  It's really been great.

I have yet more questions - electricity is still quite unintuitive to me still; hope these questions aren't getting old fast:

1) If I send a high signal from a microcontroller output is it always the same voltage as the input VCC?  i.e. if I send 5V to the microcontroller and send a high signal out (say, to control the LED), is it also 5V?

2) What kind of current can go through a microcontroller?  Apparently it is safe to power the LED from current passing through the microcontroller, but I assume it probably would be a bad idea to wire one of the outputs, say, PD0 to my servo power wire and expect it to run, correct?  Is there a ballpark figure for what's safe and not?

3) I just wanted to try some electrical math for practice before I plug it in for real.  The LED in the $50 robot is wired from a microcontroller output PD4 through a 340 ohm resistor into the 5V bus.  That means if PD4 is low I have 5V differential, so V=IR so I=5/340 = 14.7milliamps.  The LED (says digikey.com) is rated at 20milliamps, so that means it will light up, but a little dim, right?  Digikey also says it is rated at 1.8V - does that mean sending 5V through it will blow it up?

4) Is it bad to discharge a capacitor by shorting it?  Is it bad to depower my circuit but leave my capacitor charged up for a long time?

5) The big capacitor on this $50 robot - that's the one that is protecting from large power draws from reversing the servos, correct?

6) What's the little capactor for (the one between ground and 5V)?


Thanks, and sorry if any of these questions are obvious!

--
Ken

Offline hazzer123

  • Supreme Robot
  • *****
  • Posts: 460
  • Helpful? 3
Re: More basic electronics and $50 robot questions.
« Reply #1 on: June 19, 2007, 04:18:44 AM »
Hey

1) Yep i should think so.

2) Ive just checked the data sheet for a PIC (should be similar i think) and the max current it can source/sink is 400mA. That isn't from each i/o port though. Thats all of them combined. So yeh to power anything more current thirsty than a few LEDs, some other method should be used.

3)Hmmm i havent seen a 1.8V LED before. But IIRC its current that kills semiconductors mostly, not the voltage as much.

4) Yes because it produces enormous aounts of currents and if the capacitor is big enough is can blow up! You should generally use a resistor across the terminals to discharge. Once the circuit is powered down, the capacitors will gradually discharge themselves.

5) It is like a backup source that will provide more power when needed. Say your motors are sinking loads of current, the capacitor will provide that little bit extra to your circuit, that the battery may not have, and therefore stop bad things happening (microcontroller resetting for eg).

6) It basically absorbs all the little inconsistancies in the voltage source, giving the micrcontroller a very steady VREF etc for ADC measurements. Its very common to find a few of these 100nF caps in circuit.

Hope it helps :)
Imperial College Robotics Society
www.icrobotics.co.uk

Offline dunk

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 1,086
  • Helpful? 21
    • dunk's robot
Re: More basic electronics and $50 robot questions.
« Reply #2 on: June 19, 2007, 10:26:44 AM »
hi ribs,
so hazzer123 covered most of your questions.
i have a little more detail on 3.

the LED also has a resistance.
the combined resistance in your formula should be the resistance of the resistor *plus* the resistance of the LED.

so if Digikey says the LED meant to get 20mA @ 1.8V it should in theory have a resistance of 1.8/0.02 = 90 Ohms.
V/I = R   (Voltage/Current = Resistance)

so, when you connect multiple resistors in series across a power source they form a voltage divider.
you want to choose a resistor that "uses" 3.2Volts and leaves 1.8V free for the LED.
the current flowing through the components will be the same.

the voltage drop across each component is directly proportional to the resistance of that component.

so to find your ideal resistor value, you are going to want to find what resistance will let 20mA flow at 5V.
R1 = resistance of resistor = unknown.
R2 = resistance of LED = 90 Ohms.
V = voltage = 5V
I = Current = 20mA = 0.02Amps

V/I = R1 + R2

5/0.02 = R1 + 90
R1 = 160 Ohms.

or that's how i remember my high school physics.

dunk.

Offline bridleman4

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
Re: More basic electronics and $50 robot questions.
« Reply #3 on: June 19, 2007, 12:14:11 PM »
The $50 robot is working out for me so far, but I've hit a roadblock because sparkfun.com is out of "AVR STK Serial Port
Dongle Programmer" cables and has been for a couple of weeks now.  I don't know when they'll be back in stock, and the other recommended cable, AVR ISP2 Programmer, is too pricey for me.  I found this cable on eBay at http://cgi.ebay.com/STK-compatible-ATMEL-AVR-programmer-AVR-Tiny-Mega_W0QQitemZ120131263252QQihZ002QQcategoryZ1504QQssPageNameZWDVWQQrdZ1QQcmdZViewItem#ebayphotohosting

Is it the same thing?  Will it work for what I'm trying to do?

Offline ribsTopic starter

  • Jr. Member
  • **
  • Posts: 24
  • Helpful? 0
Re: More basic electronics and $50 robot questions.
« Reply #4 on: June 19, 2007, 12:31:09 PM »
Awesome - thanks to both of you!

I need to get better at gleaning information from datasheets and other documents.  Before I posted the first message I spent some time poring through the ~300 page atmega8 manual and couldn't really find any information other than the current draw, which I was guessing was how much current it takes to run, not how much current it can pass through...

Thanks for the info on the capacitors.  So I should not worry about discharging the capacitors after I unplug everything - but I should probably make sure not to accidentally short it with a multimeter probe or something until it has mostly discharged.  And in general I should throw a 1uF capacitor between VCC and ground of any microcontroller I use in the future.

The LED:
So the resistor in series with my LED is 340 ohm, not 160, so that means the voltage drop over the 90 ohm LED is 90/(90+340)*5V = 1.0465V, which means the current going through it is 1.0465/90 = 11.6milliamps, correct?  I take it LEDs are not very picky about exactly how much current it takes to light it up?  i.e. sending 11.6mA through a 20mA rated LED will still make it light up?

Thanks.

Offline Eco19R

  • Full Member
  • ***
  • Posts: 104
  • Helpful? 0
Re: More basic electronics and $50 robot questions.
« Reply #5 on: June 19, 2007, 12:34:19 PM »
It will light up, maybe not super bright though.

 


Get Your Ad Here