Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Control a switch by microcontroller 16F877a

Status
Not open for further replies.

Oushahid

Newbie level 4
Newbie level 4
Joined
Jan 24, 2020
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
57
Hello everyone,
I have this project where I should put a switch between a powerbank and a phone, and I should be able to control it by a microcontroller.
So I found that a reed relay and a transistor is what I need but don"t have any refrences or idea of how to do it.
So any help would be very appreciated. thank you
 

Hi,

Millions of schematics for a simple transistor - relay - control are available in the internet.
Every detail of design is explained may thousand times.

I wonder how much time you spent to find a solution on your own.

Klaus
 

Thank you Klaus for your reply.
the reason I posted this is to get some help, to discuss if what Im doing is right or not, or if there is a better way, to get opinions and help of other people with much more expertise than me since Im kinda new to this.
and yes it took me sometime to know that I should use a relay.
 

pick a transistor whose CE or DS voltage is about twice the voltage of the powerbank
and whose Ic or Id is about twice what you expect the current in the relay coil to be.

pick a relay whose coli voltage is consistent with the powerbank
and whose contacts are rated for the about twice the voltage of the power bank
and whose current is about twice what the powerbank will provide to the load.

what is the voltage of the powerbank?
what current does the phone draw?
sketch the circuit, label the components, specify the manufacturer and the manufacturer's part number
write down how you think it works, then post all of that and ask your questions

please provide specific information about the porblem and your solution,
then the forum can help

the forum provides help, it doesn't do your work for you
 
thank you very much for the valuable informations ! And yes I do agree, I just needed directions for the path I should follow to make this work.
thank you so much again wwfeldman
 

Hello again,

as for what u've told me to do, here is where Im at for now :
Schema.png

the simulation is working, but I don't know if it's going to work perfectly in real life.

So the Powerbank voltage is 3.7V, and the phone draw a current of 1.5A max

- as for the transistor, I choosed BC547.
- a 5V relay

is it a good choice ?
 

Attachments

  • Schema.png
    Schema.png
    392.3 KB · Views: 131

Hi,


Values of capacitors for the XTAL need to be smaller by a factor of about 1.000.000.

Each bjt base needs a current limiting resistor.
Each LED needs a current limiting resistor.

What's the idea behind the GND symbol at the relay contact?
What's the expected relay coil current?

Klaus
 

Your Battery +ve is shorting to GND when relay is Off.
 

Thank you Klaus and baileychic for your reply.
Just out of curiosity, why the values of the capacitors of the XTAL should be smaller ? and indeed, I should've add the resistors for current limitation.
As for the relay coil current, I have a 5 volt rating and the coil resistance is 69Ω so the coil current is 5 / 69 = 72.4 mA. why ?
For the GND at the relay contact, the simulation didn't work without it. my battery is supposed to be a Powerbank.

thank you again guys for your time.
 

the ground on the off side of the relay is required so that the computer simulation has a reference
voltage from which to determine all the voltages in that branch of the circuit.

the ground connection could be anywhere in the branch.

does the simulation activate the relay when Q1 is on?
does the LED TT light up?

i'm thinking it doesn't because when the relay is activated, the "switch" is connected the other way,
and there is no reference in the PB branch of the circuit and the simulation would have a problem.
 

Hi,

Just out of curiosity, why the values of the capacitors of the XTAL should be smaller ? and indeed, I should've add the resistors for current limitation.
As for the relay coil current, I have a 5 volt rating and the coil resistance is 69Ω so the coil current is 5 / 69 = 72.4 mA. why ?
For the GND at the relay contact, the simulation didn't work without it. my battery is supposed to be a Powerbank.

This are more than basic questions.
* Generally you need to know what "voltage" and "current" means and how to calculate it.
* Then you need to read datasheets and keep on datasheet informations. Every one needs to do this, even we professionals. Every day.

-----------------------------
XTAL capacitors: are given in the XTAL datasheet. How to calculate them: in the according application notes.
And there are many millions of example circuits showing useful values.

BJT base resistors. Many online calculators are available. Many millions of example circuits showing useful values.
Coil current determines BJT collector current --> this determines useful BJT base current --> this determines useful base resistor values.

LED currents and voltages are given in it's datasheet. This determines the current limiting resistor values.
Many millions of example circuits showing useful values.

Why don't you use the internet? It gives all informations you need. Every datasheet, application note, online calculators, design examples....
For every tiny information you may find online tutorials, often even videos.
Use them ... this all is for free.

Imagine....more thirty years ago, when I learned electronics..there was no internet. This really was hard time.
Hard time to get informations like datasheets, electroncis courses, there even was no library around with according books.
Many trials and fails ... often with ugly smelling smoke.
Luck you - you have internet now. So use it.

Also you have the simulation tool. It's easy to measure (LED, BJT, battery...) current ... without smoke and fire and explosions.

Klaus
 

Thank you for your replay.
wwfeldman yes the simulation is working perfectly fine.
Klaus, thank you for the valuable informations. I will stop asking questions in here.
Just one final question, do you think that since this is on battery, I can just use a mosfet instead of a relay to avoid the cost of powering the coil while on ?
could a MOSFET do the work ?
 

if the voltage rating of the transistor (FET or BJT) is about 1.5 to 2 times
the voltage of the supply it will swtch, and the current rating of the
transistor (FET or BJT) is also 1.5 to 2 times the current you expect to
carry, then it should work.

you should add a resistor in series with the LED.
resistance = (source voltage - voltage drop across ON LED) / desired current in LED
 

Okey great !! thank you so much. I will do it correctly this time and let you know.
Thank you again
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top