eTape sensor damaged?

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
andyshinn
 
Posts: 3
Joined: Tue Jul 13, 2021 9:06 pm

eTape sensor damaged?

Post by andyshinn »

I am building a project using the 12" eTape. I am currently bench testing it using a ESP32-S2 Feather, OLED scree, and relay wing. I have wired it to pin T8 of the ESP32-S2 using the included 560Ohm resistor as a divider.

Any little movement of the tape, even me just pushing on the wires a bit, makes the values jump around. See video example at https://www.youtube.com/watch?v=HTOZO6uWa9g.

I attached the schematic and layout I have attached the sensor. Below is the configuration I am using in ESPHome:

Code: Select all

external_components:
  - source:
      type: local
      path: esphome-components/components

wifi:
  ssid: MySSID
  password: !secret wifi_password

ota:
  password: !secret wifi_password

esphome:
  name: bucket
  comment: Bucket
  on_boot:
    priority: 600
    then:
      - light.turn_on:
          id: status_pixel
          red: 0%
          green: 100%
          blue: 0%
          brightness: 50%
          color_mode: RGB
      - script.execute: screen_timeout

web_server:
  port: 80

esp32:
  board: featheresp32-s2

i2c:
  sda: SDA
  scl: SCL

substitutions:
  relay_pin: T10
  button_a_pin: T9
  button_b_pin: GPIO6
  button_c_pin: T5
  status_led_pin: T13
  status_pixel_pin: GPIO33
  etape_pin: T8

status_led:
  pin:
    number: $status_led_pin
    inverted: false

output:
  - platform: gpio
    pin: $relay_pin
    id: relay_output

switch:
  - platform: output
    id: relay_switch
    name: "Relay Output"
    output: relay_output
    on_turn_on:
      then:
        - light.turn_on:
            id: status_pixel
            red: 0%
            green: 100%
            blue: 0%
            color_mode: RGB
            effect: "Strobe"
    on_turn_off:
      then:
        - light.turn_on:
            id: status_pixel
            red: 0%
            green: 100%
            blue: 0%
            color_mode: RGB
            effect: "None"
  - platform: template
    id: keep_screen_on_switch
    name: "Keep Screen On"
    optimistic: true
    restore_state: true
    on_turn_on:
      then:
        - lambda: |-
            id(oled).turn_on();
    on_turn_off:
      then:
        - script.execute: screen_timeout

light:
  - platform: neopixelbus
    type: GRB
    variant: WS2812
    pin: $status_pixel_pin
    num_leds: 1
    name: "Status Pixel"
    id: status_pixel
    effects:
      - strobe:
          name: "Strobe"
          colors:
            - brightness: 50%
              red: 50%
              green: 0%
              blue: 50%
              duration: 500ms
            - brightness: 0%
              red: 50%
              green: 0%
              blue: 50%
              duration: 250ms

font:
  - file:
      type: gfonts
      family: Roboto
    id: roboto
    size: 16
  - file: "fonts/tahoma.ttf"
    id: tahoma

display:
  - platform: sh1107_i2c
    model: "SH1107 64X128"
    address: 0x3C
    rotation: 90
    id: oled
    lambda: |-
      it.printf(0, 0, id(tahoma), TextAlign::TOP_LEFT, "Level: %.0f%%", id(etape_level).state);
      it.printf(0, 20, id(tahoma), TextAlign::TOP_LEFT, "Res: %f", id(etape_resistance).state);
      it.printf(0, 40, id(tahoma), TextAlign::TOP_LEFT, "Pump: %s", id(relay_switch).state ? "On" : "Off");

binary_sensor:
  - platform: gpio
    id: button_b
    pin:
      number: $button_b_pin
      inverted: true
      mode:
        input: true
        pullup: true
    on_press:
      then:
        - lambda: |-
            id(oled).turn_on();
        - script.execute: screen_timeout
  - platform: gpio
    id: button_a
    pin:
      number: $button_a_pin
      inverted: true
      mode:
        input: true
        pullup: true
    on_press:
      then:
        - switch.toggle: relay_switch
        - script.execute: screen_timeout

script:
  - id: screen_timeout
    mode: restart
    then:
      - if:
          condition:
            switch.is_off: keep_screen_on_switch
          then:
            - delay: 10s
            - lambda: |-
                id(oled).turn_off();

sensor:
  - platform: resistance
    sensor: etape_source
    configuration: DOWNSTREAM
    resistor: 560Ohm
    name: eTape Reading
    id: etape_resistance

  - platform: adc
    id: etape_source
    pin: $etape_pin
    update_interval: 1s
    attenuation: auto

  - platform: template
    name: "eTape Level"
    id: etape_level
    lambda: |-
      const float etape_min = 1850.0;
      const float etape_max = 400.0;
      const float etape_range = etape_max - etape_min;
      const float etape_percent = (id(etape_resistance).state - etape_min) / etape_range;
      if (etape_percent > 1.0) return 100.0;
      if (etape_percent < 0.0) return 0.0;
      return etape_percent * 100.0;
    unit_of_measurement: "%"
    accuracy_decimals: 1
    update_interval: 1s

logger:
  level: DEBUG
I am using the custom OLED component from https://github.com/jenscski/esphome-components

Is this normal or is the sensor damaged?
Attachments
schematic.png
schematic.png (52.98 KiB) Viewed 117 times
board.png
board.png (288.1 KiB) Viewed 117 times

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: eTape sensor damaged?

Post by mikeysklar »

These are quite sensitive which is typical of sensors going through an ADC. Normally you would want to buffer values and average them out. eg. Read 100 samples and take an average rather than print every value change.

Which model of eTape (Ada product ID#) do you have?

User avatar
andyshinn
 
Posts: 3
Joined: Tue Jul 13, 2021 9:06 pm

Re: eTape sensor damaged?

Post by andyshinn »

mikeysklar wrote: Sat Mar 18, 2023 7:44 pm These are quite sensitive which is typical of sensors going through an ADC. Normally you would want to buffer values and average them out. eg. Read 100 samples and take an average rather than print every value change.

Which model of eTape (Ada product ID#) do you have?
It is https://www.adafruit.com/product/464

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: eTape sensor damaged?

Post by mikeysklar »

Thank you for the product link.

Were you able to start averaging values as the thermistor guide suggests?

User avatar
andyshinn
 
Posts: 3
Joined: Tue Jul 13, 2021 9:06 pm

Re: eTape sensor damaged?

Post by andyshinn »

I tried doing some averaging, but the values really don’t ever change in some cases. I got some PVC pipe to put the sensor in. Here’s another video where the sensor is about a street is I can get it and it isn’t moving yet it’s still just reads 100% even when I move it up and down.

https://youtube.com/shorts/9pAKyODWYX8

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: eTape sensor damaged?

Post by mikeysklar »

Thank you for the video.

Since the sensor continues to read high there could be an issue with how you have connected the sensor to the ADC.

While I can see you are using a Feather tripler setup I cannot verify the wiring / resistor (560ohm) to the ADC pin. Can you describe or show that? Can you post the code you are running in code tags?

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”