Close
0%
0%

4 Ch Dimmer with 4D Systems Touch LCD and Arduino

Turning an Arduino into a dimmer controller with a visual twist on 4D Systems LCD

Similar projects worth following
This small project, my first incursion into Arduino with an ATMEL 328P controller, started with a specific necessity: the implementation of a few dimmers to control some 127V / 35W dichroic lamps at home. There is a problem with it : in Brazil, the dimmers available on the market are those with knobs, really ugly and less practical. OR, those really fancy expensive models, fully digital, IoT, connected to mobile via bluetooth kind of thing. No-go. So, I stepped up and got my hands dirty, digging microcontrollers and support electronics to get this project live!

It all started with a youtube video that shown a 3 channels dimmer with arduino. It didn't have the visual part (so you couldn't control it, it was a simple function changing the lights luminosity "randomly"), but it was a good start. Also, I found an Instructable with a 1 Channel 220V / 50 Hz AC dimmer controlled by an Arduino that seemed promising. I had to do some calculations and to adapt some parts to my 127V / 60Hz local voltage. Not too hard, but...

For starters, you have to know how many channels you're going to need to make this kind of project successful. For me, 4 channels. Second, you would have to have an idea of how many levels would you permit your users (me and my wife, in this case) to interact with this dimmer. I thought of 100 levels would suffice. Later, with some experimentation, you will realize that you will NOT need that level of granularity for this kind of application: about 20 will suffice. I've ended up using 80 levels, much for laziness than any other specific reason. Going a little further in the planning part, you may add a kill switch if you just want to turn off all channels at once. That could be a hardware or software switch, it will depend on how much of space you will have left in the interface. Also, I've added a "presence" detector (a simple PIR sensor did the trick), so we can turn off the display in case that the space is empty.

  • 1 × uLCD-32PTU-AR Connectors and Accessories / Miscellaneous Connectors
  • 1 × Arduino Nano
  • 1 × PIR sensor (compatible with arduino)
  • 4 × Wire connections
  • 1 × Cables for connections

