Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

short pulse ---> long hi signal

Status
Not open for further replies.
If i drive the relay by a PNP if the pic goes down the relay will switch on and may cause a fire??? I would rather a positive output.

The PIC could do the 1.5second output to directly switch the transistor for the relay but to be honest the PIC has enough to do and I don't want to write another inturrupt to switch it off,

Possible I could get 25 556's I just wanted to know was there a cheaper and easier way. Obviously if I have to buy the 556 timer I also need all the surrounding components aswell.

Jason
 
There is another way to do it that only requires 1 R and 1 C and a Flip Flop IC.

You did not answer my question re the number of PICs and delays.

I have to go out for an hour or so. I'll tune in when I return.
 
Another thought came to mind. You could do the timing with the relay.

This would require an R and C in series across the coil.
 
I'm using about 12 PIC's all on a CAN network, The PIC that will be controlling this function will have limited i/o so the less I can use for each relay will be great.

Yeah I could use the PIC to directly control the 1.5 delay but I have limited inturrupts and to be honest I'm struggerling with the inturrupts I have (not enough) so having to make another one for the 1.5 seconds delay will be a bit of a problem. Also the other problem I have is cos I'll be controlling over 50 relays some relays might switch on together and then I have to control which one I need to switch off .... etc....

It just seems a hell of alot easier to do this function by hardware.

Jason
 
So does one PIC control 4 relays, ie. 4 * 12 = 48 relays?

Or does each PIC control 50 relays?

Does the PIC ever have to operate 2 or more relays at the same moment?

Have you considered using a mux to reduce the number of i/o? Note that a MUX can only be used to operate one relay at a time, but several could be operated in rapid succession.

What is the relay supply voltage?

What is the resistance of the relay coil?
 
thought about using a MUX but don't have to yet,

2 PIC's control around 50 relays, and yes I'll be controlling more then 2 relays at the same time (well within rapid succession)

The relay is 12V and the coil is 120 Ohms.
 
I assume one PIC controls 25 relays and the other the other 25?

Are both PICs on the same PCB?

A Shift Register would be an alternative to the MUX.

If you operate one or more relays at once, is it likely that you will have to operate another relay within the next 1.5 Sec?

What I have in mind is that you may only need one hardware timer (or possibly one per PIC) so the PIC would operate one or more relays and then, if it has to operate more, check whether the timer is still active, and if so, wait until it expires. You would of course need one more i/o line to monitor the timer.
 
Last edited:
Thanks ljcox

This is a very good idea but I'll be controlling relays as the same time, i.e. I might switch a relay on, then 10 seconds later I might switch another, 750mS later I'll switch another 50mS I'll switch another and so on.

If there was gonna be a 1.5S gap between each Relay being active this would work a treat. The problem is the Relay switching will be completly random.

If you can help anymore I would appriecate it.

Thank you, Jason
 
hi jason,
quote:
If i drive the relay by a PNP if the pic goes down the relay will switch on and may cause a fire??? I would rather a positive output.

Regarding PIC failure, it is also possible that the PIC output could fail in the +V output state as well as the 0v state.

If the failure of the PIC could cause a fire, your basic system is flawed.

You should re-examine the relays rating, if its continously rated and run at the correct voltage,
within its specified operating temperature, it should NOT catch fire.

Any idea why it gets hot???

Are using a relay with only an 'intermittent use' rating??

Eric
 
Last edited:
Jason,
I've been thinking further about your project.

Correct me if I'm wrong, but I assume the reason why you have 2 PICs is because one PIC does not have enough i/o to drive the 50 relays.

If so, then it should be possible to drive the relays and do the timing in one PIC and do everything else in the other.

How? Use 8 bit serial in/parallel out Shift Registers (such as the 4015) to drive some of the relays.

For example, 3 SR would drive 24 relays leaving 26 to be driven directly by the PIC.

Alternatively, 4 SR would drive 32 relays leaving 18 to be driven directly by the PIC.

etc.

You need 2 i/o for the data and clock signals.

The SR can be reset either by a simple sub routine which is called during the PIC initialisation phase, or by using another i/o to do a hardware reset.

Since relays take several milliseconds to operate or release, then they will not "chatter" if the data is clocked into the SRs quickly. For example, if you use 4 SRs and a 100 kHz clock rate, then the SRs will be loaded in about 320 :mu: s.

