BlueTooth controlled TRIAC dimmer

PART 3 The code

I mount everything on a breadboard. Remember, in order to control power, all we have to do is to control the time between the zero cross and when we fire the pulse at the TRIAC gate.
For that, in the Arduino code, I read the value of a potentiometer and map that value to a delay between 1 and 10 milliseconds.

Why these values? Well, I know that my AC signal has a 50Hz frequency. So, the period will be in this case 20 milliseconds, so half period will be 10 milliseconds. So, just by that, using the potentiometer I can change the firing angle of my AC signal and by that I can control the time that the power is applied to this light bulb.

See the full part list here:

PART 4 Bluetooth control

Use the schematic below. It is the same, just instead of a potentiometer add the HC06 bluetooth module. Remember, don't connect the module while uploading the code.

With the scheamtic above, all I’ve done now, instead of using the potentiometer to change the delay, I’ll use my smartphone. I connect a Bluetooth module to the RX and TX pins of the Arduino as in this final schematic, upload the new code that you’ll find below, install this App that I’ve created in app inventor on to your smartphone. I connect to the Bluetooth module and now, I can dim the light bulb with my smartphone.

Full code here (bluetooth input):

Bluetooth Android App

Download App:

Have in mind that not all devices will like this kind of power control, since there are fractions of time that no power is applied to the device.
Use this kind of AC power control with motors, dimmer switches for incandescent light bulbs or as a soft starter.

So, there you go my friends. Now you know how to use TRIACs and fire pulses to control the amount of power. Use optocouplers and separate high voltage from low voltages.

You have all the schematics, the app and the example codes above so make sure you check those out. If my videos help you and you would like to help my projects, I have a Patreon campaign. The link is down below as always. I would really appreciate that guys. BTW, thanks to all my Patreons.