Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

PWM Ports and Relay Switching Question


  • Please log in to reply
6 replies to this topic

#1 Coding Smackdown

Coding Smackdown

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts
  • LocationLewisville, TX USA

Posted 29 May 2012 - 02:45 PM

I'm in the process of building a brewing controller that will be used to control an existing heating element used on an electric turkey fryer. My goal has been to mod the existing unit without replacing much of the existing parts. As the system is now, the heating element is turned on and off by a 12VDC relay. I've got this working quite well by using a normal IO pin and turning it on and off. What I would like to do is as the temperature of the beer gets close to my goal temperature use one of the PWM ports to change the duty cycle from 100% to 50% on down to 0% as I get closer and closer. This way I'm hoping to reduce the amount of temperature drift in the overall system. When I started playing with the PWM port and varying the duty cycle I noticed that the voltage readings were strange, at 50% Duty cycle I was only seeing 1.6 volts instead of 3.3 volts. Maybe this is because I am using a multi-meter instead of looking at it with an actual scope. Does anyone know what I should be seeing? Also, is varying PWM duty cycles with a relay a really good idea? I've read where it's not an issue with solid state relays but I'm uncertain about normal relays. Thanks
Brewing Award Winning Beer with a Netduino!
http://diybrewery.com

#2 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 29 May 2012 - 03:00 PM

Also, is varying PWM duty cycles with a relay a really good idea? I've read where it's not an issue with solid state relays but I'm uncertain about normal relays.

Ohhh, I'm not sure, I wouldn't do that... But have you looked at mosfets? I'm no electronical engineer, but I think my first weapon of choice would be a mosfet.
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#3 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 29 May 2012 - 03:45 PM

... at 50% Duty cycle I was only seeing 1.6 volts instead of 3.3 volts. Maybe this is because I am using a multi-meter instead of looking at it with an actual scope. Does anyone know what I should be seeing?

The multimeter shows you the average voltage: 50% duty cycle PWM = 50% of 3.3V = ~1.6V. If your meter has min/max recording mode, you will see min = 0 and max = 3.3V. You'd need a logic analyzer or an oscilloscope to see the waveform.

Also, is varying PWM duty cycles with a relay a really good idea? I've read where it's not an issue with solid state relays but I'm uncertain about normal relays.

PWM is not good for mechanical relays, because they have moving contacts that wear out due to arcing. Switching the relay once a while does not hurt that much, but for higher frequencies solid state relay is better. It is basically a power transistor (usually with an opto-isolator), so there are no moving parts. Also, if your heating element is powered directly from mains, you can use a TRIAC-based control circuit (= AC light dimmer, Phase Shift Power Control).

#4 Coding Smackdown

Coding Smackdown

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts
  • LocationLewisville, TX USA

Posted 30 May 2012 - 04:27 AM

Thanks Guys, I thought I had read that somewhere, but I wanted to make sure before I went down that path. Right now I'm trying to keep from making any changes to the fryer unit if possible. The only thing I've done so far was to re-route the wiring to my Netduino Controller, everything else I left in alone. Down the road if I need to have more precise control over the heating element, I'll look into replacing the existing mechanical relay with a Solid State Relay that I can use the PWM feature on.
Brewing Award Winning Beer with a Netduino!
http://diybrewery.com

#5 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 30 May 2012 - 05:30 AM

So, CW2 pointed out the problem very well, but is worthwhile to add something. As CW2 stated, the "real" PWM runs too fast for a mechanical relay. That kind of component should toggle no faster than 5-10 seconds (better when even slower). So, the solid-state way looks to be the only doable. Let's take the TRIAC. It "slices" the AC sine wave on every zero-crossing, thus 2*60Hz (for US), and 2*50Hz (for EU). That seems nice, but if I were the "Electric Company man" I'd forbid you to use a TRIAC. That's because you'd "load" all the required energy on a certain part of the sine-wave, leaving unloaded the remaining part. Believe it or not, that introduces a *LOT* of energy waste on the power line. The TRIAC is a simple yet economic way to regulate the AC power, but it wastes a lot of energy. Instead, I'd keep the initial idea. A simple mechanical relay, and drive it with a simple ON/OFF technique. It's not a dumb way, and it's very very frequent. Especially where you have "high-inertial" (I mean heating) systems, that don't create any issue. When your beer-tank holds 100 liters (25 gals?), the heating resistor at full power surely takes a lot of time to raise the temperature of just one degree. At that point, what would be the benefit of a PWM-driven heating system over a ON/OFF one? Hope it helps. Cheers
Biggest fault of Netduino? It runs by electricity.

#6 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 30 May 2012 - 01:09 PM

That's because you'd "load" all the required energy on a certain part of the sine-wave, leaving unloaded the remaining part. Believe it or not, that introduces a *LOT* of energy waste on the power line.

Mario, could you please explain a little bit more how the energy is wasted? My understanding is that when the triac is off, the circuit is virtually disconnected (there is only very little leakage current flowing), so the triac-based circuit in fact does not waste any energy (?)

#7 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 30 May 2012 - 02:46 PM

Mario, could you please explain a little bit more how the energy is wasted? My understanding is that when the triac is off, the circuit is virtually disconnected (there is only very little leakage current flowing), so the triac-based circuit in fact does not waste any energy (?)


It's very simple if you know that any periodic signal can be expressed as a composition of harmonics (Fourier series).
The behavior of the triac is exactly as you say. The waste is *not* on the triac, which is wasting (theoretically) always zero Watts.
The problem is on the value of the current flowing, with is a sliced sine-wave. This wave is actually composed by a HUGE quantity of harmonics, even to a relatively high frequency (compared to the mains: 60 or 50Hz). Now, the power wiring (I mean the Electric Co's) are running for several km, and that length could be important for frequencies much higher than the fundamental one. That leads to bad impedance coupling, power losses, in a short: power waste.
This is also one of the reasons because the "old" diode rectifiers were replaced by switching PSUs.

I must go to the dentist!
Cheers
Biggest fault of Netduino? It runs by electricity.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.