Author Topic: Working with relays  (Read 33069 times)

semicolo

  • Full Member
  • ***
  • Posts: 137
Re: Working with relays
« Reply #30 on: July 11, 2013, 06:21:32 am »
From the datasheet it should work, around 15mA should flow in the input and turn it on.
Did you connect it like that:
DigisparkPin -> 220Ohms -> Pin2
Pin1,3,or 4 -> Digispark Gnd

germ

  • Jr. Member
  • **
  • Posts: 53
Re: Working with relays
« Reply #31 on: July 11, 2013, 08:07:20 am »
I haven't connected it yet, but yes, that was the idea.
It was between this or an optocoupler and a triac, but this seemed a lot easier.
The only LEDs I have are 2v 20mA though. The same current but different voltage.
Shouldn't I be able to change the resistor and put a led and another resistor parallel to that one?
It was clearly too long ago since I did this kind of math.

I should probably put a fuse on the 230v side too.

semicolo

  • Full Member
  • ***
  • Posts: 137
Re: Working with relays
« Reply #32 on: July 11, 2013, 08:33:59 am »
You could use Digispark pin -> 100Ohms -> 2VLed -> AQH3223 Pin2
and AQH3223 Pin1 -> Digispark ground.

germ

  • Jr. Member
  • **
  • Posts: 53
Re: Working with relays
« Reply #33 on: July 11, 2013, 01:27:36 pm »
Really? That would be great, but doesn't that mean 1.2v over the LED? Or does the resistance not alter the voltage at all, just control the mA?

That would be great ofc to not stress the output on the sparky too much.As far as I understand I have no need for the version with zero cross, and just pick the one rated for the highest current as in AQH3223, as we said.

semicolo

  • Full Member
  • ***
  • Posts: 137
Re: Working with relays
« Reply #34 on: July 11, 2013, 02:10:17 pm »
If I'm not mistaken you should get around 18mA, 1.2V across the AQH3223, 2V across the 2V led and  1.8V across the resistor. I'd need the exact datasheet of the 2V led for better values.
Yes the resistor just about controls the current.
A 150 ohms resistor would give about 12mA current (you can use one 100 ohms resistor in serie with 2 paralleled 100 ohms ones).

germ

  • Jr. Member
  • **
  • Posts: 53
Re: Working with relays
« Reply #35 on: July 11, 2013, 10:18:17 pm »
Well I was thinking of this LED: https://www1.elfa.se/data1/wwwroot/assets/datasheets/07530694.pdf
And it's 2v 20mA
But both the relay and the LED are kind of forgiving, so anything between 10mA and 20mA should be fine. The LED is pretty bright for an indication LED I suppose, but who cares :P

Made a quick sketch on a 5 relay setup: https://docs.google.com/file/d/0B_8icTMsheWfbzBQcXRHOUFPbms/edit?usp=sharing
"J" is just a terminal for connecting the 230v.

And for this project I haven't really ordered anything, so if we want a 150ohm resistor or a 120ohm, we can just change it to that :)

Thanks a LOT!

*edit*
I made a quick PCB for it too :D    https://docs.google.com/file/d/0B_8icTMsheWfYmx1VlhJWmVMc0E/edit?usp=sharing

*edit2* Yeah ok, you'll probably have a hard time seeing those LEDs as they would end up on the back of the board like that... oh well.
« Last Edit: July 12, 2013, 01:30:55 am by germ »

Mark

  • Full Member
  • ***
  • Posts: 196
Re: Working with relays
« Reply #36 on: July 12, 2013, 02:29:35 am »
germ

Since you're intended to incorporate 230v into this board, there are some additional measures you should be incorporating.

1. You should consider running an earth trace between the low voltage and the mains (ie relay contacts), to prevent any flash-over, etc from sending 230v up the 5v line.
You may be able to accomplish this by extending an earth from the right side, in through the other pins (assuming they are unused)
It will require an earth wire, but will give added protection.

2. Ensuring that suitable warnings are in place about 230v on the pcb and isolating it before working on it.

3. Making sure the 230v connectors are rated, and are physically different to the low voltage ones. (No confusion )

4. Consider fusing the 230v as it enters to ensure that the maximum capabilities of your board are not exceeded.
    (The wiring rules here in NZ require that devices are appropriately fused to ensure the wiring is not overrated.)

5. Keep the low voltage and mains seperated (ie not in the same hole), and consider using double insulated wires for low voltage.
    ie inside an outer covering or sleeving.

5. If you have access to a friendly electrician, have him check it and possibly perform an insulation resistance test (for peace of mind)

Make sure you are careful working on it with the 230v applied.
If possible use an ELCB (Earth Leakage Circuit Breaker) or isolating transformer, as its the unexpected that tends to get you...


Mark


germ

  • Jr. Member
  • **
  • Posts: 53
Re: Working with relays
« Reply #37 on: July 12, 2013, 03:49:14 am »
Thanks Mark!
That earth trace is a very good idea. I did feel a bit uncomfortable with putting the 5v and 230v traces close to each other, so I kept as much distance as possible. That means I should be able to get an earth trace in there.

I did consider adding fuses, either one per relay or one general fuse (something like a 500mA glass fuse).

There will be fuses and ELCB outside of this circuit either way (but that fuse is 6A).

I am a friendly electrician, and so is my GF. I will heed your advice and perform an insulation test, and also show it to our company electric engineer so that he can approve it.

I would like to have the DC connectors with 2.54mm spacing. They won't be able to fit the cables used for the 230v LEDs.
I'll change that in the PCB circuit. (It has already been improved a few steps from the version I posted)


*edit*
New improved version:
« Last Edit: July 12, 2013, 04:13:40 am by germ »

semicolo

  • Full Member
  • ***
  • Posts: 137
Re: Working with relays
« Reply #38 on: July 12, 2013, 05:33:40 am »
Don't forget to NOT use P5 it can't provide 10mA.

germ

  • Jr. Member
  • **
  • Posts: 53
Re: Working with relays
« Reply #39 on: July 12, 2013, 05:43:08 am »
Damn, forgot that I used P5 as my input on the other board. Thanks for reminding me semicolo! I'll redraw it!

Mark

  • Full Member
  • ***
  • Posts: 196
Re: Working with relays
« Reply #40 on: July 12, 2013, 06:40:51 am »
Germ
Sorry I didn't mean to preach to an electrician ....

I hadn't realised that the DS plugged onto the board ...nice touch.

The PCB tracks should be capable of carrying the full current (6A) and the pad size may need to be larger.
You could run the 230v along the right hand side to each connector, and just cut it if you want to have a volt free contact for other projects.

As an aside for that .... someone I know here found it was better to use join the pairs of screw terminals, rather than have them individual.
The mechanical support stopped them moving and placing a strain on the pcb tracks.


Quote
and also show it to our company electric engineer so that he can approve it.
That might be interesting.


Mark
Have you considered making all three mains connections available (P+N+E) so you can terminate each led string in the box.?

germ

  • Jr. Member
  • **
  • Posts: 53
Re: Working with relays
« Reply #41 on: July 12, 2013, 07:41:33 am »
Mark
Don't worry, just because I work with it doesn't mean I do everything right all the time. Also, I'm young and learning ^^
I really hope there will be no 6A on those tracks, but that's good to know.

Yeah, I just wanted to make the board really compact. At least this allows you to control different mains, (not that it will happen, but still).

Hmm.. I have been thinking about what to do with those terminals. Honestly, the most annoying part so far is the fact that there are no terminals to choose from in the component list :P
I did not really consider putting a neutral in there. This was really just supposed to be a "relay" to switch the mains, and then they share a neutral in a terminal outside of the board.

Quote
That might be interesting.

Well he's an odd character. He'll be impressed even if the thing catches fire. (not really tho)

I did a remake of this, using the Arduino Micro. This time I put a fuse on the board and connected the terminals.


