24 Replies Latest reply on Dec 30, 2017 4:48 PM by gadget.iom

    Sauna Heater Control. Help Needed.

    studioab

      I've finished my first IoT project based on Arduino Yun. It's a remote control for my sauna. Everything is working as expected in test mode (relay is not connected to contactor so there is no real load), I was able to test this system for hours without any problems.

       

      When I hook up contactor to relay, it turns the heater on and off, and everything seems to be working, but after a while (absolutely random, it could be an hour or a few minutes) LCD screen freezes, or sometimes, starts flashing random symbols, server is not responding to commands, rotary encoder isn't working and it seems Arduino freezes. The only workaround is to turn off the power and reset the system. After it restarts, everything is back to normal.

       

      I came across this post 16*2 LCD getting weird characters symptoms are the same, I think high AC load is causing EMF impulse that is crashing Arduino. Power Module, Relay board, LCD, and Arduino board are really close to each other and inside the box.

       

      I'm not sure if it violates the rules, but I would like to mention these people from the other post @WarrenW @peteroakes @lui_gough @neilk @D_Hersey

       

      I think here are my options. What would you recommend to do?

       

      - replace relays with solid state relay

      - shield AC wires

      - remove power module from the box

      - don't use the same power module for relays

      - ???

        • Re: Sauna Heater Control. Help Needed.
          jw0752

          Hi Eugene,

          The answer might be as simple as adding more decoupling capacitance with low ESR to the power feed to the Arduino. This can be done by putting a 100 nF capacitor and a 100 uF cap in parallel across the power rails on the Arduino. We do not have information on the types of relays and contactors that you are using or if they are powered with DC or AC voltage. If they are powered with DC it is important that they have flyback diodes installed reverse polarity across their coils. The spike produced by a collapsing magnetic field in a relay coil can easily scramble a working arduino.

          John

          1 of 1 people found this helpful
          • Re: Sauna Heater Control. Help Needed.
            ralphjy

            Hi Eugene,

             

            Nice looking project.  I would suspect your problem is that the 240V input glitches when your load switches and that causes the 5V to glitch.  If you had a scope you could monitor the 5V supply.

             

            I guess it is not convenient to isolate the 5V supply from the 240V (e.g. if you had a separate 120V circuit), but that probably would fix it.  Replacing the relay with a solid state relay probably won't help unless your circuit load is close to the 2A capacity of the 5V supply (have you measured the supply current with the relay on?).  If it is very intermittent maybe an additional filter capacitor on the 5V output would help.

             

            Ralph

            2 of 2 people found this helpful
              • Re: Sauna Heater Control. Help Needed.
                studioab

                Thank you for all your suggestions. I want to assure you that all wires from the master switch to the sauna box and to the heater, contactor, 65A breakers, fuses are installed according to specs by professional electrician. Sauna heater is working fine with the old control module that came with it.

                 

                Contactor that came with the heater is rated 40amp per terminal, and as far as I understand, 37.5A is actually 18.7A per leg (120 L1/L2) so it should be enough.

                 

                • I checked the voltage with the electronic voltmeter between L1/L2 (240) line during start/stop, no drops or spikes, 5V output is also stable (issues reproes only after heater starts working, sometimes even after 1 hour or so)
                • This is the relay board that I’m using right now, I think Arduino is fully capable of running it.
                • I was testing the whole system for multiple hours without heater, everything is working as expected

                 

                This is what I will try to do next, please let me know what you think:

                 

                1. Remove the heater wires from contactor and test the system with contactors coli only
                2. Replace relays with solid state relays, it's rated 2A output and it should be more than enough to power contactor’s coil
                3. Shield and filter all DC wires coming to Arduino from LCD and Encoder
                4. If #2 doesn’t help, I will try to use batteries to power the system and if it helps I will remove high voltage components (power module and relay) from the box and keep them away from Arduino and LCD

                 

                I could be wrong with my assumption here, but I noticed that almost all the time Arduino crashes right after contactor turns off the heater. I haven't seen any issues when contactor turns on the heater.

              • Re: Sauna Heater Control. Help Needed.
                mcb1

                studioab

                It looks like a nice project, and the pysical isolation to users is a great safety point.

                Your pictures show a number of 5v relays, and I'm presumming the contacts on these is switching the 240v mains power to the contactor.

                 

                relay is not connected to contactor so there is no real load

                Does this mean you tested it with the 5v relays in place.?

                 

                When I hook up contactor to relay

                Does this line mean the 240v connected to the relay contactor to power the contactor.

                 

                Do you have any details of the 5v supply that you are using.?

                My suspicion is that when the heater is switched, the load from the 5v relays combined with the drop in mains voltage is causing the 5v supply line to fall enough to cause issues.

                There are several ways to overcome this, but the answers to the above will help decide which solution is more suitable.

                 

                 

                The proximity is not the issue here.

                Cheers

                Mark

                1 of 1 people found this helpful
                • Re: Sauna Heater Control. Help Needed.
                  studioab

                  https://www.element14.com/community/servlet/JiveServlet/download/232713-252340/Sauna.png

                   

                  Here is how everything is wired including 5v power module specs.

                   

                  System works without issues switching relay only without activating contactor.

                  1 of 1 people found this helpful
                    • Re: Sauna Heater Control. Help Needed.
                      mcb1

                      System works without issues switching relay only without activating contactor.

                      In that case I suspect that the issue is caused by the mains voltage dropping enough to upset the power supply, and therfore glitching your Yun.

                       

                      The simpliest thing to try is adding a large capacitor across the 5v.

                      You'll need a 10,000 uF or more and it can be made from several capacitors.

                      This acts as a reserviour to hold the 5v up while the supply drops when the mains drop

                       

                      The second option is to try another power supply, but of a different type (ie not the same type).

                      Your design is physically limiting your options, and you don't want to comprimise the safety aspects of this build.

                       

                       

                      A 2 Amp supply would seem to be adequate, but many struggle to provide the full voltage at higher load currents.

                      With the YUN, relay, and the display, the drop in the 24ov supply is probably enough to cause a reset, of either the Yun or the LCD as you are observing.

                      You might be able to save a bit by pulling the backlight jumper off temporarily.

                       

                      It seems that the hardware design of the Yun makes them more susceptible to power than other boards.

                      https://playground.arduino.cc/Hardware/Yun

                       

                       

                      You can measure the mains voltage when the 9Kw heater is on.

                      You may be shocked to see how much it drops to.

                       

                      Here in NZ the maximum load on a sinlge phase is less ... 32A which equates to 7.6Kw.

                      Most Spas (similar sized heaters) used dual heaters on seperate phases.

                       

                      Mark

                        • Re: Sauna Heater Control. Help Needed.
                          jw0752

                          Hi Mark,

                           

                          I checked out the Arduino site and they mentioned some of the same issues that Eugene is experiencing. Unlike many of the other Arduino boards the Yun doesn't seem to have its own regulator.

                           

                          John

                            • Re: Sauna Heater Control. Help Needed.
                              studioab

                              Thank you for pointing me to the Yun specs, it seems this board is quite different from another Arduinos.

                               

                              The Yún board does NOT come with a built-in power regulator (as does the Yún Shield). If you are experiencing instability on the WiFi chip, blue LED going off, strange or sudden resets, etc., adding a good regulator will likely solve these issues. The Atheros chip (the WiFipart) seems especially sensitive to transient spikes, ripples, lead inductance and the like when powered from the vIn pin. For example, if you power high current devices (e.g. a high torque servo) on the same power supply as the Yún (obviously not from the board, but on the same input power line) the inductance pulse, spikes or ripples will likely reset the Atheros chip much like pressing the Yún reset button. Placing a small up/down, adjustable dc-dc regulator such as the Pololu S7V8A accompanied by a 33-100uF Electrolytic Cap just before the regulator will most probably solve most of these instability issues. Pololu has a good article on Understanding Destructive LC Voltage Spikes If you are driving high power stuff, feed them before the regulator, always with common ground, of course.

                               

                              I can order this regulator and try to add it, but I still don't understand why reset doesn't happen when the heater is actually being turned on. I only observed the issue when the board sends a signal to relay to turn off the heater after it's been working for a while. I'm wondering can it be a voltage spike or EMI occurs when contactor disengage contacts that are under high AC load?

                               

                              It's easier for me to rewire the relay board and use an external phone charger. Please let me know if it would make sense to do it this way?



                                • Re: Sauna Heater Control. Help Needed.
                                  mcb1

                                  I still don't understand why reset doesn't happen when the heater is actually being turned on

                                  but I noticed that almost all the time Arduino crashes right after contactor turns off the heater. I haven't seen any issues when contactor turns on the heater.

                                  I hadn't seen these responses when I answered you earlier (cant explain why they didn't show)

                                  This suggests that either the coil of the contactor is causing an issue with a component on the YUN (earlier Pi3 had issues with flash from cameras), or the rise in 240v mains is making the power supply think it's too high and shutting down enough to cause the YUN to glitch.

                                   

                                   

                                  The capacitor is probably the quicker and easier method (if you have one).

                                  Adding a phone charger will require tying the negative of both sources together, but you could try powering the YUN temporarily with it.

                                   

                                  Glitches in power supplies will not show on a meter. You really need an Oscilloscope to see it.

                                   

                                  You might be able to test this by manually switching the contactor ON and OFF using a switch.

                                  This would allow more cycling to see if you can eliminate it.

                                   

                                   

                                  I was a bit surprised by the YUN board power arrangements. It seems a little crude given that these aren't particularily cheep and have a lot going on.

                                   

                                  Cheers

                                  Mark

                                    • Re: Sauna Heater Control. Help Needed.
                                      mcb1

                                      studioab

                                      I just had another thought to assist in isolating the cause.

                                       

                                      If you are able to disconnect the Heater but leave the contactor switching, it will help identify if the contactor col or the load on the mains voltage is causing the issue.

                                      In theory this is simply a matter of disconnecting the load side, and operating the contactor.

                                       

                                       

                                       

                                      Mark

                                      1 of 1 people found this helpful
                                        • Re: Sauna Heater Control. Help Needed.
                                          studioab

                                          This is what I'm going to try tonight. I'll disconnected heater wires and run the test that turns on and off the contactor every 15 minutes.

                                           

                                          Will post results tomorrow.

                                           

                                          Thanks.

                                            • Re: Sauna Heater Control. Help Needed.
                                              studioab

                                              Results came really fast

                                               

                                              I disconnected heater wires from the terminals, and tried to turn on and off contactor without the load. LCD is still glitching but arduino seems to be working fine, because knob is still controlling the relay.

                                               

                                              here is the video if you want to see it.

                                              https://photos.app.goo.gl/flRyRDLa82xNVoar1

                                               

                                              My understanding is that:

                                              #1 - LCD is glitching because high voltage wires that go to relay are too close to LCD data wires

                                              #2 - I wasn't able to reproduce issue when Arduino crashes or freezes, which I believe is another issue caused by voltage drop or something else, I need to eliminate issue #1 first

                                               

                                              My next step is:

                                              - Shorten LCD wires and shield them from AC wires

                                               

                                              Please let me know what you think.

                                               

                                              Thank you.

                                              1 of 1 people found this helpful
                                                • Re: Sauna Heater Control. Help Needed.
                                                  mcb1

                                                  LCD is glitching because high voltage wires that go to relay are too close to LCD data wires

                                                  I don't think that is the cause.

                                                  I still think you have an issue with the supply.

                                                   

                                                  Yes the LCD is glitching, but in theory the YUN should also be locking up.

                                                   

                                                   

                                                  Is there a way to run the controller off another supply temporarily (and carefully)

                                                  Also you haven't answered if you have a large capacitor (it can be higher than 5v) to hang across the 5v supply.

                                                  These LCD's have no brownout protection at all, and are susceptible to power.

                                                   

                                                  Mark

                                                  1 of 1 people found this helpful
                                                    • Re: Sauna Heater Control. Help Needed.
                                                      studioab

                                                      So I ended up:

                                                       

                                                      - adding between Vin and gnd 1000 mf / 24v cap (didn't find anything better)

                                                      - replacing existing power module with external Nokia 5V 3A phone charger

                                                      - removing all AC high voltage wires and relay module from the box

                                                       

                                                      Quick testing shows that LCD is not glitching anymore when quickly turning on and off. I tried it with and without heater connected to contactor.

                                                       

                                                      At this point I will continue using it for a few days to see if the system is working without issues.

                                                      2 of 2 people found this helpful
                                                        • Re: Sauna Heater Control. Help Needed.
                                                          mcb1

                                                          - adding between Vin and gnd 1000 mf / 24v cap (didn't find anything better)

                                                          - replacing existing power module with external Nokia 5V 3A phone charger

                                                          - removing all AC high voltage wires and relay module from the box

                                                          Well done you've made some progress, but we still need to isolate the actual cause.

                                                           

                                                          There was an additional item we could have checked.

                                                          If you add a 230v 75/100w lamp across the contactor coil, when the relay turns off, any spike or back emf will be absorbed by the lamp.

                                                           

                                                          While it's not the final solution it might prove the coil back emf is the issue.

                                                           

                                                          I am still suspicious of the supply being the underlying cause.

                                                          The power supply circuitry has nothing in the way of filtering on the Vin side of the Pin. (Vin goes thru a diode before any capacitors.)

                                                          http://cdn.sparkfun.com/datasheets/Dev/Arduino/Boards/arduino-Yun-schematic.pdf  or

                                                          https://www.arduino.cc/en/uploads/Main/arduino-Yun-schematic.pdf

                                                           

                                                           

                                                           

                                                           

                                                          As you can see on the YUN side of the 5v there is 10uF + 2.2uF and these are not enough to smooth everything.

                                                           

                                                          Q. Which pins is the 5v supply to the LCD connected to. ie Vin or 5v

                                                          Your block diagram shows it has 5v, but doesn't say where the wires are connected to.

                                                           

                                                          Cheers

                                                          Mark

                                                        • Re: Sauna Heater Control. Help Needed.
                                                          beacon_dave

                                                          The ATmega32u4 in the Arduino Yún does have brown-out protection however and assuming that is enabled it should cause the Arduino to be held in reset with a voltage drop (not sure about the Atheros coprocessor) and then restart when power is back within limits, so in theory the Yún shouldn't stay locked up even if the LCD display does.

                                                          ne question perhaps is where the Yún originated from for this project and if its brown-out detection fuses have been altered or not from their default.

                                                           

                                                          Not so sure about the discussion about the need for an additional regulator, as presumably the IRM-10-5 should be regulating the output to 5V:

                                                          https://www.meanwell-web.com/en-gb/ac-dc-single-output-encapsulated-power-supply-irm--10--5

                                                          However if you look at the datasheet the IRM-10-5 does appear to have overload protection which shuts off the output upon voltage overload (5.75 - 6.75V) and then restores it after the fault condition is removed:

                                                          https://www.meanwell-web.com/content/files/pdfs/productPdfs/MW/IRM-10-spec.pdf

                                                          It doesn't appear to state how long this recovery takes. If there was a sufficient spike on the line after the contactors were released then perhaps this could be triggering the shutdown of the 5V output rail.

                                                           

                                                          Once again however I would have expected this behaviour to trigger the brown-out detector in the ATmega32u4 and cause a controlled reset to take place rather than a lock-up. This could suggest that there may also be an initialisation issue in the programming causing the lock-up after a brown-out reset.

                                                          1 of 1 people found this helpful
                                                            • Re: Sauna Heater Control. Help Needed.
                                                              mcb1

                                                              beacon_dave

                                                              Thanks for the link to the supply. That was my next task to chase it down.

                                                              Not so sure about the discussion about the need for an additional regulator, as presumably the IRM-10-5 should be regulating the output to 5V:

                                                              I seriously doubt it has anything in the way of decent filter caps, as they get paranoid about caps being able to rupture and vent, rather than explode.

                                                              Being encapsulated and the block diagram suggests it has the smaller caps for the high frequency inverter only.

                                                               

                                                              The unit is designed to part of a complete equipment, which means the necessary filtering would be external to theis supply, in the same way they are with a three terminal reg..

                                                               

                                                               

                                                              The LCD has nothing in the way of filter caps, and they have no brown-out protection at all, hence can be less tolerant than the YUN.

                                                              If this is wired across the 5v supply, then it's very likely it is the first casualty for spikes in the supply.

                                                               

                                                               

                                                              The YUN, LCD and relays have become an aerial floating above ground, and one other trick might be to connect the negative to earth if it appears in the box.

                                                               

                                                              Firstly we need to help the OP isolate what the cause is and sort out the best solution.

                                                              Filtering may be enough as it seems that 1000uF might have made the difference.

                                                               

                                                              Cheers

                                                              Mark

                                                                • Re: Sauna Heater Control. Help Needed.
                                                                  studioab

                                                                  I've had sauna working for 10 hours straight heating to 80C and then cooling to 40C, my test log shows that it completed 5 full cycles. This is a huge improvement, before it was always crashing after 1 cycle.

                                                                   

                                                                  With the new 3A power supplier V output is 5.36 vs 4.75 (old one). I can see that LCD screen is much brighter now, I even adjusted brightness level a little bit.

                                                                   

                                                                  At this point, I'm totally fine to keep power supplier and relay board ouside of the Arduino/LCD box, because I have plenty of space in the electrical box, and there is no reason for me to cramp everything together. Initially I thought that it would be good idea to keep everything together, but I was wrong.

                                                                   

                                                                  I'll try to answer some of your questions:

                                                                   

                                                                  - I've tried to add 100w lamp, as mcb1 suggested, I can see a little flash, but it didn't make any difference

                                                                  - LCD power is connected to Arduino 5V out, connecting it to power supplier directly didn't make any difference

                                                                  - I have common ground in the box and can easily connect to Arduino ground if you think it would be safe

                                                                   

                                                                  It's hard to say what was the main cause, but we eliminated it, I hope, completely by:

                                                                  - adding 1000 cap

                                                                  - removing AC components and wires outside of the box

                                                                  - replacing 2A power module with external phone charger 3A

                                                                    • Re: Sauna Heater Control. Help Needed.
                                                                      mcb1

                                                                      This is a huge improvement, before it was always crashing after 1 cycle.

                                                                      That's great it has stopped crashing.

                                                                       

                                                                      - LCD power is connected to Arduino 5V out, connecting it to power supplier directly didn't make any difference

                                                                      I presume then that the 5v from the supply connects to Vin.

                                                                       

                                                                      I can see a little flash, but it didn't make any difference

                                                                      I would expect to see the lamp ON whenever the contactor was ON, and off when it wasn't.

                                                                      I'm not sure why you only saw a flash.

                                                                       

                                                                       

                                                                       

                                                                       

                                                                      - I have common ground in the box and can easily connect to Arduino ground if you think it would be safe

                                                                       

                                                                      The current arrangement leaves it possible for the whole setup to become 'live' which is fine, except that the encoder knob is the part a person could touch.

                                                                      Yes it has a plastic knob but this may not be 230v rated and it is behind a plastic cover so it's unlikely to be accidently bumped.

                                                                       

                                                                      Connecting the ground (negative) to earth means that you have a better chance of stopping parts from becoming live.

                                                                      HOWEVER before doing this it might pay to use a voltmeter to check if there is a voltage between the negative from your 3A supply and the earth.

                                                                      It may have some leakage which elevated it, but this should drop when you connect the meter (although it might be slow)

                                                                       

                                                                       

                                                                      For future reference.

                                                                      The relay board might have relays that are 250v rated, but the pcb design is not suitable for mains.

                                                                        versus 

                                                                      The second image shows the extra cutout in the pcb around the common, so that mains voltages cannot creep or jump across to the relay coil terminal.

                                                                      (Yes it is only a single, but the dual ones are the same)

                                                                       

                                                                       

                                                                      This style uses a different relay where the physical isolation is much greater.

                                                                       

                                                                       

                                                                       

                                                                      Cheers

                                                                      Mark

                                                                      1 of 1 people found this helpful
                                                                      • Re: Sauna Heater Control. Help Needed.
                                                                        Jan Cumps
                                                                        1. adding 1000 cap
                                                                        2. removing AC components and wires outside of the box
                                                                        3. -replacing 2A power module with external phone charger 3A

                                                                         

                                                                        I'd vote for #1 and #3 in this case.

                                                                        1 of 1 people found this helpful
                                                        • Re: Sauna Heater Control. Help Needed.
                                                          jw0752

                                                          Hi Eugene,

                                                          Spikes are not as likely to be generated by a relay or contactor coil when they are being energized as when the power is cut. This is not as serious if the switch is a manual one compared to a solid state switch like a transistor or gate. A lot of situations may be contributing to make your problem. The fact that you have no trouble when the main heater isn't in the circuit suggests that it is a factor. If there are more than one variables in this equation it might be difficult to pin down one cause. If you add a regulator like a 7805 you will have to supply it with at least 8 volts so that it has enough voltage to do its job. The fact that others have had similar issues to yours and the use of a regulator solved the problems is a good indication. Here is a recommended wiring of the LM7805 regulator.

                                                           

                                                          Click on the schematic to enlarge it.

                                                           

                                                          Here is the data sheet for the LM78XX series of regulators:

                                                           

                                                          http://www.farnell.com/datasheets/2298694.pdf?_ga=2.245920388.1679369121.1514241859-118307707.1475274175

                                                           

                                                          John

                                                  • Re: Sauna Heater Control. Help Needed.
                                                    studioab

                                                    I would like to say huge thank you to all people that contributed to this thread. I was able to eliminate all the issues causing arduino to crash. Now my project is in "production" mode. It's cold out here and we use sauna regularly.

                                                     

                                                    Here is the video showing how Android phone is being used as a secondary display in the sauna room as well as remote control https://photos.app.goo.gl/qZVTBh0PwFJLmZzv2

                                                     

                                                    Few words about project "Sauna Nest" (UI was inspired by Nest thermostat)

                                                     

                                                    Hardware:

                                                    - 9KW Humm Heater

                                                    - Arduino Yun + Temp Sensor + Door Sensor + Rotary Encoder + 1602 LCD + Relay Board + 40Am contactor

                                                     

                                                    Arduino Software (server side):

                                                    - Libraries (Bridge, Encoder, LCD)

                                                    - Server to process GET requests

                                                    - support for test modes to emulate temp increase/decrease, door state, temp sensor errors, etc.

                                                     

                                                    Android/iOS/Web (client side):

                                                    - Cordova crossplatform framework

                                                    - SVG is being used to render "Nest" like UI

                                                    - all UI/UX business logic is in JavaScript

                                                     

                                                    Features:

                                                    - remote turn on/off

                                                    - remote change target temp (40 - 110)

                                                    - turn off heater after 90 mins

                                                    - open door alarm

                                                    - turn off sauna after door is open for more than 60 sec

                                                    - show estimated time to get to target temp

                                                    - turn off heater when temp sensor is failed

                                                     

                                                    Todo:

                                                    - phone push notifications

                                                    - phone control for music in the room

                                                    - phone control LED lightning

                                                     

                                                    Do you guys think this project should be opensourced? Would people benefit from it?

                                                     

                                                    Happy new year!

                                                    1 of 1 people found this helpful
                                                      • Re: Sauna Heater Control. Help Needed.
                                                        mcb1

                                                        I would like to say huge thank you to all people that contributed to this thread. I was able to eliminate all the issues causing arduino to crash

                                                        Glad we could help.

                                                         

                                                        Do you guys think this project should be opensourced? Would people benefit from it?

                                                        A detailed writeup here would be good.

                                                        You reached out to this community to help, and the community was able to help, so it might be a good place to start.

                                                         

                                                        You can either do it as a blog in Arduino, or your personal blogs, and add lots of appropriate tags so people find it when searching.

                                                         

                                                         

                                                        I would suggest that you add warnings about working with mains and suggest that people get it checked by a qualified electrician.

                                                        In some countries the work you've done may not be legal, (which may comprimise any insurance claims) but could be legal if checked and fitted by a registered electrican.

                                                         

                                                        Mark

                                                        • Re: Sauna Heater Control. Help Needed.
                                                          gadget.iom

                                                          It's great to see such a detailed post

                                                          Keen to see how you progress with your improvements.

                                                           

                                                          Paul