I have an Arduino R4 Wifi. I have only just bought it so I need to check to make sure I do not burn it out. I obviously cannot run a 5v power relay directly from the board (resistance is only 70 ohms!) I have therefore done this:
I don't understand your circuit, what do you want to do? What pins on the relay do you connect with the transistor? But it is right, even better, it is necessary to connect the - of the battery to the ground of the Arduino.
Oops sorry, I missed the point of the power relay switch. I just showed the coil for operating the relay. It is just a bog standard relay, so the switch is capable of handling even mains electrical appliances, or lights. Obviously I know that is safe because it is separated from the electronic stuff, and is literally just a switch.
Oh I forgot to mention! I have already tested it on 2 external power sources (emulating what the Arduino would do). It did all work ok, but I agree with you, I think I should consider a smaller base resistor. When I first did it, the base resistor was so high it barely even switched on C/E junction. I am a bit rusty to be honest. Been some time since I did this stuff.
Arduino's have a build in overload protection, although certainly not perfect, simple circuit as this should trigger the protection with an overload. The Arduino just will keep resetting. That's a sign to cut the power and asses the circuit again to make sure you didn't make any mistakes. But if you want to be sure, feel free to ask on the forum.
Oh, I did mention that I forgot to put it into the diagram in the comment at the end (silly me). It is in there now already in the actual hardware. But, thank you all the same.
That gives me a little more piece of mind thank you. I will avoid doing anything silly though of course. I was very daft in that I looked at a stack exchange post with regards to the current the GPIOs can handle. That said 40ma, and when I checked the datasheet for the R4 Wifi, it is indeed 8ma. Yikes!
What is the general gist of what you are saying? Are you stating that it is still highly likely that if you overload GPIOs (above about 8ma) it can still break them?
Right OK. This was why I was so careful to use a high resistor on the base. I thought that it was better to simply operate the transistor switch, rather than potentially draw too much current. There is a laziness element on my behalf, because I should actually be concentrating on the math. In future development, I will endeavor to be more precise. Most of this development phase, I was just simply getting it to work.
Always, do the math. 8 ma, 5V means what min resistance, placed between pin and either 5V or GND? 625 ohms. Given that you are driving an NPN transistor, the voltage across the resistor will be less, so you will draw even less current. So 1K is more than safe.