Arduino dummie

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.

The skectch we’re using is very simple:

void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.println(analogRead(1));
delay(250);
}

I would be very grateful if someone could tell me if I’m misunderstanding or doing something wrong.

Thanks and regards

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.

Dear John,

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.

Thanks a lot!!

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.

Jasmine, Moderator:
Your're right!! With a resistor between cap and switch works fine!!

Thanks a lot!!

Do you think i've broken my Arduino trying without resistor?

Thanks a lot again!!!!

FernandoG:
Do you think i've broken my Arduino trying without resistor?

Depends on which board and how you power it:

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.

Hi, Jasmine,

the board is an Arduino Uno, and usually I power it with the USB of my PC.

And It seems working fine. (crossing fingers). I've learnt the lesson for the next time: Protect all the circuits with resistors.

Thanks a lot for your reply!

Best regards

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...

Hi Again,

just to be sure and trespassing on your patience:

is the right way as the pic?

Thank you very much again!!!

Well, I'm not sure, can you put the Arduino in your diagram, and show which wires connect to which pins?

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.

Thank you, Jasmine.

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?

Hi, Jasmine,

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.

FernandoG:
Jasmine, Moderator:
Your're right!! With a resistor between cap and switch works fine!!

Thanks a lot!!

Do you think i've broken my Arduino trying without resistor?

Thanks a lot again!!!!

Nope, all that happens is the voltage level from usb drops causing the board to reset (along with the usb to serial ic) ..

Is the polyfuse causing it? I doubt it get's hot enough fast enough .

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.

I think what you want to do is combine these two examples...
http://arduino.cc/en/Tutorial/Fade (controlling an LED brightness with PWM)
http://arduino.cc/en/Tutorial/Debounce (responding to a button)

Dear Jasmine,

thank you for your explanation and help.

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.

Thank you

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.

This web site shows the circuit. When you push the button the LED will be on, but when you release the button, the LED will fade slowly.
http://ee.onepotcooking.com/circuit-examples/circuit-with-led-and-capacitor-decay_02052013.html