How to achieve reverse polarity? L298N?

I am trying to make LEDs controller for my fairy lights garland. Original LEDs controller was using only two wires with reverse polarity to control both odd and even LEDs.

Does L298N is used for this purpose? This module is often used to control DC motors including reverse speed. Is there the way to adapt this module for my purpose? If so how to connect contacts to my Uno R3?

Thank you.

Any motor driver/ H-bridge would work indeed, including the L298N, but you'll be better off to leave the dinosaur to where it belongs (in the past) and get a modern one like the TB6621FNG. Far more efficient.

Make sure that whichever part you choose can carry sufficient current for the LEDs.

Simply L298N I already have so please help me with a dino.

Below is my understanding of this scheme, please correct me if I am wrong:

There are three jumpers. Yellow one is used for selection of input current. If it is on +5V and GND are used, otherwise +12V and GND. Because I use only one fairy lights garland ENB jumper should be off, as well IN3 IN4 OUT3 OUT4 are not used.

As well I have no any information how to plug IN1 and IN2 to Uno R3.

Thank you.

Wire pretending it's a normal motor, where polarity determines direction. CW is one polarity; CCW is the other.

ava18:
As well I have no any information how to plug IN1 and IN2 to Uno R3.

Connect each to a digital pin. Set the pins HIGH, LOW for one polarity, LOW, HIGH for the other and LOW, LOW for off.

Steve

slipstick:
Connect each to a digital pin. Set the pins HIGH, LOW for one polarity, LOW, HIGH for the other and LOW, LOW for off.

Is it possible to control rotation speed of the motor (LED brightness in my case)?

Yes - again just treat it as a motor and apply PWM to one of the pins.

To be a bit more specific take the ENA jumper off and connect one of the Arduino PWM pins to the ENA input.

Steve

"to the ENA input" - you mean IN1 IN2 pins or two pins became available removing ENA jumper?

(Sorry for lame questions).

Thank you.

I mean the one pin marked Enable A that is in line with the other IN1, IN2 pins etc.

It's about time to actually try something. Write some code and see what happens.

Steve

slipstick:
It's about time to actually try something. Write some code and see what happens.

I have plugged Uno R3 this way:

D3 to INA

D4 to IN1

D7 to IN2

D-GND to L298N GND

L298N jumpers:

INA is off

INB is set

REG is set

L298N is powered by +12V and GND, the built-in on-board LED is on.

Uno R3 is powered by USB, the built-in on-board LED is on.

Fairy lights garland is connected to OUT1 and OUT2, and all lights (odd and even) all the time are OFF.

After executing program below the built-in (pin 13) LED is flashing as expected. Nothing happens with the garland.

My questions:

Why the garland is off? Do you see any mistakes I have done or are there more details I can provide?

My code (compiled and uploaded to Uno R3 successfully):

#define LED LED_BUILTIN

#define PWM 3

#define IN1 4

#define IN2 7

void setup() {

pinMode(LED, OUTPUT);

pinMode(PWM, OUTPUT);

pinMode(IN1, OUTPUT);

pinMode(IN2, OUTPUT);

}

void loop() {

digitalWrite(IN1, LOW);

digitalWrite(IN2, HIGH);

digitalWrite(LED, HIGH);

delay(100);

for (int i = 0; i < 255; i++) {

analogWrite(PWM, i);

delay(5);

}

digitalWrite(IN1, HIGH);

digitalWrite(IN2, LOW);

digitalWrite(LED, LOW);

delay(100);

}

Thank you.

Is there any voltage on the L298N output?

wvmarle:
Is there any voltage on the L298N output?

Yes. I have tested with Digital Multimeter OUT1 and OUT2: voltage is jumping around +12V all the time but garland (both odd and even LEDs) is always off.

The Original PSU was using 0-35V.

If you have 12V on the input you won't have 12V on the output of that driver, it should be 3-4V less due to the losses in the driver.

That voltage may be too low to make the LEDs light up if the original used up to 35V. Are you sure those LEDs have the appropriate current limiting in place? Or was the original driver a constant current type?

If you have 12V on the input you won't have 12V on the output of that driver, it should be 3-4V less due to the losses in the driver.

It is hard tell the voltage because I am using digital multimeter. It is showing average voltage for a given period of time.

Video attached.

Or was the original driver a constant current type?

Picture attached.

Are you sure those LEDs have the appropriate current limiting in place?

You mean any kind of Current Fuse? I think no.

VID_20210320_050911.mpg (1.04 MB)

If you connect those LEDs straight to 12V, what happens? Do they light up?

If they're meant to be current driven that may kill them, though.

If you connect those LEDs straight to 12V, what happens? Do they light up?

No. Nothing happens. It may mean a dead LEDs, it may also mean that voltage is too low. Picture attached.

I tried to plug the Original driver - LEDs are working fine.

Considering they're supposed to run from a 35V supply I'd expect your 12V is simply not enough to make them work. You have to run them from a sufficiently high voltage - a 36V DC power supply should do in this case.

From the outside it's hard to say what's inside - considering there's AC output it could be just a transformer with no regulation whatsoever (if so it'll be quite heavy, as a transformer is basically a solid block of copper and iron). There's nothing to suggest it's regulated or current controlled in any way. 32V AC when loaded, 35V when unloaded is what the label suggests.

Makes sense for a string of LEDs, that voltage can easily do like 8-10 white LEDs in series with one or more current limiting resistors. Very cheap to make, and the 50 Hz (or 60 Hz) flicker most people won't notice especially when the LED phases are alternating.

Note: it could be that the LEDs are overdriven, as they will have less than 50% duty cycle (they're only on when the voltage is high enough, which is less than 50% of the time for each phase!). So running 36V 50% duty cycle is likely to make them shine brighter, even with the voltage losses in the L298N (check the datasheet on allowed voltage before applying 36V).

I am trying to understand how so small (7cm long) Original driver reach fade in/out effect of odd/even LEDs of my fairy lights. As far as I understand L298N is not the proper module for this purpose because it uses VDC manipulation. But measuring Original driver output with Multimeter - both VAC (in range 0V-30V) and A (in range 0.00 - 0.08) are jumping.

May be attached picture can give you any ideas?

One wire goes to the first LED. Afterwards two wires connect each LED. The last LED is connected with extra wire to the driver to close circuit. Each LED is 3cm long covered by plastic - there is enough space to hide i.e. Resistor underneath this cover.