Hi,
I'm trying to play with my new Arduino Uno. I have refreshed my college electronics, and with my daughter spent the weekends with this hobby.
I've a couple of question, and hope somebody could reply to us.
1- When we make an Analogread of point between transistor and 10K resistor (see first attached) when the switch is not pressed, and send the data to serial.println, we read strange values, between 0 and 110. We think that this values must be close to 0 V, but they are erratic.
2- We try the same circuit, but with a capacitor as shows the attached pic (second one). we press the switch for a short time, and we want to see how the base voltage go down, making an analogRead in the same point before. But when we press the switch, the serial monitor freezes.
When the button is open it's output is left floating. To fix that you should put a full-down resistor between the output of the button and Ground. That way the output will be 0V when the switch is open and 5V when the switch is closed. Something like this is needed for every switch/button.
thank you very much for your reply!. we've just try it and works. We insert a 1M resistor, and the analogRead in the base is very close to 0 and stable.
Do you have any idea about the problem with capacitor and serial port?
we have checked that the circuit with capacitor runs fine, but when we push the switch, the serial monitor stops. If we close the serial monitor and try to run it again, the IDE says that "Serial COM3 not found. Are you sure that is selected the right Serial port in the tools menu?" (Please, see pic attached).
It's like the IDE is reseted.
100uF is pretty large - it looks like a short to Gnd when the switch is first pressed until it starts charging up.
Try putting a resistor between the switch and the cap to limit how much current can flow into the cap when it is discharged and the switch is closed.
FernandoG:
Do you have any idea about the problem with capacitor and serial port?
You're probably blowing the fuse... when you push that button down, you're creating a direct path between +5V and ground - that's gonna cause a lot of current to flow. Put your pull-down resistor in the right place to eliminate that.
The Uno has: a resettable polyfuse that protects your computer's USB ports from shorts and overcurrent. Although most computers provide their own internal protection, the fuse provides an extra layer of protection. If more than 500 mA is applied to the USB port, the fuse will automatically break the connection until the short or overload is removed.
So, if you were running it from a battery you would bypass that feature and possibly fry the chip. But, you said it's working, so it must be ok.
Yeah I have one of those, using it to run touch-screen stuff at the moment. The link I posted gives a good description of the hardware and explains about the USB fuse and everything else. The general rule is a little more complicated than "always put a resistor" and in some cases you'll need to use diodes to protect your Arduino - any time you hook up to anything "inductive" like a relay coil or a motor, you'll need a diode to protect the Arduino from reverse current spikes.
Personally, I think everyone should get one of these beginner kits and do all the little experiments, so you can pick up on some of those little details like that before you start trying to build your own circuits...
Of course,
Really, in this circuit I just use Arduino to power the circuit (5 V.-->Batt icon) and to read with analog pin 1 the value of the transistor base, as shows the attached pic.
I try that my daughter understands how the cap discharge little by little over the transistor base, so that light of the led is go down
I'm trying to explain me, but perhaps my english isn't enough.
I'm kinda confused... to me, it looks like your circuit would light up the LED regardless of the Arduino in the mix. Something isn't quite right... can you do a diagram like this one?
FernandoG:
I draw this diagram (attached). Arduino board is powered by Pc-USB.
Iniatially, the led is down. When I push the switch, the led shines, and it go down little by little when the cap is discharged.
i hope explain it right.
Thank You, jasmine.
Thanks, it makes more sense with that diagram. It is what I suspected. With that circuit, your LED is controlled by the button directly, and the Arduino is just acting as a power supply. The analog pin connection isn't doing anything. It certainly isn't capable of controlling the LED.
You can confirm this by replacing the Arduino with a 5V battery and you'll see your circuit acts the same.
The purpose of this circuit is try that my daughter understands the function of the capacitor. I want that she could see how the cap is slowly discharging, making that the led go down slowly.
She is studying basic electronics in school, and you know that is easier to learn this kind of things by mean of experiments, instead of just reading the school book.
FernandoG:
The purpose of this circuit is try that my daughter understands the function of the capacitor. I want that she could see how the cap is slowly discharging, making that the led go down slowly.
That is just basic electronics and doesn't require Arduino. You don't have the circuit designed properly to show the action of the capacitor - you've over-complicated it. All you need is the button, the LED, the resistor, and the capacitor IN PARALLEL with the LED.