Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: nynrah ghost on August 05, 2010, 03:38:28 PM

Title: $50 robot LED and UART question
Post by: nynrah ghost on August 05, 2010, 03:38:28 PM
In the schematics for the $50 robot I noticed that the LED is connected to the VCC pin (with it's + pin) of the ATMega8 without a resistor inbetween, so:
VCC pin -> LED -> Resistor

Instead of:
VCC pin -> Resistor -> LED

LEDs ussualy need resistors in series placed in front of them to prevent being fried and in this configuration it seems to me that it's connected to a 5V power bus, which causes me some confusion (being somewhat inexperienced when it comes to circuits). While this is a tried and proven circuit, I'd appreciate if someone could explain why the LED works in the $50 robot configuration.  :)

Concerning the UART module, I've taken a basic MAX232 circuit with some capacitors and wish to add a status LED for both Tx and Rx which are supposed to light up when the module is transmitting or receiving.

My initial idea was to place a small resistor and a LED on both the line between the Tx -> T1IN and Rx -> R1OUT.
My concern here however is that adding extra components in the path of the TTL signal might mess up the voltage levels up.

An other suggestion I based of the shifter RS-232 adapter (from SparkFun)  which would involve placing a resistor and a LED between the power bus VCC and the Tx -> T1IN line and another one between VCC and the Rx -> R1OUT line:

VCC -> resistor -> LED -> Rx or Tx line

I've added an image with the max232 circuit displayed twice. In both circuits I've highlighted the places where I would have the lines placed (and in circuit two I've crudely also painted the lines to VCC).

Could anybody tell me wether one of these circuits would work or have an alternate solution to add status LEDs?
Title: Re: $50 robot LED and UART question
Post by: Razor Concepts on August 05, 2010, 04:22:40 PM
For the $50 robot LED, it does not matter which way the resistor is, it can be either in front of or behind the LED. The same amount of current and voltage passes through either way. And remember electrons flow from negative to positive  ;)
Title: Re: $50 robot LED and UART question
Post by: Mansoor on August 06, 2010, 01:37:20 PM
wires are like water pipes filled with water even before they are connected to the battery. When a battery is connected, then you are applying a water pressure higher on one side than the other. so when there is somthing choking the flow of the water (resistor) anywhere in the water pipe, it limits the flow of water everywhere else in the pipe. i.e. the amount of water going into the pipe has to equal the amount going out. Hope this helps you imagine it better.

regarding the TX and RX. Iam not experienced in those. but I would think that taking current directly from them is a bad idea. But with a transistor this can be easily done. the transistor has a high input impedence and therefore should not take too much current away from the signal. then the transistor can act as a swtich for the LED. so in this case you would connect the gate of the transistor to the TX or RX and connect the LED and Resistor to VCC and Ground in seris with the transistor.

one thing to consider is the "paracitec" capacitence of the transistor (not sure if it has any or how much). I do not know at what rate the info is being transfered from the TX and RX but if ti is depedant on voltage pulses. then a capacitor will inhibit it from going high to low too quickly.

