1
\$\begingroup\$

I've designed and implemented LED Dimmer driven by PWM from Adruino Pro Micro (CLONE) with software based on MySensors library.

See the schematic attached below. Schematic of uC controlled LED Dimmer

The idea is really simple:

  • uC is separated from MOSFETs with popular octocouplers (LTV 847 in this case),

  • Arudino Pro Micro is power supplied from PC via USB cable,

  • Arduino Pro Micro is communicating with PC with serial line and simple protocol (MySensors),

  • MOSFET is driven by PWM from Arduino Micro (as mentioned, uC is separated from MOSFETs with octocouplers),

  • There is on board thermometer to verify if temp is not getting too high,

  • There are 4 chanells where I am able to attach 12V LED stripes to control and dim.

Generally I am - or was - satisfied with how it worked, as all worked well (all integrated and managed by domoticz).

Yesterday I tried to change dim level of one of the strips and there was no response. I tried to turn on other stripes and there was no response either. When I was sending commands (on, off, change dim level) I noticed that they were received by Arduino (I observed onboard LED blinking when I was sending commands), however MOSFETS didn't respond at all (no chanage in dim level of LED that was ON and no response from LED strips that I tried to turn on).

This happened after few weeks (I guess 1 month...) of using the dimmer, dimmer started working properly after turning it off and on (unplugging power supply). I noticed that temperature of the environment where dimmer was placed was around 33degree celsius (it remaind more less same for the mentioned period).

What is the matter? Is it something with the circuit? If so, what shall I change in it to avoid situation as explained? Is there anything I could add here to make the description more clear?

\$\endgroup\$
3
  • \$\begingroup\$ What's up with the SFH206 on the gate of your MOSFET? \$\endgroup\$
    – Drewster
    Aug 13, 2019 at 20:00
  • \$\begingroup\$ What is the current level in the LED side of the opto? What CTR level of opto do you have? \$\endgroup\$
    – Aaron
    Aug 13, 2019 at 20:11
  • \$\begingroup\$ @Drewster: I just realized how badly it is described in the schematic, this diode is just a LED/ 5mm diode to indicate the PWM (so that I could see the signal w/o attaching LED stripe). It is super misleading, however it gives proper raster in physical PCB. Please ignore this. \$\endgroup\$
    – jrz
    Aug 13, 2019 at 23:01

3 Answers 3

1
\$\begingroup\$

In situations where something has worked for a long time (days) and has suddenly stopped, it can be difficult to tell exactly what happened. As far as flaws with your circuit (that would make it suddenly stop working after a month), the photodiode is the biggest thing that looks weird to me. Not to mention (from a terminology standpoint) "Comm" or Common generally isn't used for "power".

My suggestion would be to put a scope/ voltage probe on the output next time your design acts up. It could be that the power supply had an issue totally independent to your circuit.

If the problem is too sporadic, try simulating your design in something like LT spice and sweeping operational parameters and temperature to make sure nothing is biased on the limit.

\$\endgroup\$
1
  • \$\begingroup\$ Thank you for this comment (Fully agree with "Comm" comment - I decided to leave schematic as is just to be confident all is exactly as in physical PCB, even though it is a bit misleading). When it comes to the photodiode - in fact this is a 5mm regular LED diode to show PWM signal (for testing and debugging). LT Spice hint - never used that tool, so may not come back quickly with results in this thread. \$\endgroup\$
    – jrz
    Aug 13, 2019 at 23:12
0
\$\begingroup\$

Based upon your question, it would appear that you had one channel set to a particular dim level, and the other three channels were off. If the one lit channel was maintaining it's dimmed level prior to your resetting the circuit, it would indicate that the PWM was working properly, and that the controller was simply ignoring or not responding to commands.

That fact, combined with the fact that repowering the circuit caused it to start working properly again, indicate that this would likely be some sort of software/controller issue, and not a problem with the output portions of the circuit that can be picked apart by examining the schematic.

If your serial link to the PC is bi-directional, you may want to consider echoing the values of your variables to the host PC and log them there

\$\endgroup\$
2
  • \$\begingroup\$ Both comments are valuable as it seems circuit is relatively sound (except for mentioned "Comm" and photodiode issues). Assuming circuit is OK I have reinspected the code and cannot reject your @Hitek hypothesis ("that this would likely be some sort of software/controller issue") as code uses some arithmetic operations (substraction/ adding operations on time with UL int variables). 'if (_now <= _lastBrightnessUpdate + _updateBrightnessDelay) ` \$\endgroup\$
    – jrz
    Aug 13, 2019 at 23:31
  • \$\begingroup\$ If your serial link to the PC is bi-directional, you may want to consider echoing the values of your variables to the host PC and log them there.... Hmmm, gonna add that to the answer. \$\endgroup\$
    – Hitek
    Aug 13, 2019 at 23:44
0
\$\begingroup\$

When something stops after around 5 minutes, you should check your micros() calls. When this happens after a month, millis() can be suspicious. So check out Baldengineer's millis tutorial about rollovers: https://www.baldengineer.com/millis-tutorial.html

(I would, but your code is not here.) I guess your code tries to reach a millis value that's not happening any time soon (maybe next month). For the future put this into your code snippet collection or something (easy to screw up, hard to debug if you need around a month to check):

if ((unsigned long)(currentMillis - previousMillis) >= interval)


Please note that if you don't need a 1/16th celsius precision, most Atmel uCs have internal thermometers you can use for this exact reason (to check if your stuff overheated or not). Also I couldn't find where PIN_08 and PIN_A2 are connected. Maybe to your PC?

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.