My first real project

Go To Last Post
24 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Everyone,

I need some help with a circuit design, now this is my first attempt at making something to last not just a bit of fun and learning to be kind please.

Basically it gets 3 inputs from a truck which controls other features on the vehicle depending on the inputs. I am trying to make this compatible with 12V and 24V thats why i went for the zener diodes on the inputs.

There are 4 outputs, 2 control relays, one outputs power to the hazard lights and the other is basically a ignition cut for the radio.

I have some electronics knowledge but is not the best. All comments would be appreciated.

Thanks in advance.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

quick read.. to be more robust, I suggest much more filtering of transient spikes on both input and output signals. Need ways to dump spikes of hundreds of volts either + or - relative to GND.

On the DC input - need to protect here too from big spikes. More so that on the input signals. And by some means, protect from low voltage - too low for regulator to cope with, so that the function of the microprocessor is predictable and it's output signals cannot thrash.

The SAE has specs on what voltage spikes to cope with. You'll be amazed at how much EMF and other junk get on the lines - even light bulb back-EMF. Designs I've seen put L and C on all I/O lines and a big L/C on the 12V power in, and are careful about what GND they use. Or they opto-isolate I/Os.
----
You might want to bring Ignition-On into the microprocessor. Often that affects behavior or at least low-power/sleeping mode.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks very much for the feedback. I was worried about spikes and EMF but was unsure what i need to do to protect the circuit. I have googled looking for information but am unsure exactly what i am looking for.

If you know of links that would be appreciated.

Thanks again.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

cwilson wrote:
Hi Everyone,

I need some help with a circuit design, now this is my first attempt at making something to last not just a bit of fun and learning to be kind please.

Basically it gets 3 inputs from a truck which controls other features on the vehicle depending on the inputs. I am trying to make this compatible with 12V and 24V thats why i went for the zener diodes on the inputs.

There are 4 outputs, 2 control relays, one outputs power to the hazard lights and the other is basically a ignition cut for the radio.

I have some electronics knowledge but is not the best. All comments would be appreciated.

Thanks in advance.

I suspect that Q1 and Q2 will not do what you desire. The output from the processor will go up to +5V the output from Q1 emitter will only go to about 3V (assuming 12/24 on the collector). Q2 has an additional diode drop so will be even more limited. Did you want them to go to 12V?

Are the diodes intended to clamp the back EMF from the relays? If so they are not wired correctly - the cathode should go to the collector and the anode to +12/24.

Be careful of how much current the hazard lights take - they may be more than the transistors can take, especially if they don't have heat sinks.

For the 12V input for the power I normally have a series diode and resistor with a relatively large capacitor where C2 is (10uF or more) to limit any spikes.

Put a pullup on the reset line.

How do you program the processor? I would put a 6 pin header for ISP programming.

kevin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well i am an auto electrician so i always use relays and find it a little hard to find the same sort of thing in electronics to do basic switching without fitting relays.

Ok i will add an ISP is there a common order that the ISP is connected to the 6 pin header

I have added a 470uF cap on the input and a series diode but what size input resistor would be ok to use? Something around 10ohms?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Cwilson,

AVR Application Note 042, AVR042 , shows the 6 and 10 pin ISP headers in Section 4. Use the 6-Pin header, the 10 pin header has no advantage, and takes up more room.

Note carefully that the illustrations are TOP down views.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can you better explain your concept for Q1 and Q2?

I think you also should label your I/Os on the left with more meaningful names then WIRE_UP_X - it is hard to read.

Watch power dissipation. At 24V with the transistors on, the 7805 is going to dissipate some power.

Your reset line should have a pullup resistor to vcc. I would recommend a 0.1uF capacitor for each VCC and AVCC.

oddbudman

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the link to the datasheet. It has helped sort out the ISP connections.

Just need to find info on protection from spikes and emf if anyone can help please.

thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here is an updated diagram, hope it is better. :D

Q1 - is used to cut a positive circuit in a vehicle but looking into it more, i am going to have to put a relay in i would say. The collector would have either 12/24V on it depending on the application.

