Connect with us

Working With 240v And Arduino

Discussion in 'Microcontrollers, Programming and IoT' started by mikgol, Aug 8, 2016.

Scroll to continue with content
  1. mikgol

    mikgol

    87
    1
    Jul 6, 2013
    Hi guys,

    I want to switch a ~20 watt heat cord on/off with an arduino.

    I have one of these solid state relays already

    http://www.ic72.net.cn/pdf_file/f/290255.pdf

    ... it's rated at 250v max 2A. I live in Australia (voltage is 240v).

    My plan is to simply splice the power cable and connect it to this relay, then apply hot glue gun to insulate the connections.

    Is this a safe thing to do, or is there anything I need to keep in mind when working with high voltages like this?
     
  2. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    Don't leave it unattended, don't work on it while it's connected to mains, keep the arduino side of the board isolated from the mains voltage, insulate the high voltage side from everything!
    Clearly mark the 2A limit on the device.
    Share the design plan and pictures as you go and we can try to help you avoid common mistakes that could result in blowing fuses, starting fires, or electrocution.
    This *can* be done very safely, but depends on your *attention to detail*, not your skill.
     
  3. mikgol

    mikgol

    87
    1
    Jul 6, 2013
    Thanks for your reply Gryd3. I plan on having this running in my shed (to keep a fish tank at a certain temperature) so it will run unattended, however there's no chance of it burning my house down (the shed is separate from the house).

    I plan on housing the relay inside a glass jar to protect it. I'll put it together tonight and will post a photo, in case there are any red flags.
     
  4. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,269
    2,718
    Jan 21, 2010
    Put it in a sealed box with either cables with strain relief or plugs/sockets and no external metal screws etc unless it is in an earthed metal box
     
    Gryd3 likes this.
  5. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    Glass is a great enclosure.
    As mentioned by *Steve* you have a decision to make on how the 'box' will connect to things.
    More often then not, projects like these simple have a power cord hanging out of them that goes to the wall, and a 'socket' that an external device gets connected to.
    It may sound weird... but look up the 'DIY sous vide circuit' and you will find *MANY* other projects that use arduino with a PID (or portions of PID) program flashed to them to keep a very consistent temperature with little/no overshoot. I bring this up, because many are built with a socket and temperature probe. A slow-cooker is then turned 'on' and plugged in the devices socket and left to do it's thing.
    Take a look at them and see if you get any ideas, the main difference of course will be that your operating temp will be much lower! but everything else will be the same.
     
  6. mikgol

    mikgol

    87
    1
    Jul 6, 2013
    Thanks again guys. My Arduino already has a digital thermometer hooked up and reading the temp inside the fishtank, so I'm all sorted there. It does other stuff (switches fans on/off etc.) so this is the last piece of the puzzle -being able to turn the heat on/off. Will let you guys know know how I go and I'll post a photo once it's all hooked up
     
  7. mikgol

    mikgol

    87
    1
    Jul 6, 2013
    Hey guys, I cut the wires of the heat cable to attach to the relay, and it looks like a very thin core, with a small amount of wire on the outside. Here are some pics ...

    [​IMG]

    [​IMG]

    ... not sure how to wire this up, or if it's possible/safe to do so. What do you think? Should I join the cores via the relay, and have the outer wires connected, or the other way around?
     
  8. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,269
    2,718
    Jan 21, 2010
    Unfortunately, if you need to ask those questions its probably not safe for you to do it.

    Try to find someone competent to do the wiring and take their advice about the enclosure too.
     
    hevans1944 likes this.
  9. hevans1944

    hevans1944 Hop - AC8NS

    4,301
    2,019
    Jun 21, 2012
    Could you upload an image showing the entire "~20 watt heat cord"? The "cord" you cut looks like coaxially shielded wire of some sort, perhaps with "resistance wire" as the center conductor. It is probably shorted internally between the center conductor and the shield on the end farthest from the wall plug, thereby completing the heater circuit. If so, you DO NOT want to splice into this so-called heat cord.

    What you should have done was purchase a receptacle for the "heat cord" plug, and another male plug to connect to a live 240 VAC receptacle. You should then have wired both the receptacle and the male plug, with an appropriate length of insulated power cord (not heat cord), in series with your solid-state switch. You then plug the "heat cord" into the receptacle, the male plug into the wall receptacle, and connect the DC solid-state switch control terminals to your Arduino.

    All of this works best (and safest) if assembled in a small plastic "project box" with a strain-relief for the power cord that has the male plug attached, and another strain-relief for the two wires connecting to the Arduino. Since the solid-state relay you linked to is for circuit board mounting, you should solder it to a small piece of Veroboard (or similar) and make all your wiring connections to the Veroboard.

    But given what I see in your post #7, I have to agree with @(*steve*)... you are in over your head on this.
     
    Gryd3 likes this.
  10. mikgol

    mikgol

    87
    1
    Jul 6, 2013
    Damn, looks like I just wasted $50! I had a feeling that was the case when I cut it and saw what looked like an old network cable. Yep, it looks like a coaxle cable. Here's a pic of the whole thing with the end ...

    [​IMG]

    ... it's wrapped around a tin can (and is threaded through the inside of the can as well) - there is a fan on one end of the can to blow air through it, which will be heated up by the cable (and the tin can as it heats up as well). The idea is to heat the air inside my fish tank - which as a very high humidity (99.9% humidity). In case you're wondering, it's to grow mushrooms, which are full of protein and help the brain grow smarter.

    So, I'm guessing this cord is a gonner? FYI I'm in my 30's (in case you're concerned about giving advice to some kid who'll go and electrocute himself:)) Is there any chance of repairing/fixing it? Or should I bite the bullet, buy another one, and re-do but this time sever an extension cord instead?

    What do you think of this method of heating the air in the fish tank? I bought a "heat mad" that sticks to the glass on the tank, but it doesn't raise the temp very high, which is why I need somethign else. The heat mat btw uses "conductive heating" so it's no good at heating air from what I understand.
     
  11. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,269
    2,718
    Jan 21, 2010
    Ok, whatever you do needs to be "food safe", I.e. Use lead free solder or crimp connections that are anywhere near the mushrooms. Also don't use any other poisonous, irritating, corrosive, easily oxidized or corroded, etc. materials.

    An option is to use an aluminum heat sink with resistors or transistors mounted on it to heat it. If the fins protrude into the tank and air is blown over them, the air will be heated. This can be done with low voltages (so no 240V wiring)

    An main issue will be the way you move the air. An option for this is to get an impeller from a fan forced oven, but you are back into mains wiring issues. Incidentally I use one of these to move air around a reflow oven I have made. They feature a fan on the inside of the enclosure and the Moto on the outside. For ovens it keeps the Moto in a cool place. For your application it will keep it in a dry place
     
  12. mikgol

    mikgol

    87
    1
    Jul 6, 2013
    Yep, I won't have any lead/solder in the tank itself - my plan was to solder the relay to the wire, and have that part outside the tank (with the rest of the heat cord inside).

    There's a 12v fan attached to the tin (you can see the edge of it in the picture) to move the air around - this fan is hooked up to a relay to the arduino, so I will turn it on as I turn on/off via my software. The heat cord wires are wrapped around the tin, but are also fed through holes so they crisscross inside the tin - the fan will blow the (very humid) through the inside of the tin, heating it up as well as circulating air within my tank

    I like the idea of a heat sink + resistors, but I'm not sure this would give enough heat. The tank is in an outdoor shed, and it's winter here atm, so I'm not sure it would be powerful enough. The heat mat that's attached to the tank only warms it up to 15C, but I need over 20C. I guess I could insulate the tank better to keep the heat in.

    So, my plan is to fork out another $50 for another heat cord, and this time splice an extension cable instead of the heat cord itself. I'll house the spice/relay inside a sealed jar. This thing will stay in the shed, so there's little chance of the jar being smashed, but I'll cover any exposed wires/metal with hot glue just in case.
     
  13. BobK

    BobK

    7,671
    1,681
    Jan 5, 2010
    You should try growing peanuts instead.

    Mushrooms: 1g of protein per ounce
    Peanuts: 7g of protein per ounce.

    Bob
     
  14. mikgol

    mikgol

    87
    1
    Jul 6, 2013
    no wonder elephants are so big and strong :)
     
  15. hevans1944

    hevans1944 Hop - AC8NS

    4,301
    2,019
    Jun 21, 2012
    I can think of "cash crops" a lot more valuable than either peanuts or mushrooms... well, depending on the variety of mushroom. They breed special hogs and/or dogs to locate truffles, so the price per ounce probably compares favorably with other consumable plants.
     
  16. Minder

    Minder

    2,916
    613
    Apr 24, 2015
    That SSR appears to be the same as the common Opto22 variety, they are actually intended to be plugged into the interface boards which take 4, 16, or 24 SSR's at a time these provide the suitable terminals for input and output, you may have been better off to use one of the SSR's that are stand alone and have the screw terminals on it.
    When wiring it is important that the live conductor is switched, rather than the neutral, and also that correct fusing is used in this conductor.
    The boards can be picked up cheap on ebay, too bad you are 'down under' I have a raft of surplus ones of these..
    M.
     
    hevans1944 likes this.
  17. mikgol

    mikgol

    87
    1
    Jul 6, 2013
    haha yep I heard about those truffle dogs before, crazy how much money those truffles go for!

    I like the idea of growing mushrooms because of their low light requirements - perfect for the post-apocalyptic world. The heating requires energy off course during winter, but the ventilation system, water pump, arduino etc. will run "off the grid" from my shed battery (and solar panel that keeps it charged). I've got all that built now - the heat is the only missing piece.

    Thanks for the pointers @ the SSR - I have that one because I bought it by mistake once (I was actually after a DC one at the time), but since they're just a few dollars I'll see if I can find a more suitable one at the electronics store this weekend.
     
  18. mikgol

    mikgol

    87
    1
    Jul 6, 2013
    Hey guys,

    I bought a new heat cable after destroying the other one, and this time I cut an extension cord and soldered the FSS1-102Z relay to the brown wire (live wire in aus). I put it inside a glass jar so it should be pretty safe ...

    [​IMG]

    ... when I plug in an 18w lamp to it, it fickers (every 1 or 2 seconds) when off, but when "on" it's fine (i.e. light stays on constantly). This 'flicker' happens even if the relay isn't plugged into arduino, so it's not the arduino sending a pulse that's doing it.

    For my purposes this isn't really an issue - as a "flicker" on the heat cable isn't a big deal - i've programmed it to turn on for 45 seconds, then turn off for 60 seconds, until the temp is reached, but am unsure if this relay is faulty, or not suited to my purposes? What do you think?
     
  19. hevans1944

    hevans1944 Hop - AC8NS

    4,301
    2,019
    Jun 21, 2012
    I think we should welcome you to the real world of interfacing to digital logic circuits. Strange and unexpected things can and do happen. I won't even attempt to explain what can go wrong, but will suggest that an oscilloscope is a very handy tool to chase the problem down and stomp on it. In your case, it could be as simple as the wiring from the Arduino to the solid-state switch acting as an "antenna" when it is not being driven "on" by an output port. Try placing a small-valued capacitor across the solid-state switch control terminals. I would start with 0.1 μF and work up from there. Pay attention to polarity if you need to use an electrolytic capacitor.
     
  20. mikgol

    mikgol

    87
    1
    Jul 6, 2013
    Ahh, i think i know what it is. The datasheet says 100ma min current, so the 18w bulb os under that. The heat cord is 25w so should be ok, although theres no way to know if it still flickers with just the heat cord
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-