View all 15 components

  • Circuit Miniaturization and Concessions (for the size sake)

    Jaques Lopes Schroeder05/24/2018 at 13:49 0 comments

    Some time has passed now and it is finally time to get it to the final product: to enclosure it into a 10 x 10 cm case (home 2 x 2 interruptor case), and route every single wire that's in it to fit and connect correctly to the circuit. I figured that 2 of the 7x3 cm perforated PCBs would be enough for the main circuit would be enough to hold everything in place. It actually turned out a very nice circuit!  The only part I could not put in them is the power supply, as it was from another device that was decomissioned years ago and I never found a use for it until now, so I could not mess with it very much. I ended up puting the PSU into another outlet box and pulled some cables from there to where the dimmer has been planned to be. Connections made, and after a few hours of elbow grease I finally managed to reroute the mains and lamps cables to fit in the box with the circuit and the display! But still there was something missing: how do I get the display and the PIR sensor to fit into a blank cover?

    After a few measurements, I figured that I could cut a blank cover to its exact size, and place the PIR sensor just below it. As I don't have a 3D printer, and nowhere to be found a blank cover to fit both display and sensor, I went to cut a simple blank to its size. With the help of some glue, I was able to fit and secure both in place, and after some mechanical testing, I was satisfied with the result!

  • Adding a PIR sensor to the Project!

    Jaques Lopes Schroeder05/24/2018 at 13:31 0 comments

    Some time passed and I figured that I had to save the 4D Systems backlight for this project to be successful. Studying the display datasheet, I've found that it has a command that can turn off /turn on the backlight, and I figured that I needed just some kind of pulse to get it to work. What could be the source of this pulse?

    Of course! A PIR sensor! Quickly I bought one from the internet and when it arrived I've put into practice the plan. Added new connections, added new inputs to the Arduino, implemented the codes into the logic, and it worked successfully! Now it shuts down the backlight after 10 seconds without any signal from the PIR, and as soon as the sensor picks something, it turns the backlight back on! Success!

  • Final prototype!

    Jaques Lopes Schroeder05/24/2018 at 13:24 0 comments

    With all components assembled in the proto board, I tested the system and, as such, there were some flaws in the arduino program and in the zero-cross detection circuit. How would I fire the Triacs in the correct time? Also, how the Arduino is receiving the signal from the zero-cross detector? I figured that the zero-cross circuit was faulty as when I have set the dimmer to a 50% of power the lamp was just blinking as it was a disco! Reviewing the circuitry connections revealed that I have connected the pin of the Arduino input at the non-connected pin if the TIL 111, where it should be connected to the pin 5 (the colector) of it. Correcting the connection and testing it afterwards revealed that there was still a problem with the Arduino logic, as the firing of the triacs was correct, but the scale on the display (where we control the luminosity using the individual scroll bars) was wrong. More calculation needed, as we have in Brazil 110V / 60 Hz, and the propagation of the firing in the Triac has to be taken into account. 

    Adjustments made to the logic, program compiled, uploaded to the Arduino, and finaly it worked as it should!

  • Connecting 4D Systems LCD display to an Arduino

    Jaques Lopes Schroeder07/12/2016 at 19:27 0 comments

    After dealing with this, all test and failure with the Triacs, figuring out how to connect a 4D Systems display was a piece of cake: add the library to your Arduino programming environment, add 2 lines to the setup part in arduino program, and a few other lines just to send / receive the events reported by the display. YES, it is so much easier to connect using its library, you just have to build your project as a VisiGenie, and in the forms, you have to use "ReportEvents", so the objects you have envisioned would be able to report any change without having to query the device on every cycle! Much simpler!

    Now, programming the arduino...

    Due to some tests I've made with the Triacs firing angle, hertz and specs of these triacs, I've learned that it will not fire the triac just in the first part of the crescent sine wave. The reason for that is simple, and is in the datasheet for the Triac: to sustain a propagation in the junctions of the Triac, you have to have at least 10 volts at the end of your trigger event. If you do the calculations, that would request at least 5 cycles of our 104us cycles to reach that voltage. So, if you're wondering, you'll lose some of your power of your dimmed lights, but not much.

  • Triacs and Sync with Phase

    Jaques Lopes Schroeder07/12/2016 at 18:11 0 comments

    Now, this is the fun part: building up your circuitry! I've found this (http://www.instructables.com/id/Arduino-controlled-light-dimmer-The-circuit/) very interesting, but due to some availability problems, I had to improvise / change some parts. For instance, it was written based on the H11AA1, which is an optocoupler with 2 leds in parallel (one against the other), that is not so common in Latam. As the zero-cross detector circuit had a bridge rectifier just before the optocoupler, I decided to use a single led optocoupler, without zero cross detector in it, but that delivers a pulse signal within the 5V limit of the arduino. The Triac TIC206 is another part that I had to change, using a BT136 instead (up to 600V, 4 A on state, 25A non repetitive peak) to handle my dichroic lamps. All other parts were used as described in the Instructables. As you might have imagined, the simplest thing on it was to replicate 3 more times the TRIAC part of the circuitry, to deal with all channels that I needed. A pro tip on the Triacs: bear in mind the Terminal1 and 2 on the Triac, as if you deliver voltage to the wrong terminal, IT WON'T FIRE to the other terminal! (OK, I had a fight, long, ugly fight, with the Triac, just to find out that I was delivering voltage to the wrong terminal! )

  • Studying the Needed Hardware

    Jaques Lopes Schroeder07/12/2016 at 15:56 0 comments

    Studying the Hardware Needed

    The most difficult part: decide which hardware you're going to build/ use for this. I've picked the display, first, to see options and ease to use it out-of-the-box.

    As I've explained before, I live in Brazil, and for that, not all hardware is available in electronic shops around here. I was searching for a usable LCD touch display, with a decent area and enough power to display sliders and send them in a timely manner to Arduino, so it can treat it accordingly. None of the locally available displays seemed feasible (too small - 2.4 inches, are you kidding me? - 9600 bits comms, or too much fancy - capacitive sensor, which would deeply hit my budget to the project), so I started to look into Adafruit / hackaday / other forums to see what the other guys were using. I've crossed to 4D Systems 3.2" LCD touch (http://www.4dsystems.com.au/product/uLCD_32PTU_AR/) which has a powerful SoC, easy to connect to an Arduino host, easy to use libraries, loads of stuff that you can program / use straight with this device. Perfect choice! Small step back: due to customs, it added almost 50% of the cost just in import taxes, but for the functionality, seems ok!

    Arduino controllers are common / simple / easy to use, but one question remained to me: would it be fast enough to control the dimmers (even more with added dimmer channels)? You have to have in mind that these controllers have a 16 MHz oscillator and, in theory, would be able to have one processing cycle in :

    1000000 (us) / 16000000 (MHz) = 0.0625 us

    That it would easily fit in our handling for the dimmers:

    1000000 (us) / 100 (levels) / 60 Hz * 2 (fire angle for Triacs) = 83.3 us.

    Adjusting to my options, I had:

    1000000 (us) / 80 (levels) / 60 Hz * 2 (fire angle for Triacs) = 104.1 us

    Even better!

View all 6 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates