RowlandoGloom Posted March 10, 2016 Author Posted March 10, 2016 Nice work. I hope I don't cause offence but personally, I'd be very wary of interfacing to mains anything via relay boards in a school project. True. The bulbs themselves are 12v with a 240v transformer built inside for each one. The 12v cable to the bulb is what has been wired back to the relays - so there's no mains comings out. :-) Paul.
RowlandoGloom Posted March 10, 2016 Author Posted March 10, 2016 Got my traffic lights. Can you take a few more pictures of the wiring. I can't work the cables out to control them. [ATTACH]35522[/ATTACH] I'll draw you somehing up and let you know tomorrow :-) P
pcstru Posted March 11, 2016 Posted March 11, 2016 True. The bulbs themselves are 12v with a 240v transformer built inside for each one. The 12v cable to the bulb is what has been wired back to the relays - so there's no mains comings out. It sounds like a project that could impress and inspire students, which is great. I still have some concerns that it is problematic. 1. The components are not designed for the application. Did the designers of the lights envisage (for instance) that the system would even be used indoors? If not, they may have made design choices about materials and failure modes that could be problematic. 2. The components might rely on system elements elsewhere (i.e. not present in the bits you have) for their ultimate safety. 3. The description could indicate the 12V lines are wired to the secondary winding on a transformer (post rectification if DC), which if there is a problem could expose those 12v lines to the mains or a current overload. Is such a design compliant with IET regulations in this application? 4. Work on mains in a school should be undertaken by a competent individual with appropriate training and expertise. Are you a qualified electrician or electrical engineer? If not, at the very least your schools public liability insurance might not cover any accident (a fire as a result of those 12v lines shorting and exceeding their rated current for example), while if someone got injured you may face much worse. 5. You seem to have set it up in a computer room. Is the supply fitted with an appropriate RCD - as should be the case in a science lab but may not be the case elsewhere? 6. Are you entirely comfortable setting an example to pupils of hacking mains powered articles and driving them from a Raspberry Pi. Are you adequately covering the dangers of doing that and if so, how come you are still doing it?! 7. Did you get a senior member of staff to sign off the risk assessment? If not, who did? On the last, when I think about doing a risk assessment for this kind of thing, the big problem is that it is easy to mitigate any risk arising from use of mains components by substituting readily available 12V components while still demonstrating exactly the same principles of electronic control. Want bright coloured lights? Use high powered LED's driven from a 12V buck driver. Sorry if that sounds like H&S gone mad. I'd guess there is an extremely small chance that this could go wrong - it's just if it does, it could land someone (you or anyone else inspired to do this) in the deep stuff.
RowlandoGloom Posted March 11, 2016 Author Posted March 11, 2016 It sounds like a project that could impress and inspire students, which is great. I still have some concerns that it is problematic. 1. The components are not designed for the application. Did the designers of the lights envisage (for instance) that the system would even be used indoors? If not, they may have made design choices about materials and failure modes that could be problematic. 2. The components might rely on system elements elsewhere (i.e. not present in the bits you have) for their ultimate safety. 3. The description could indicate the 12V lines are wired to the secondary winding on a transformer (post rectification if DC), which if there is a problem could expose those 12v lines to the mains or a current overload. Is such a design compliant with IET regulations in this application? 4. Work on mains in a school should be undertaken by a competent individual with appropriate training and expertise. Are you a qualified electrician or electrical engineer? If not, at the very least your schools public liability insurance might not cover any accident (a fire as a result of those 12v lines shorting and exceeding their rated current for example), while if someone got injured you may face much worse. 5. You seem to have set it up in a computer room. Is the supply fitted with an appropriate RCD - as should be the case in a science lab but may not be the case elsewhere? 6. Are you entirely comfortable setting an example to pupils of hacking mains powered articles and driving them from a Raspberry Pi. Are you adequately covering the dangers of doing that and if so, how come you are still doing it?! 7. Did you get a senior member of staff to sign off the risk assessment? If not, who did? On the last, when I think about doing a risk assessment for this kind of thing, the big problem is that it is easy to mitigate any risk arising from use of mains components by substituting readily available 12V components while still demonstrating exactly the same principles of electronic control. Want bright coloured lights? Use high powered LED's driven from a 12V buck driver. Sorry if that sounds like H&S gone mad. I'd guess there is an extremely small chance that this could go wrong - it's just if it does, it could land someone (you or anyone else inspired to do this) in the deep stuff. True. I appreciate your advice as it does give a bigger picture. All the high voltage components are inside the lights and inaccesible to students. Lets see what you think: 1) If anything, being designed for outdoor use implies to me that things will be of superior quality to withstand greater use. 2) I am not sure which elements. Usually when they are up, by design, 240v is sent to an individual transformer in the light (one for each lamp). This is fed by 3 240v supplies from the outside. This is then stepped down to 12v by the transformer (by design), then this is the cable travelling to the relay. 3) As above - the transformers haven't been modified. Intead of 3 individual 240v supplied, there is a new 13amp internal terminal block designed for mains distribution providing power to each transformer. This is using a 13amp extension cable. There is usually no earth entering the lights. This is NOW hard wired to every metal component (and the metal cases of the transformers,) thus down the power cable to the plug. 4) Yes I am and they have been fully PAT tested. The 12v cables use CAT5 cables which is a lower AWG than required (the lower the AWG, the thicker the cable.) 5) They are indeed 6) All the 240v kit is inacesible as it is inside. It is therefore the same as if students were accessing tube lights on ceilings for example. 7) True, good point
Grazza Posted March 11, 2016 Posted March 11, 2016 You could just use a standard 240v to 12v PSU like a laptop charger to supply the Power to the Lights. That way your not hacking any Mains Supply! Just make sure it's got enough amperage for what you need.
RowlandoGloom Posted March 11, 2016 Author Posted March 11, 2016 (edited) Got my traffic lights. Can you take a few more pictures of the wiring. I can't work the cables out to control them. [ATTACH]35522[/ATTACH] Hi Martin, I'm trying to get a drawing together for you. You will first need a relay (I recommend one of these to start with.) You can use 3 of the 4 channels here. The relay in the link is mechanical, you will hear a click when the bulb changes. You can buy silent solid state ones, but they can really go bang if you wire them wrong - plus they may have a lower amperage. I would put the relay inside the lights somewhere so there is absolutely no chance of 240v escaping. This is all based on my assumption as to how yours work. The lights currently plug into the mains with a cable, probably from an old extention lead and a 13amp or lower fuse. Try to keep the fuse as low a rating as possible so there's more chance of it popping in the event of failure. Turn all I bet the earth isn't even conencted to anything. The lights should have 3 transfomers inside (one for each lamp.) I assume at the moment the mains cable you have is connected to a distribution block (terminal block) powering all 3 transformers at the same time. I would make sure the distribution block is rated equal to or higher than the fuse so it doesn't potentially overheat and melt. The transformers will all have a metal cover and they will be srewed to the outer plastic case. I assume the screw hole is metal and part of the transformer cover. If they are not earthed: If the mains cable doesn't even have an earth, get rid of it and use an old extension lead by taking the end off. On the end of the earth cable from the mains lead attach one of these. You may need pliers to connect them as you may not have a crimper, make sure you pull them hard to double check they're tight. Where the transformer screws to the case, make sure you put the ring on the screw between the transformer and case. Get an earth cable from an old PC power cable and chop a length long enough to leave the foot of the first transformer to the foot of the second. Add a ring to each end. This time, attach one end to the screw on the first transformer and to the screw of the second. Repeat the second to third. If there is any metal on the case with a screw attached, it is a good idea to connect the earth from the first or third to the case too. Between each transformer and the bulb there will be two 12v cables. Cut one of the cables in the middle. As the lamps are AC, you can cut either cable. If say one is red and the other black etc. however, always cut the red one. Attach a single terminal block to each end you've cut (DO NOT SHORT THEM OUT.) Just in case the wattage is high, I would use mains cable here. On the relay there is usually 3 'outputs' per module. The middle is the input. The other two are 'normally connected' or 'normally open' 'Normally connected' = When the relay board is powered up and there is no input, the relay is 'on.' When there is an input, it turns it 'off' 'Normally open' = Is the opposite way round. When the relay board is powered it is 'off' and when there is an input, it turns it 'on' For the red light, you want to use relay one. Make sure cable leaving the transformer is connected to the common. The cable to the bulb must be connected to the 'normally open' so that it will only turn the bulb on when the pi tells it to, otherwise the pi will turn it off when it should be on etc. Repeat for yellow, channel 2 Repeat for green, channel 3 On the header side of the relay there will be 6 connectors: +5v 1 2 3 4 Gnd Connect the +5v and Gnd to the correct pins on the pi respectively using jumper wires. You may need to use a breadboard as the cables are usually m-f. If you already have f-f cables great, you don't need a breadboard. If you have two m-f cables, you can chop the pins off and and make one f-f. Here is a pinout of the pi Relay PIN1 (red) = PIN15 on the pi (BCM 22) Relay PIN2 (yellow) = PIN13 on the pi (BCM 27) Relay PIN3 (green) = PIN 11 on the pi (BCM17) Relay PIN4 = not connected. I hope this helps. Paul. Edited March 11, 2016 by RowlandoGloom Double quote 1
pcstru Posted March 11, 2016 Posted March 11, 2016 True. Lets see what you think: 1) If anything, being designed for outdoor use implies to me that things will be of superior quality to withstand greater use. They may have different safety features than typical indoor equipment and materials might be chosen which would not be suitable for an indoor environment - materials which might be severely toxic in a confined space in a fire for instance. There might be unexpectedly short specified operating lifetimes on components which are subject to the greater range of temperature cycling typically found in outdoor environments. The unit may have been removed from service having met or exceeded some safe operating lifetime limits. 2) I am not sure which elements. Usually when they are up, by design, 240v is sent to an individual transformer in the light (one for each lamp). This is fed by 3 240v supplies from the outside. This is then stepped down to 12v by the transformer (by design), then this is the cable travelling to the relay. IMO there are (at least) two possible failures which could be worrying. A breakdown of the insulation in the transformer winding leads to 240V across the secondary or a short in the 12V side leads to overcurrent and a fire because of a lack of suitable fusing on the 12V side. I think I'd like to see opto isolators used in anything that interfaces mains to logic in a school environment (says someone who has been known to directly drive mains Triac chopper circuits from an Arduino at home!). Another possible failure is students subjecting the relays to too high a duty cycle (surely every student will want to try to get a relay to play the star wars theme). 3) As above - the transformers haven't been modified. Intead of 3 individual 240v supplied, there is a new 13amp internal terminal block designed for mains distribution providing power to each transformer. This is using a 13amp extension cable. There is usually no earth entering the lights. This is NOW hard wired to every metal component (and the metal cases of the transformers,) thus down the power cable to the plug. I'd worry about terminal blocks inside an enclosure which students might access. Aren't fully insulated crimped connectors now standard for any mains electrical work? 4) Yes I am and they have been fully PAT tested. The 12v cables use CAT5 cables which is a lower AWG than required (the lower the AWG, the thicker the cable.) Cat 5 seems to be rated under 1A per strand and for power handling (0.6A Cat5e) and in short runs might be prone to getting hot (resistance seems to be quite high per meter). I'd expect traffic lights - even high efficiency LED ones to draw more than 12W per 'bulb'. What current have you actually measured to the bulb? 5) They are indeed I think all I'd be able to say to students is "do not under any circumstances try this at home!" - at which point I'd wonder why I am setting such an example. One worry might be students going away and using relays to switch inductive mains loads - a distinction which might be difficult for secondary students but which could be quite dangerous. IMO it would be better to just say "don't do this" and then show them how to do stuff working with relatively safe battery driven or 12v circuits driven by lab bench power supplies. 6) All the 240v kit is inacesible as it is inside. It is therefore the same as if students were accessing tube lights on ceilings for example. Is accessing lights something they would be allowed to do? If a student is in the room alone, can they access the back panel without a key? 7) True, good point As I say, I do think it is the kind of thing that can impress and inspire students and is probably pretty safe but there are numerous potential pitfalls for the unwary and much safer alternatives. Sorry to appear to be such a killjoy!
RowlandoGloom Posted March 11, 2016 Author Posted March 11, 2016 (edited) They may have different safety features than typical indoor equipment and materials might be chosen which would not be suitable for an indoor environment - materials which might be severely toxic in a confined space in a fire for instance. There might be unexpectedly short specified operating lifetimes on components which are subject to the greater range of temperature cycling typically found in outdoor environments. The unit may have been removed from service having met or exceeded some safe operating lifetime limits. IMO there are (at least) two possible failures which could be worrying. A breakdown of the insulation in the transformer winding leads to 240V across the secondary or a short in the 12V side leads to overcurrent and a fire because of a lack of suitable fusing on the 12V side. I think I'd like to see opto isolators used in anything that interfaces mains to logic in a school environment (says someone who has been known to directly drive mains Triac chopper circuits from an Arduino at home!). Another possible failure is students subjecting the relays to too high a duty cycle (surely every student will want to try to get a relay to play the star wars theme). I'd worry about terminal blocks inside an enclosure which students might access. Aren't fully insulated crimped connectors now standard for any mains electrical work? Cat 5 seems to be rated under 1A per strand and for power handling (0.6A Cat5e) and in short runs might be prone to getting hot (resistance seems to be quite high per meter). I'd expect traffic lights - even high efficiency LED ones to draw more than 12W per 'bulb'. What current have you actually measured to the bulb? I think all I'd be able to say to students is "do not under any circumstances try this at home!" - at which point I'd wonder why I am setting such an example. One worry might be students going away and using relays to switch inductive mains loads - a distinction which might be difficult for secondary students but which could be quite dangerous. IMO it would be better to just say "don't do this" and then show them how to do stuff working with relatively safe battery driven or 12v circuits driven by lab bench power supplies. Is accessing lights something they would be allowed to do? If a student is in the room alone, can they access the back panel without a key? As I say, I do think it is the kind of thing that can impress and inspire students and is probably pretty safe but there are numerous potential pitfalls for the unwary and much safer alternatives. Sorry to appear to be such a killjoy! I agree you've made some good points. Funnily enough I am replacing the CAT5 cable with mains cable. Repetitive cycling of the relay is likely either to fry it or the lamp, both of which are easily replaced. The relays are rated for 250v AC at 10A - so there's no chance of voltage escaping to the Pi. The relay is inside the light again to prevent contact. It is definitely something to think of. I think each school must weigh up the pros and cons and make their own informed decision. Edited March 11, 2016 by RowlandoGloom
Joanne Posted March 11, 2016 Posted March 11, 2016 couldnt you just swap the bulbs out for some leds? This. When I was a teenager I had a fire exit sign that I put a normal bulb in. SO COOL!
DickieCornell Posted March 11, 2016 Posted March 11, 2016 Hi everyone Can you please share the details, that how did you made the supply for your pi? Also what are the system details which you made using the Pi? Can you please share your schematics and the details where you installed this whole system?
RowlandoGloom Posted March 11, 2016 Author Posted March 11, 2016 couldnt you just swap the bulbs out for some leds? That would be too easy an idea lol
MartinRouterKing Posted March 13, 2016 Posted March 13, 2016 Hi Martin, I'm trying to get a drawing together for you. You will first need a relay (I recommend one of these to start with.) You can use 3 of the 4 channels here. The relay in the link is mechanical, you will hear a click when the bulb changes. You can buy silent solid state ones, but they can really go bang if you wire them wrong - plus they may have a lower amperage. I would put the relay inside the lights somewhere so there is absolutely no chance of 240v escaping. This is all based on my assumption as to how yours work. The lights currently plug into the mains with a cable, probably from an old extention lead and a 13amp or lower fuse. Try to keep the fuse as low a rating as possible so there's more chance of it popping in the event of failure. Turn all I bet the earth isn't even conencted to anything. The lights should have 3 transfomers inside (one for each lamp.) I assume at the moment the mains cable you have is connected to a distribution block (terminal block) powering all 3 transformers at the same time. I would make sure the distribution block is rated equal to or higher than the fuse so it doesn't potentially overheat and melt. The transformers will all have a metal cover and they will be srewed to the outer plastic case. I assume the screw hole is metal and part of the transformer cover. If they are not earthed: If the mains cable doesn't even have an earth, get rid of it and use an old extension lead by taking the end off. On the end of the earth cable from the mains lead attach one of these. You may need pliers to connect them as you may not have a crimper, make sure you pull them hard to double check they're tight. Where the transformer screws to the case, make sure you put the ring on the screw between the transformer and case. Get an earth cable from an old PC power cable and chop a length long enough to leave the foot of the first transformer to the foot of the second. Add a ring to each end. This time, attach one end to the screw on the first transformer and to the screw of the second. Repeat the second to third. If there is any metal on the case with a screw attached, it is a good idea to connect the earth from the first or third to the case too. Between each transformer and the bulb there will be two 12v cables. Cut one of the cables in the middle. As the lamps are AC, you can cut either cable. If say one is red and the other black etc. however, always cut the red one. Attach a single terminal block to each end you've cut (DO NOT SHORT THEM OUT.) Just in case the wattage is high, I would use mains cable here. On the relay there is usually 3 'outputs' per module. The middle is the input. The other two are 'normally connected' or 'normally open' 'Normally connected' = When the relay board is powered up and there is no input, the relay is 'on.' When there is an input, it turns it 'off' 'Normally open' = Is the opposite way round. When the relay board is powered it is 'off' and when there is an input, it turns it 'on' For the red light, you want to use relay one. Make sure cable leaving the transformer is connected to the common. The cable to the bulb must be connected to the 'normally open' so that it will only turn the bulb on when the pi tells it to, otherwise the pi will turn it off when it should be on etc. Repeat for yellow, channel 2 Repeat for green, channel 3 On the header side of the relay there will be 6 connectors: +5v 1 2 3 4 Gnd Connect the +5v and Gnd to the correct pins on the pi respectively using jumper wires. You may need to use a breadboard as the cables are usually m-f. If you already have f-f cables great, you don't need a breadboard. If you have two m-f cables, you can chop the pins off and and make one f-f. Here is a pinout of the pi Relay PIN1 (red) = PIN15 on the pi (BCM 22) Relay PIN2 (yellow) = PIN13 on the pi (BCM 27) Relay PIN3 (green) = PIN 11 on the pi (BCM17) Relay PIN4 = not connected. I hope this helps. Paul. What do you mean when you say make sure the cable leaving the transformer is connected to the common? Thanks very much for all the information.
pcstru Posted March 13, 2016 Posted March 13, 2016 Funnily enough I am replacing the CAT5 cable with mains cable. Repetitive cycling of the relay is likely either to fry it or the lamp, both of which are easily replaced. I'd consider fitting some appropriately sized fuses after the transformer on the 12V side. If there is a short the transformer might well deliver enough current to be a fire risk. The relays are rated for 250v AC at 10A - so there's no chance of voltage escaping to the Pi. The relay is inside the light again to prevent contact. Hot switching of high current DC can be problematic with arcing creating plasma between the contacts leading to high temperatures which inside a sealed relay can lead to the unit failing in interesting ways - ways which do not exclude the signal side coming into contact with the supply side. Looking for info on traffic lights using incandescent bulbs suggest they might be anywhere between 50W and 150W, the higher of which which would be pulling more than 10A - albeit @ 12V. It is one reason why opto isolators are used on some relay boards (the main reason would be to limit propagation of noise due to the switching - noise which can 'crash' controlling electronics leading to unexpected behaviour (including rapidly switching the contacts)). It is definitely something to think of. I think each school must weigh up the pros and cons and make their own informed decision. I'd agree, although I strongly suspect that unless you are a qualified electrician, you will be breaking the law.
RowlandoGloom Posted March 13, 2016 Author Posted March 13, 2016 What do you mean when you say make sure the cable leaving the transformer is connected to the common? The middle of the 3 connectors on the relay board. The middle is where the power from the transformer goes in, the outer two are where it comes out (N/C or N/O depending how you want them wired) pcstru, they're: 10A @ 250v AC 10A @ 30v DC. The bulbs are AC. DC can also really shorten the life of the relays too hence why they're rated lower etc. As like you say it can get very hot very quickly. Like is said before, it is down to the individual whether they go forward after weighing up the pros and cons. That is how I have my setup so if people disagree or want to change it of course feel free as its yours at the end of the day.
RowlandoGloom Posted March 13, 2016 Author Posted March 13, 2016 couldnt you just swap the bulbs out for some leds? Can you recommend some that'll be bright enough to replace the lamps with? Cheers.
MartinRouterKing Posted March 13, 2016 Posted March 13, 2016 All wired up but scratch doesn't seem to be talking to them is there anything I need to do when I click control and broadcast and type pin11high it doesn't do anything.
RowlandoGloom Posted March 13, 2016 Author Posted March 13, 2016 All wired up but scratch doesn't seem to be talking to them is there anything I need to do when I click control and broadcast and type pin11high it doesn't do anything. Try pin11low
RowlandoGloom Posted March 13, 2016 Author Posted March 13, 2016 (edited) All wired up but scratch doesn't seem to be talking to them is there anything I need to do when I click control and broadcast and type pin11high it doesn't do anything. Give this a try as Scratch maybe a different version Edited March 13, 2016 by RowlandoGloom
MartinRouterKing Posted March 13, 2016 Posted March 13, 2016 I figured it out the scratch on the pi wasn't gpio enabled. All working fine now!
RowlandoGloom Posted March 13, 2016 Author Posted March 13, 2016 I figured it out the scratch on the pi wasn't gpio enabled. All working fine now! That's good news. You'll have to take some pics of them in action now :-) Good work!
MartinRouterKing Posted March 13, 2016 Posted March 13, 2016 Coming out the back is the 3 power cables for each lamp, HDMI lead and a Raspberry pi mains lead. @RowlandoGloom thank you for all your help.
RowlandoGloom Posted March 13, 2016 Author Posted March 13, 2016 Well done, that looks fab - just don't blow yourself up. Glad you got it working.
MartinRouterKing Posted March 13, 2016 Posted March 13, 2016 I have power leads to go on so that those wires at the back will all be covered up. That was just the test. Everything is fine. Going to put them up high in the ICT room so kids can have a play and then take them down. My friends an electrician he is going to check over it all before it goes.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now