Q2 - I was trying to use to output the vehicle voltage to just supply an activation to the hazard switch.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Basic transistor rule of thumb : when transistor is on, there is ALWAYS about 0.5 to 0.7 volts from base to emitter (Vbe).

Therefore, when your AVR controls the transistor base with either 0V for OFF and 5V for ON, the emitter is going to be 4.3V to 4.5V.

So they way you are doing it, you won't get 12V output.

Also, how big currents you plan to drive with the TIP41C transistors?

An AVR can only drive about 20mA to it's output pin. Based on transistor current gain ratings of 15-100, you are able to drive something between 300mA and 2A.

You need some kind of buffer (more transistors) between AVR and TIP41C if you plan to drive more than 300mA.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok here is an updated circuit diagram. All comments welcome, and i will go back and do a refresher on transistors :( .

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the links it was very interesting and helpful. Might have to do some more circuit protection by the looks of it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Q1 and Q4 are only protected from negative spikes. So if you are driving inductive loads like relays, you should also protect from positive spikes like Q2 and Q3 are with the diodes - from collector to 12/24V.

And as you have 1kohm base transistors, with Vbe drop approximated 0.7V, you are going to get 4.3mA base current. Again, taking a look at the transistor current transfer ratios, you need minimum of 3mA and maximum of 10mA to control 300mA.

Some big relays can cause big spikes so many people put 100nF capacitors over the relay too if the diode is slow.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok thanks for that i will do some more changes and see what it's like then.

Also i wam going to be driving one external relay which is going to be an automotive mini relay 30A.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here is my latest update all comments welcome.
As usual this forum has been quite helpful and educational all in one.

Thanks in advance

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry i attached an old diagram.

Here's the lastest.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Add a capacitor across R4, R5 and R7. This will give you a low-pass filter, helping to reduce spikes.

R8, R9 and R10 could probably be made larger. The inputs are high-impedance and the larger these resistors are the less energy/spikes/magic-smoke-releasing-badness will get through.

You could replace D1, D3, Q1 and Q4 with something like a ULN2003 darlington driver.

Do you need to regulate "Ignition" input in to allow for 12/24V or will you change the relays?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can get large transients on the vehicle supply which will cause the MCU to do strange things. You should filter the +ve and -ve supply inputs, and use transient suppression on the regulated 5V supply. The 5V regulator might get very hot with a 24V supply, you need to calculate how much power it will be dissipating. A fuse would be a good idea, as well.

Leon

Leon Heller G1HSM

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok here's another revision and also I will be making a 12V and 24V version.

Does anyone have a better way of stepping the 24V down to 5V (for Micro)so that the i dont create too much heat.

Thanks again.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

D3 and D4 are superfluous, included in ULN.
Not that the internal flyback diodes can have weird effects, make sure Q1 and Q4 never rise above CD+ or they'll start to conduct. I can attach the ULN spec sheet if you want.

You'll need current limiting resistors on the inputs of the ULN. It's a Darlington driver with a gain of at least 1000, so you don't need much current.

re: power regulation, simple way is a series regulator (like you have).

Power = Volts * Current, so if you drop 19V try to keep the amps low and/or provide heat-sinking (TO3 with a good heat-sink located to get adequate airflow). Nothing else you can do ("ya canna change the laws of physics!").

You should be OK though, the 5V part of the circuit shouldn't need much current.

The alternative is a DC-DC converter, they run at 90+% efficiency so power dissipation should be minimal. Haven't played with them myself, can't recommend one.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok thanks for that sprink, here's another revision is this a little better? I have added a resistor into the supply line to drop a bit of the voltage before it gets to the voltage regulator.

Comments welcome.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How much current are you expecting the 7805 to draw?

R1, R2, R3 and R6 can probably be set a bit higher which will reduce current draw on the 7805.

I'd still bump up R8/R9/R10/R16, the higher these are the better protected your circuit. What's the input impedance of the TINY26LP?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here we go again, revision 21 lol. Thanks again sprink for the help it is most appreciated. Any other comments welcome.

Attachment(s):