Raspberry Pi UV sensor VEML6070 ESP32 DevKit V1 - Sensor Data wrong

Hello,
I was searching for the problem I have, but I haven’t found the detailed solutions especially for my problem. I hope you can help me.

First my tools:

  • Adafruit VEML6070 UV sensor (Adafruit VEML6070 UV Index Sensor Breakout)
  • Espressif ESP32 DevKit Board V1 (Wifi / Bluetooth)
  • Breadboard
  • MQTT.fx 1.7.1 (Windows)
  • Arduino 1.8.8 (Windows)
  • Mosquitto Broker
  • Raspberry Pi 3 Model B+ (Raspian)

First I installed the Broker on the Raspberry and tested the connection, to publish and to suscribe something with MQTT.fx and everything worked. Then I created the client on the ESP32 with the UV-sensor, programmed with the Arduino IDE. In the IDE I choosed under Tools the Board: ESP32 Dev Module and the Port COM3 (I also tested it with my Macbook Pro 2017 and the Port dev/cu.SLAB_USBtoUART).

I have done the WifiScan (code). → It worked.
That the ESP32 is available as MQTT Client I installed the PubSubClient library and created the client test (code). → Connecting to Wifi and to MQTT was successfull
Afterwards I connected the Pins. VIN Pin of the sensor to 3V3 of ESP32, G to GND, SCL with D22 (GPIO22) and SDA with D21 (GPIO21) (see attachement ESP32 DEVKIT V1). Everything worked
After the vemltest (code) everytime I get the following data on the serial monitor:
UV light level: 65535
UV light level: 65535
UV light level: 65535

First it is not right and second the light level never changes.

Can you please help me, I tried a lot of things but I find no solution.
Thank you very much.

/*
 *  This sketch demonstrates how to scan WiFi networks.
 *  The API is almost the same as with the WiFi Shield library,
 *  the most obvious difference being the different file you need to include:
 */
#include "WiFi.h"

void setup()
{
    Serial.begin(115200);

    // Set WiFi to station mode and disconnect from an AP if it was previously connected
    WiFi.mode(WIFI_STA);
    WiFi.disconnect();
    delay(100);

    Serial.println("Setup done");
}

void loop()
{
    Serial.println("scan start");

    // WiFi.scanNetworks will return the number of networks found
    int n = WiFi.scanNetworks();
    Serial.println("scan done");
    if (n == 0) {
        Serial.println("no networks found");
    } else {
        Serial.print(n);
        Serial.println(" networks found");
        for (int i = 0; i < n; ++i) {
            // Print SSID and RSSI for each network found
            Serial.print(i + 1);
            Serial.print(": ");
            Serial.print(WiFi.SSID(i));
            Serial.print(" (");
            Serial.print(WiFi.RSSI(i));
            Serial.print(")");
            Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*");
            delay(10);
        }
    }
    Serial.println("");

    // Wait a bit before scanning again
    delay(5000);
}
/*
* client_test
*/
#include <WiFi.h>
#include <PubSubClient.h>
const char* ssid = "iPhone von Jan";
const char* password = "12345678";
const char* mqttServer = "172.20.10.5";
const int mqttPort = 1883;
const char* mqttUser = "user1";
const char* mqttPassword = "smarthome";
WiFiClient espClient;
PubSubClient client(espClient);
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.println("Connecting to WiFi..");
}
Serial.println("Connected to the WiFi network");
client.setServer(mqttServer, mqttPort);
while (!client.connected()) {
Serial.println("Connecting to MQTT...");
if (client.connect("ESP32Client", mqttUser, mqttPassword )) {
Serial.println("connected");
} else {
Serial.print("failed with state ");
Serial.print(client.state());
delay(2000);
}
}
client.publish("esp/test", "Hello from ESP32");
}
void loop() {
client.loop();
}
#include <Wire.h>
#include "Adafruit_VEML6070.h"

Adafruit_VEML6070 uv = Adafruit_VEML6070();

void setup() {
  Serial.begin(9600);
  Serial.println("VEML6070 Test");
  uv.begin(VEML6070_1_T);  // pass in the integration time constant
}


void loop() {
  Serial.print("UV light level: "); Serial.println(uv.readUV());
  
  delay(1000);
}