*edit* I did a quick rework and fused the terminals together instead. (it's a bit jury-rigged, but I blame the software)
https://dl.dropboxusercontent.com/u/524696/Arduino/Rboard.r3.41-Amicro.PNG

*edit*edit* I'm not really sure why I have huge traces for 230v... there won't be running much more current there. Maybe about 200mA at the fuse.
*edit3* The software isn't letting me change the pad size on existing components =/
« Last Edit: July 12, 2013, 08:16:05 am by germ »

Mark

  • Full Member
  • ***
  • Posts: 196
Re: Working with relays
« Reply #42 on: July 12, 2013, 04:54:57 pm »
germ
Its looking very good.
You indicated the incoming mains is fused at 6A, so therefore the tracks should be capable of carrying 6A, regardless of the fuse downstream.
If you fused it at 1A, then they only need to carry 1A.
(Somewhere in the regulations you'll find the fuse should be rated to protect the wiring ...)

If the terminals you decide to use are 5.02mm (0.2inch I think) between pins, you should be able to join them together, if you space them at 5.02mm/0.2 inch.
Your "fused the terminals together instead" version seems to show the spacing as the same between connectors as it does between the pins, so you should be fine.

Some packages allow you to make you own components, by placing the pads, then drawing a top layer/screen track around the component.
You then group them together or highlight them and add them as a new component.

I find it useful to obtain the terminals I am going to use, before doing the pcb, as some have larger pin diameters, and therefore need a much bigger pad size.

A small suggestion regarding your resistor placement.
You may want to consider moving them closer to the SSR's as the header and SMD resistors might get a bit crowded there.
You can always rotate them 90 deg as well.
Since everything else is 'thru hole', you have plenty of room for thru hole resistors.

These are a very useful looking SSR, I might have to hunt some down here, as I have some upcoming projects, and was considering my options.

The datasheet shows that Pins 1,3,4 are joined together internally, so your common could consist of joining pin4 of SSR1 to pin1 of SSR2, and give yourself some room to move the earth track across a bit.


It's a good learning exercise and with your background, you can now understand a few of those stupid rules....


Mark


germ

  • Jr. Member
  • **
  • Posts: 53
Re: Working with relays
« Reply #43 on: July 13, 2013, 02:48:26 am »
Well it's 6A outside of this board. The mains fuse on the board will probably be a 500mA fuse or something.
I did a bit of searching in the store, and for the terminals, I decided to go with this: (as there are no 7 pole versions) one 4p (5.08mm) +one 3p (5.08mm) for the 230v side, they will be tight together. And then a 4p 2.54mm terminal for the + - and input. Different size and completely separated should be good.
I'll work on redrwaing the terminals in the software so that it looks better, and more clear. I think the symbol I'm using is for some kind of capacitor :P
It's true that I don't have to go with SMD resistors. I will try some next week, and if they are too much work then I'll just use thru hole stuff :)
Placing the AMicro/Digispark on the stackable headers gives me tons of space to put stuff under the card too.

Yeah, I was trying to find a good alternative. Was going for Triacs, but then i "need" an optocoupler too, and it was just a bit too much for me :P I guess it's still an option tho, I have lots of triacs lying around here and optocouplers are cheap.
Good find! I knew they were joined internally, I just didn't think of doing it that way! That's a lot better, I'll definetly do that.
I was looking into using a seven darlington array to aid in the switching. I've understood how you can use transistors (and relays, triacs thyristors and so on) for switching, but I never really understood using it as an amplifier.
If I make one with a darlington, could you give me a few pointers in what kind of resistors and such that I would need? I'll edit it in here as soon as I'm done with it!

*edit* So, here it is. Worked a few of your tips in, and a darlington. It's getting pretty crowded and the darlington prohibits a few from the pins on the micro to be used properly. I'll rework the digispark version next. -> https://dl.dropboxusercontent.com/u/524696/Arduino/Rboard.r3.42d-Amicro.PNG <- Latest "A Micro"
So, what should I use for the resistors for that? And do I need resistors after the darlington too? I just can't figure out exactly how it works =/

Not sure if optocouplers + triacs would take less or more space, (probably a bit more), but it's just my impression that maybe a triac would be more durable. It harder to switch if you want a big one tho, so then the darlington would be nice. (Or maybe it isn't? I'm still not sure how those optocouplers work, are they like switches?)
*edit 2* Link to the darlington :P http://www.st.com/web/en/resource/technical/document/datasheet/CD00001244.pdf

*edit3* So I did a total rework of the digispark setup. Zoomed out and realized that it's FREAKING TINY! So anyway, I upped the trace sice and clearance, jammed a fuse and darlington in there just for fun.
This time with the resistors AFTER the darlington. Just because I still don't know any better.
-> https://dl.dropboxusercontent.com/u/524696/Arduino/Rboard.r2.8fd-digispark.PNG <-Latest Digispark
« Last Edit: July 13, 2013, 05:17:40 am by germ »

Mark

  • Full Member
  • ***
  • Posts: 196
Re: Working with relays
« Reply #44 on: July 13, 2013, 05:24:32 am »
germ

If you are only fusing at 500mA, then you should be fine with small tracks.

I normally use a range that slide together, and therefore lock.
http://sterminalblock.en.ec21.com/PCB_Terminal_Block_Connectors_LG127V--6501194_6501432.html

Darlington
The darlington is basically two transistors. These versions are inverting output.
That is a HIGH on the input creates a LOW on the output .... hence you need to make Pin2 go to +5v and switch the ground pin for each ssr.
No other way sorry.....

If you use the ULN2003 there are no input resistors required, as they are in-built. (your link was all 4 in the range)
You'll still need them between the Output and the SSR.

The Arduino mini can deliver 40mA per output quite easily, so you probably don't need the darlington.

Basically the optocoupler are a LED inside a plastic housing, so its not a lot different from a LED.
I found some today that are mosfet rather than triac.

A good practice regarding power and loads is to ensure the higher load current paths go directly back to the supply.
You have done this with the DS version but the Mini it travels through the board.

So sorry but adding the darlington array has resulted in some extra work.


mark