Openhab 3 + D1mini/ESP8266 + L298N motor controller + 12v linear actuator

Hello All,
Does anyone have experience in connecting and controlling a 12v linear actuator through openhab?
From research I got a L298N motor controller and a ESP8266 module flashed with tasmota-lite. From many posts, I found that the ESP8266 (or D1mini) with tasmota or ESPhome need to be added to Openhab, ESP8266 connected to L298N (cannot find the GPIO pin configuration required on the net), and a 12v DC power supply powering the L298N which itself can power the ESP8266/D1mini. Then from openhab can turn +/- the ESP8266 which will then send +/- signal to the L298N which will send the current to the actuator and reverse the polarity as required.

I’m using many ESP8266 with openhab. I use MQTT Homie and on ESP GitHub - homieiot/homie-esp8266: 💡 ESP8266 framework for Homie, a lightweight MQTT convention for the IoT

This not answer all your questions but a part of it.

What Linear actuator are you using?

Do you need to change the speed of the actuator?

Have you already got your components or are you researching?

More than one way to do it.

No requirement on speed, just open to full length and retract to full length should be good, if possible expand to half length could be useful also for a window

Yes I have the L298N and ESP8266 board (from some more research yesterday it seems I need the D1mini itself instead because the L298N can supply 5v only while my current ESP8266 is on 3.3v. I will order a D1mini but I think the concept should be same (pin connections)

1 Like

Ok cool

So your esp8266 or d1 mini will output 3.3v and the L298N only needs 2.3v min to be high so it should work.

Your linear actuator has built in limit switches so no need to worry about overdriving.

Now for the programming I would set it up like a blind.

1 Like

Okay thank you, so that would be 1 shutter config similar to this one from the guide:

That is control for a specific type of blind. It will not work for you I don’t think.

What signals are you going to be using to connect your board to your driver?

So assume you will be powering from 12v source between VCC and GND.
Connect your 5v and GND to D1mini 5v and GND
Connect your Linear actuator up to OUT1 and OUT2. Polarity dose not matter either way will do

Now you need to connect IN1 and IN2 to outputs from D1Mini.

Connect IN1 to D1
Connect IN2 to D2

Then set it up like

You can ignore using it as a shutter for now and just get it working.
Once you can get it working from the tasmota web interface then look at MQTT

1 Like

It works!
The buttons on the tasmota interface are opening and closing only by a couple of inches though, I guess it’s something to resolve in the configuration?
Here is what i have and working now:
Ran SetOption80 1, ShutterMode 1
Did not run this one - do I just measure the time taken by trial and error for a complete open/close?
ShutterOpenDuration 2 // Shutter opening time = 2 seconds
ShutterCloseDuration 2 // Shutter closing time = 2 seconds
Tasmota interface:

I was able to get it to fully open and close - the duration is 43 seconds. The slider on tasmota interface when set to half also seems to work.

12:15:44.027 MQT: tele/tasmota-FD561D/LWT = Online (retained)
12:15:44.029 MQT: cmnd/tasmota-FD561D/POWER = 
12:15:44.064 MQT: stat/tasmota-FD561D/RESULT = {"POWER1":"OFF"}
12:15:44.070 MQT: stat/tasmota-FD561D/POWER1 = OFF
12:15:44.074 MQT: stat/tasmota-FD561D/RESULT = {"POWER2":"OFF"}
12:15:44.080 MQT: stat/tasmota-FD561D/POWER2 = OFF

12:17:48.652 CMD: ShutterOpen
12:17:48.663 MQT: stat/tasmota-FD561D/RESULT = {"POWER1":"ON"}
12:17:48.666 MQT: stat/tasmota-FD561D/POWER1 = ON
12:17:48.669 MQT: stat/tasmota-FD561D/RESULT = {"ShutterOpen1":100}

Now it’s like this: (not sure how the second slider has appeared :thinking:)

On another note, on OH3, how is the recommended configuration for this setup - through RollerShutter channel type? I see the commands and STAT is not POWER but POWER1 and POWER2, but in its configuration there is only 1 state topic, Up and Down values

State can only have one position at a time, but device may report on multiple topics.
Each channel may only subscribe to one topic, but you create multiple channels.
Multiple channels may be linked to a single Item.

After lots of trials, the below seems to work, even the steps of 20% from 0 to 100 from the mobile app, and the rollershutter item (up/stop/down)
Not sure where the problem was, I configured the rollershutter channel multiple times with same values but seemed to work only after adding some multiple channels.

UID: mqtt:topic:398e2a4556:524a13e68d
label: ShutterRelayWindow 01 D1 L298N
thingTypeUID: mqtt:topic
  payloadNotAvailable: Offline
  availabilityTopic: tele/tasmota-FD561D/LWT
  payloadAvailable: Online
bridgeUID: mqtt:broker:398e2a4556
  - id: ShutterUp
    channelTypeUID: mqtt:switch
    label: ShutterUp
    description: ""
      stateTopic: stat/tasmota-FD561D/POWER1
  - id: ShutterDown
    channelTypeUID: mqtt:switch
    label: ShutterDown
    description: ""
      stateTopic: stat/tasmota-FD561D/POWER2
  - id: Position
    channelTypeUID: mqtt:number
    label: Position
    description: ""
      stateTopic: stat/tasmota-FD561D/SHUTTER1
  - id: RollerShutter
    channelTypeUID: mqtt:rollershutter
    label: RollerShutter
    description: ""
      commandTopic: cmnd/tasmota-FD561D/ShutterPosition1
      stateTopic: stat/tasmota-FD561D/SHUTTER1
      off: "100"
      on: "0"

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.