Remember that the clock does not have to be regular. In other words, the time between clock pulses can vary when the PIC has extra functions to perform such as moving data from the storage register to the output register.
 
huttojb said:
This is a very good idea but I'll be controlling relays as the same time, i.e. I might switch a relay on, then 10 seconds later I might switch another, 750mS later I'll switch another 50mS I'll switch another and so on.

If there was gonna be a 1.5S gap between each Relay being active this would work a treat. The problem is the Relay switching will be completly random.
Jason,
If it is possible to operate only one relay at a time, then there is a solution that will significantly reduce the hardware and you probably don't need 2 PICs.

You could arrange the relay coils in a matrix.

49 relays could be arranged in a 7 * 7 matrix and the 50th would be driven directly.

Thus you would only need 15 i/o.

There would be 7 PNP (or P channel MOSFETs) driving the +12V side and 7 NPN (or N channel MOSFETs) driving the gnd side, plus one transistor driving the 50th relay.
 
Last edited:
ericgibbs said:
Regarding PIC failure, it is also possible that the PIC output could fail in the +V output state as well as the 0v state.

If the failure of the PIC could cause a fire, your basic system is flawed.

You should re-examine the relays rating, if its continously rated and run at the correct voltage, within its specified operating temperature, it should NOT catch fire.

Any idea why it gets hot???

Are using a relay with only an 'intermittent use' rating??

Eric
I agree with these statments.
 
There seems like you all have a concern about the heat of the relay. I'll explain more, the relay isn't a relay, but it works like a relay so this is why I said this as it was easier to explain.

The component is a Model Railway Point switching module, it has 2 coils and if you energise the one coil the point moves left, if you energise the second the point moves right.

Obviously you only need to activate the coil enough time for the bar to switch from the one side to the other, if you energise the coil for long periods of time it does get hot.

I agree what you say about the shift reg's but I'm not sure how one works so this why I've shyed away from this idea. I should really look into it and learn how they work.

Appart from that I may just use the 556 timers??

Jason
 
A Shift Register works like the shift left / shift right instructions in a PIC.

You apply data to the input and at the positive edge of the clock pulse, the data bit is shifted into the first register and all of the bits in the reg shift one place and the last is lost.

I suggest you download the data sheet of the 4015. It is 2 4 bit SRs in one package so it can be configured as an 8 bit SR by paralleling the clock inputs (pins 1 & 7) and by connecting the output of one (eg. pin 10) to the input of the next (pin 15). If you don't use the reset inputs (pins 6 & 14), connect them to gnd.

There is also an 8 bit SR but I don't know the number of it. It would be a bit easier to use since you don't have to connect the output to the input and parallel the clocks and resets.
 
Last edited:
Can I ask a question, does a shift reg basically work on the binary way??

So if I connect 4 relay's on D1, D2, D3 and D4. If I only want D4 on how would I do this??
 
huttojb said:
Can I ask a question, does a shift reg basically work on the binary way??

So if I connect 4 relay's on D1, D2, D3 and D4. If I only want D4 on how would I do this??
Yes, it is binary.

If you only wanted to operate D4, you would shift in 0001.

Assume the SR is reset (it does not have to be).

After the first clock pulse Q1 = 1 and the others = 0.

After the next clock pulse, Q2 = 1 and the others are 0.

etc. So after the 4th CP, the reg is storing the 0001, so D4 operates (assuming no more clock pulses).

As I said in a previous post, the D1 ~ D3 relays won't "chatter" as the bits are being shifted if the clock rate is high.
 
So your saying. you switch D1, D2, and D3 on then off but as the relay has a pull in time, the relay doesn't pull in??

Jason
 
huttojb said:
So your saying. you switch D1, D2, and D3 on then off but as the relay has a pull in time, the relay doesn't pull in??

Jason
Yes, the operate and release times of relays and other electromagnetic devices is in the millisecond region due to physical initeria and the inductive time constant.

If the SR clock rate was say 100 kHz, then the bits are being shifted every 10 :mu:s. So the relays won't have time to respond.

The 4094 is an 8 bit SR with Hi Z outputs.
 
Last edited:
hi jason,
Now that you have explained its a momentary points switching coil, I can see exactly what your trying to do.

Len's earlier circuits would work just fine.

I'll drop out Len, leave it in your capable hands.

Regards
Eric

EDIT: Hi Huttob,,, A 40106 or 74HC14 are hex inverting schmitt's
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top