Filament-Dryer: NormallyOpen Relay Problem via with an ESP8266

Hello Everybody,

Actually I’m trying to build an ESPHome based (3D-Printer) Filament-Dryer including a scale to predict the amount of filament left inside. By now I successfully connected the sensors: the HX711 and a HTU21D.

I really would be happy to upload this (later hopefully successful) project here.

My problem is: I can not successfully connect this 5V Relais Module to this NodeMCU V3 ESP8266 (12F) via this TXS0108E Logic Level Converter: it’s control-LEDs do not light up at all (neither when switch PIN is activated or it is not).

In my following code I already tried with and without out commented inverted mode:

substitutions:
  devicename: "filadryer_2"
  friendly_name: "KE Filament Dryer 2"

esphome:
  name: "${name}"
  friendly_name: "${friendly_name}"

esp8266:
  board: nodemcuv2

wifi:
  ssid: 
  password: 
  power_save_mode: none
  reboot_timeout: 0s

web_server:
  port: 80

logger:
  level: DEBUG

api:

ota:

mdns:
  disabled: false

i2c:
  - id: klima
    sda: D2
    scl: D1
    scan: true

switch:
  - platform: gpio
    pin: D5
    name: 'Obere Heizschale'
    id: heizschale_oben
#   inverted: true

  - platform: gpio
    pin: D6
    name: 'Untere Heizschale'
    id: heizschale_unten
#   inverted: true

  - platform: template
    name: 'Heizung'
    icon: "mdi:hair-dryer"
    id: heizung    
    turn_on_action:
      - switch.turn_on: heizschale_oben
      - switch.turn_on: heizschale_unten

    turn_off_action:
      - if:
          condition:
            - switch.is_on: heizung
          then:
            - switch.turn_off: heizschale_oben
            - switch.turn_off: heizschale_unten
    optimistic: true
    assumed_state: true

sensor:
  - platform: htu21d
    i2c_id: klima
    temperature:
      name: "Filament Dryer 2 Temperatur"
    humidity:
      name: "Filament Dryer 2 Luftfeuchtigkeit"
    update_interval: 60s

  - platform: hx711
    name: "Filament Dryer 2 Masse"
    id: masse   
    dout_pin: D3
    clk_pin: D4
    gain: 128
    filters:
      - calibrate_linear:
          - 484000 -> 0
          - 611000 -> 275
    update_interval: 60s
    unit_of_measurement: g
    accuracy_decimals: 0

As far as I found out D5 and D6 are some of the rare control PINs that can be used for relays: so they are not HIGH or LOW upon boot.

The relays VCC and JD-VCC are connected (via jumper) and VCC is connected to 5V supply that of course is also connected to the LogicLevel converters HV-VC-PIN.

I already re-soldered the LogicLevel converter, replaced it and also tried to replace the NodeMCU. And - of course - controlled every intended voltage amount everywhere in every situation (D5 and/or D6 turned on/off).

As far as I have come too, now I am really desperate, so any help and suggestions would really be appreciated…

:sob:

I have these relays connected to esp without any level converter - they run quite fine on 3.3V input signal.
But, did you check with voltmeter if D5 and D6 give 3.3V output when active?

Yes they do: in normal mode the give about 3,28V when activated and in inverted mode when deactivated. So they absolutely behave as they should as far as I can see…

Then try without level converter. Before that you can test your relay board if it works by shorting 5V (or GND if you have negative logic) and input to see if it toggles.

EDIT: i see that your relay board has indeed negative logic, so it must toggle when input connected to GND.

“…so it must toggle when input connected to GND.”

I am really a noob in electrics: could you please explain that to me?

Sure:
for your relay board it says “low level trigger”, which means that relay is energized when input on that relay board is “low level”, that is 0V, or tied to GND. When input is at 5V (or 3.3V) then relay is OFF (de-energized). So, when you have relay board on 5V connected, then just connect “input” to “GND” and relay should toggle.

So in ESP your output must be inverted in order for relay to work correctly.

Okay then, thank you very much for your explanation! As mentioned above I already tried this:

switch:
  - platform: gpio
    pin: D5
    name: 'Obere Heizschale'
    id: heizschale_oben
    inverted: true

So now, I should try this again without the Logic Level converter connected in-between, right?

1 Like

Correct. Try without it and see if it works.

INCREDIBLE!!! It works!
THANK YOU!!

:partying_face:

Obviously I got a whole batch of defect Logic-Level-Shifters! Since I had already replaced and re-soldered the level logic shifter twice, I would never have guessed that they were all broken.

What a waste of time: 12 hours of trying around …

:face_with_symbols_over_mouth:

1 Like

Well, i guess it can happen…although i’d think that amazon is somewhat more reliable supplier…
It happened to me that i’ve got 50pcs of mosfets defected. But they were from aliexpress…

Main think is that it works! Great job.

Hey there,

nearly ready already designing the 3D-printed case :slight_smile:

I had the idea to connect some LEDs and a fan. They both work on 3.3V when connecting to 3.3V and GND pins. But I am note sure how to directly (without any relay) connect them to nodeMCUs PINS and how to control them via ESPhome… platform: gpio does only move the fan some millimeters when turned on or off…

Any ideas?

Gpio pin doesn’t have even nearly output enough current to drive a fan. You’ll have to connect it via transistor, or better via (logic level) mosfet, if you don’t want to use a relay. If you search on google for words” gpio with mosfet” you’ll find some details.

Nice job and idea :slight_smile:
I’ld also like to have a DIY esphome based dryer. Did you publish the results/plans somewhere, do you mind sharing? the scale is a nice addition, is it usable/accurate enough?