then again iam a beginner so do not implement this design and expect it to work  :D
Title: Re: $50 robot LED and UART question
Post by: Soeren on August 06, 2010, 09:11:38 PM
In the schematics for the $50 robot I noticed that the LED is connected to the VCC pin (with it's + pin) of the ATMega8 without a resistor inbetween, so:
VCC pin -> LED -> Resistor

Instead of:
VCC pin -> Resistor -> LED
Serial connections of passive components are a bit like addition and multiplying in basic math, doesn't care like 1+2=3 <=> 2+1=3
Whatever comes "first" is unimportant, electrically speaking. Exceptions exists, but you're a long way from having to know about them, so just consider a string of passive components OK if it has the needed parts.


Concerning the UART module, I've taken a basic MAX232 circuit with some capacitors and wish to add a status LED for both Tx and Rx which are supposed to light up when the module is transmitting or receiving.

My initial idea was to place a small resistor and a LED on both the line between the Tx -> T1IN and Rx -> R1OUT.
My concern here however is that adding extra components in the path of the TTL signal might mess up the voltage levels up.

An other suggestion I based of the shifter RS-232 adapter (from SparkFun)  which would involve placing a resistor and a LED between the power bus VCC and the Tx -> T1IN line and another one between VCC and the Rx -> R1OUT line:

VCC -> resistor -> LED -> Rx or Tx line

I've added an image with the max232 circuit displayed twice. In both circuits I've highlighted the places where I would have the lines placed (and in circuit two I've crudely also painted the lines to VCC).

Could anybody tell me wether one of these circuits would work or have an alternate solution to add status LEDs?
Neither of your ideas will work, due to loading the lines, but this (http://That.Homepage.dk/Img/MAX232_Stat_Mon.png) will
(http://That.Homepage.dk/Img/MAX232_Stat_Mon.png)

Personally, I'd use the second set of RX/TX in the chip, but the above circuit will be easier to understand for you I believe.

Your booster/pump caps are too small, if you're using a regular MAX232 (as you stated), better make them 1µF each.
I used 100nF in the circuit, so you can employ two of the ones you remove.

The reason you need caps in front of the transistors is, that otherwise a static "1" would make the LED light constantly, making it hard to discern from a fast flashing "comms ongoing" signal. This way, a static "1" will keep the LED off and only light the LED when there is actually some comms going on.
Title: Re: $50 robot LED and UART question
Post by: nynrah ghost on August 07, 2010, 05:59:53 AM
Thank you all for the replies. It all makes sense now. :)
Title: Re: $50 robot LED and UART question
Post by: Mansoor on August 08, 2010, 09:21:10 AM
I have a question. if the transistors are connected directly to the signal line TX & RX. instead of through resistors. Would this design work? is there some problem that will occur with out the resistors?
Title: Re: $50 robot LED and UART question
Post by: Soeren on August 08, 2010, 02:47:07 PM
Hi,

if the transistors are connected directly to the signal line TX & RX. instead of through resistors. Would this design work? is there some problem that will occur with out the resistors?
If you have control of the baud rate and have the circuit on your own table (so you're able to fine tune), you could calculate the capacitors to replace R2 and R5, but you need either resistance or capacitive reactance of a certain size to avoid loading the data lines.

As I haven't control over how it would be made, I opted for a cap larger than needed (to get a low(ish) capacitive reactance and let the resistors (R2 and R5) do  the job, as they're not frequency dependant like the caps.
Title: Re: $50 robot LED and UART question
Post by: Mansoor on August 09, 2010, 12:35:32 PM
interesting.. I thought that the larger capacitance will filter out high frequency changes in voltage. so if the baud rate is high, the information will be distorted due to the capacitor resisting fast changes in voltage. and since the voltage is equal in an ideal wire. the info being transmitted and received will be destroyed? Also the 100 k resistor is a pull down resistor right?

if the tx and rx lines are connected as shown with the pull down resistor, but the wire connecting the tx and rx to the transistors does not have any capacitor or resistor, would this be a problem? doesn't the transistor have high input impedance? so that it will not load the TX and RX lines. In this case i know that a static one will keep the LED on which is not good but other than that is there any adverse impact?
Title: Re: $50 robot LED and UART question
Post by: Soeren on August 10, 2010, 03:57:30 PM
Hi,

interesting.. I thought that the larger capacitance will filter out high frequency changes in voltage. so if the baud rate is high, the information will be distorted due to the capacitor resisting fast changes in voltage. and since the voltage is equal in an ideal wire. the info being transmitted and received will be destroyed?
You need to learn about basic AC circuitry.
The reactance of a capacitor is reciprocal to the frequency i.e. the higher the frequency, the lower the reactance (reactance is what you could call AC resistance). The exact opposite of what you describe.


Also the 100 k resistor is a pull down resistor right?
You may call it so if you wish.


if the tx and rx lines are connected as shown with the pull down resistor, but the wire connecting the tx and rx to the transistors does not have any capacitor or resistor, would this be a problem?
What do you think "you need either resistance or capacitive reactance of a certain size to avoid loading the data lines." mean?


doesn't the transistor have high input impedance? so that it will not load the TX and RX lines.
No, it has a base-emitter voltage of ~0.65V, which it would pull the data lines down to.


In this case i know that a static one will keep the LED on which is not good but other than that is there any adverse impact?
Yes, as I mentioned, it won't work.

It's quite disappointing, that very often, some newbie will ask "is it OK to cut half the components away"!
I design for the utmost minimum that will make a stable circuit, so in general, NO, you cannot reduce it, I allready did.
Why would you even think about cutting anything away, this is a very small circuit.
Title: Re: $50 robot LED and UART question
Post by: Mansoor on August 15, 2010, 05:48:27 PM
Thanks for taking the time!

sorry for my nobeness. I like to find out what happens when certain parts of the circuit are removed. to better understand what they do that is all.

I know that the reactance of a cap is 1/wjC and that is a property of how current limiting the cap is in AC. but I also know that capacitors resist change in voltage by channeling current through them. which i thought would load the line (keep voltage low) but i did not take into consideration the resistors which follow the cap, which would keep current low and allow the line to go high. if mosfets are used instead of transistors. would any of the resistors still be needed?
Title: Re: $50 robot LED and UART question
Post by: Soeren on August 17, 2010, 08:16:00 PM
Hi,

I know that the reactance of a cap is 1/wjC and that is a property of how current limiting the cap is in AC. but I also know that capacitors resist change in voltage by channeling current through them.
"Channelling" current through them is the quite opposite of resisting current through them, so stick to the capacitive reactance - that's the AC equivalent of the resistors resistance and covers both "instances" without inventing more explanatory models.


[...] if mosfets are used instead of transistors. would any of the resistors still be needed?
All of them - there's no magic in MOSFETs (even though a lot of people seem to think so ;D). They have their fields of application where they excel, but there's also a lot of places where choosing a MOSFET over a BjT is seriously bad design.

Perhaps you should consult your local library for some basic text books on electronics. A web board is not really a forum for explaining each and every aspect, tutoring up beginners in whatever they need to learn - a certain amount of foot work is expected on your side - then come ask when you reach a dead end.

If your local library is less helpfull, at least there is http://www.allaboutcircuits.com/ (http://www.allaboutcircuits.com/)
Read through (all) the tutorials and experiment along the way.