element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Smarter Life
  • Challenges & Projects
  • Design Challenges
  • Smarter Life
  • More
  • Cancel
Smarter Life
Blog Smight - 230V uC based dimmer
  • Blog
  • Forum
  • Documents
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: gelmi
  • Date Created: 24 Nov 2013 10:54 PM Date Created
  • Views 841 views
  • Likes 2 likes
  • Comments 3 comments
  • psoc4
  • smarter_life_challenge
  • smight
  • dimmer
  • smarter_life
  • 230v
  • psoc_creator
Related
Recommended

Smight - 230V uC based dimmer

gelmi
gelmi
24 Nov 2013

It took me some time to solder everything together, but finally I got it working. Bulbs and lamps supplied with 230V are not so easy to dim. You cannot just take PWM signal from uC and simply use it as for DC powered lights. However, there are various ways to accomplish dimming. You can check some other methods online, for instance, the method to relay power from the bulb to some resistor, but still you have to pay for this wasted energy. There is a better way to use only some percentage of energy, the one you need to supply the lights. First, let's check the theory.


The following project deals with 230V which can be dangerous and cause injury or even death. Be smart about it!


In Poland (Europe) we have 230V, 50 Hz mains (if you want to use this in other sources, like 110V or 60 Hz, you will have to adjust some things), that means the signal that goes to our standard bulb looks like this:


image

To supply less power to our bulb decreases the brightness of the bulb. So, all we need to do is to block some of this sinusoidal energy signal. In result we can get something like this:

image

If we want to use uC, it is wise to design isolated circuit. There are some open hardware/software solution for this. One of them is presented below:

image

It works like this: 230V mains goes through the bridge and the sinusoidal signal is all positive (abs(sin(x))). In two moments every one period the signal crosses zero. So, thanks to optocoupler, twice a period we will have rising slope on the zero-crossing pin (Pin_ZEROCROSSING), which is connected to uC. The triac on the bottom in simple words blocks (if you want to better understand how triac works, please check wikipedia or some other source) load – bulb – from the supply … until the triac is fired. So when uC detects the zero-crossing it can wait for some time (it depends how much power we want to provide to the bulb) and then it sets the dimming pin (Pin_DIMMER) for a short time (little over 10 us is sufficient). So from the time when uC fired triac to the next zero -crossing moment, the current will flow from mains to the bulb. The sooner it fires, the more bright the light gets.

Following this analog circuit short explanation, check how I implemented this algorithm into PSoC kit.

image

There is IRQ from zero-crossing on Pin_ZERO (rising slope), then I start Timer_1 for some time (depends when I want the triac to be fired). When the Timer_1 runs out, the triac is being fired by setting Pin_DIMMER high for 10 us and after that this pin goes low again. And so on and so on.

I stumbled upon a problem with resetting the Timer_1 (I wanted it to run in 'one shot' mode). I had to use Control Register in pulse mode in order to avoid false triggering when slow clock is being used.

This example can be used to dim the 230V bulbs, some LED lights and some other loads like thermal blankets or thermal cables in terrariums.

You can check a photo of this example and I will upload a video shortly.

image

  • Sign in to reply
  • sxh
    sxh over 10 years ago

    Hello how are you ?, you could send me the code for this project? Thank you!

    sxxh@live.com

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 12 years ago

    Good idea to warn people about the risk.  230V/50Hz is much less forgiving than 115V/60-Hz.

     

    I also liked your design.  Good job of getting line synchronization and isolation.

     

    DAB


    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • juanes.pazj
    juanes.pazj over 12 years ago

    Awesome example of power electronics!! thanks!! hope I get to use it sometime!!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube