Using FastLED & Onewire-Bus on same pin

Hello fellow community!

I'm working on a new project for the light of my father in laws sauna. The LEDs should be controlled by the measured value of a temperature sensor. The only Problem is, that I only have three cables available for the connection between Arduino and Sensor/LEDs.

Therefore I'm trying to set the communication for both devices on one pin. But unfortunately when I do this, only the first LED lights up white and I get the temperature sensors measurement.

Here my code, currently without any temperature control:

// Include the libraries we need
#include <OneWire.h>
#include <DallasTemperature.h>
#include <FastLED.h>

#define DATA_PIN     5
#define NUM_LEDS    60
#define BRIGHTNESS  32
#define LED_TYPE    WS2811
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];

#define UPDATES_PER_SECOND 100

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(DATA_PIN);

// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);

// arrays to hold device address
DeviceAddress insideThermometer;

float tempC;

// function to print the temperature for a device
void printTemperature(DeviceAddress deviceAddress)
{
  tempC = sensors.getTempC(deviceAddress);
  Serial.print("Temp C: ");
  Serial.println(tempC); // Converts tempC to Fahrenheit
}

void setup() {
    delay( 3000 ); // power-up safety delay

    // LED setup
    FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
    FastLED.setBrightness(  BRIGHTNESS );
    

    // Temperature setup
  // start serial port
  Serial.begin(9600);
  Serial.println("Dallas Temperature IC Control Library Demo");

  // locate devices on the bus
  Serial.print("Locating devices...");
  sensors.begin();
  Serial.print("Found ");
  Serial.print(sensors.getDeviceCount(), DEC);
  Serial.println(" devices.");
  if (!sensors.getAddress(insideThermometer, 0)) Serial.println("Unable to find address for Device 0"); 


  // set the resolution to 9 bit (Each Dallas/Maxim device is capable of several different resolutions)
  sensors.setResolution(insideThermometer, 9);
 
  Serial.print("Device 0 Resolution: ");
  Serial.print(sensors.getResolution(insideThermometer), DEC); 
  Serial.println();

}

void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds[i].nscale8(250); } }

void loop() {
  Serial.print("Requesting temperatures...");
  sensors.requestTemperatures(); // Send the command to get temperatures
  Serial.println("DONE");
  delay(1000);
  printTemperature(insideThermometer);

  static uint8_t hue = 0;
  Serial.print("x");
  // First slide the led in one direction
  for(int i = 0; i < NUM_LEDS; i++) {
    // Set the i'th led to red 
    leds[i] = CHSV(hue++, 255, 255);
    // Show the leds
    FastLED.show(); 
    // now that we've shown the leds, reset the i'th led to black
    // leds[i] = CRGB::Black;
    fadeall();
    // Wait a little bit before we loop around and do it again
    delay(10);
  }
  Serial.print("x");

  // Now go in the other direction.  
  for(int i = (NUM_LEDS)-1; i >= 0; i--) {
    // Set the i'th led to red 
    leds[i] = CHSV(hue++, 255, 255);
    // Show the leds
    FastLED.show();
    // now that we've shown the leds, reset the i'th led to black
    // leds[i] = CRGB::Black;
    fadeall();
    // Wait a little bit before we loop around and do it again
    delay(10);
  }

}

I hope you can help me surpass this problem.

Thanks!

why can't you add more wires? you would need a way to switch the connector at the end which would require a command signal... which is one extra cable... catch22

The issue is, that the sauna is already assembled and therefore i can't change the routed cables.

The other option is, that I place the Arduino Nano directly in the sauna in the light. But I fear that it won't take the heat...

The heat might not be an issue - more the humidity

Okay, than I will try this. The temperature sensor is waterproof and the LED enclosed in Silicon (IP-something). Then I will cover the Arduino Nano in hot glue, this should work, right?

I'm more worried about the safety of the installation. Where are the LEDs going to be?

Your WS2811 requires quite a bit of current. The IP protection of those strips is usually against humidity and dust at best. You should be 10000% careful having high current next to the water.