L298n Motor Driver to control room vent


I would like to open a room vent when temperature is above 23 degres C and close when below 15 degrees. I have the vent which is a large window in a greenhouse connected to a Linear Actuator. Can I use an L298n motor driver and change it’s direction based on a temperature input? Or is this just for Pumps that only run in one direction all the time?


1 Like

Whether you can use it will depend on the motor. The driver can operate DC motors in either direction, but the voltage and max current must not exceed the limits of the driver.

Hi Kyle,

The hardware is working ok, I have the motor working on Mycodo but in just the direction set on the L298N output page.

How would I change the motor direction based on a temperature reading input?

I was hoping to open the window with temps above 22 celcius and close below 12.


I haven’t experimented much with direction, but you should be able to create two outputs, one for each direction, then use either output depending on the direction you want to rotate. You may also be able to rotate in the opposite direction that is set by the output by passing a negative value to the output, but I am not looking at the code and may be mistaken about that functionality.

Thanks, I didn’t think I could duplicate pin numbers but creating two outputs works a treat.

1 Like