Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Hardware
  3. [SOLVED] Blue pill (stm32f1) + VEML6075 UV sensor

[SOLVED] Blue pill (stm32f1) + VEML6075 UV sensor

Scheduled Pinned Locked Moved Hardware
10 Posts 2 Posters 1.7k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fedor
    wrote on last edited by Yveaux
    #1

    Hi

    Has anyone forced this pair to work?
    My VEML6075 board works well with Arduino but not with Blue pill.
    I tried both TwoWire and SoftWire, changing i2c freq, lowering pull up value (board has 10k resistors) etc
    Other sensors (like bosch weather sensors) works well.

    YveauxY 1 Reply Last reply
    0
    • F Fedor

      Hi

      Has anyone forced this pair to work?
      My VEML6075 board works well with Arduino but not with Blue pill.
      I tried both TwoWire and SoftWire, changing i2c freq, lowering pull up value (board has 10k resistors) etc
      Other sensors (like bosch weather sensors) works well.

      YveauxY Offline
      YveauxY Offline
      Yveaux
      Mod
      wrote on last edited by
      #2

      @fedor Which arduino library do you use to communicate to the VEML6075?
      Maybe the library just isn't compatible with STM32. You could try with some alternative libraries.

      http://yveaux.blogspot.nl

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Fedor
        wrote on last edited by Fedor
        #3

        @Yveaux
        I tried adafruit, sparkfun, schizobovine, Kris Winer libraries
        Then I tried to work without library - the sensor is very simple, just several i2c commands

        uint8_t msb = 0;
        uint8_t lsb = 0;

        Wire.beginTransmission( (uint8_t)VEML6075_ADDR);
        Wire.write((uint8_t)reg);
        Wire.endTransmission(false);

        Wire.requestFrom((uint8_t)VEML6075_ADDR, (byte)2);
        lsb = Wire.read();
        msb = Wire.read();

        To get device ID
        But nothing works

        YveauxY 1 Reply Last reply
        0
        • F Fedor

          @Yveaux
          I tried adafruit, sparkfun, schizobovine, Kris Winer libraries
          Then I tried to work without library - the sensor is very simple, just several i2c commands

          uint8_t msb = 0;
          uint8_t lsb = 0;

          Wire.beginTransmission( (uint8_t)VEML6075_ADDR);
          Wire.write((uint8_t)reg);
          Wire.endTransmission(false);

          Wire.requestFrom((uint8_t)VEML6075_ADDR, (byte)2);
          lsb = Wire.read();
          msb = Wire.read();

          To get device ID
          But nothing works

          YveauxY Offline
          YveauxY Offline
          Yveaux
          Mod
          wrote on last edited by
          #4

          @fedor If you have an oscilloscope or logic analyzer you could connect that to see what's going on.
          Unfortunately I don't have any VEML6075 so I'm not able to replicate your setup.

          Are you sure you have the right i2c address btw (might be configurable on your breakout board)? Try performing an i2c scan...

          http://yveaux.blogspot.nl

          F 1 Reply Last reply
          0
          • YveauxY Yveaux

            @fedor If you have an oscilloscope or logic analyzer you could connect that to see what's going on.
            Unfortunately I don't have any VEML6075 so I'm not able to replicate your setup.

            Are you sure you have the right i2c address btw (might be configurable on your breakout board)? Try performing an i2c scan...

            F Offline
            F Offline
            Fedor
            wrote on last edited by Fedor
            #5

            @yveaux
            surprisingly but the sensor detected during i2c scan with correct address 0x10
            I tried to explore dataflow using dso138 but this device is very simple, trigger works even at 50 us, clock looks like sine wave, but I see that some "1" on SDA are less that 3.3 volts, about 2 volts. Can this be a problem? However BMP280 sensor has the same but works well.
            I tried 3.3v arduino and it works too. Resistance between sensor boards SCL/SDA and VIN is 10K just like BMP280

            YveauxY 1 Reply Last reply
            0
            • F Fedor

              @yveaux
              surprisingly but the sensor detected during i2c scan with correct address 0x10
              I tried to explore dataflow using dso138 but this device is very simple, trigger works even at 50 us, clock looks like sine wave, but I see that some "1" on SDA are less that 3.3 volts, about 2 volts. Can this be a problem? However BMP280 sensor has the same but works well.
              I tried 3.3v arduino and it works too. Resistance between sensor boards SCL/SDA and VIN is 10K just like BMP280

              YveauxY Offline
              YveauxY Offline
              Yveaux
              Mod
              wrote on last edited by
              #6

              @fedor said in Blue pill (stm32f1) + VEML6075 UV sensor:

              Can this be a problem?

              I'm not sure if you can really trust the readings of this 'oscilloscope'. You can try slowing down the i2c clock to make it visible.
              The 10k pullup is rather high IMO for a 3v3 system, I'd rather try 4k7 or even lower. But you say you already tried lowering the pullups.

              http://yveaux.blogspot.nl

              F 1 Reply Last reply
              0
              • YveauxY Yveaux

                @fedor said in Blue pill (stm32f1) + VEML6075 UV sensor:

                Can this be a problem?

                I'm not sure if you can really trust the readings of this 'oscilloscope'. You can try slowing down the i2c clock to make it visible.
                The 10k pullup is rather high IMO for a 3v3 system, I'd rather try 4k7 or even lower. But you say you already tried lowering the pullups.

                F Offline
                F Offline
                Fedor
                wrote on last edited by Fedor
                #7

                @yveaux said in Blue pill (stm32f1) + VEML6075 UV sensor:

                Can this be a problem?

                I'm not sure if you can really trust the readings of this 'oscilloscope'.

                I agree :)

                You can try slowing down the i2c clock to make it visible.

                100Khz is already minimum in blue pill Wire :(

                The 10k pullup is rather high IMO for a 3v3 system, I'd rather try 4k7 or even lower. But you >say you already tried lowering the pullups.

                but 10k works well in arduino 3.3v, arduino 5v with level converter to 3.3v. 10k BMP280 works with stm32 :(
                I ordered esp8266, it looks like someone is using VEML6075 with it

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  Fedor
                  wrote on last edited by
                  #8

                  OK I finally managed it
                  The sensor requires i2c repeated start
                  But both Roger Clarks and official STM core for Blue Pill TwoWire libs don't support it.
                  Wire.endTransmission( bool stop ) where stop is just a stub and not processed
                  but SoftWire handles it
                  so just few changed to any lib (SparkFun/Adafruit/etc) like:

                  #ifdef ARDUINO_ARCH_STM32F1
                  #include "SoftWire.h"
                  #else
                  #include "Wire.h"
                  #endif

                  and
                  SoftWire SWire(PA1,PA2,SOFT_STANDARD);
                  #define Wire SWire

                  solves the problem
                  I hope this is useful to someone

                  YveauxY 1 Reply Last reply
                  0
                  • F Fedor

                    OK I finally managed it
                    The sensor requires i2c repeated start
                    But both Roger Clarks and official STM core for Blue Pill TwoWire libs don't support it.
                    Wire.endTransmission( bool stop ) where stop is just a stub and not processed
                    but SoftWire handles it
                    so just few changed to any lib (SparkFun/Adafruit/etc) like:

                    #ifdef ARDUINO_ARCH_STM32F1
                    #include "SoftWire.h"
                    #else
                    #include "Wire.h"
                    #endif

                    and
                    SoftWire SWire(PA1,PA2,SOFT_STANDARD);
                    #define Wire SWire

                    solves the problem
                    I hope this is useful to someone

                    YveauxY Offline
                    YveauxY Offline
                    Yveaux
                    Mod
                    wrote on last edited by
                    #9

                    @fedor good to hear you got it working!
                    What I don't understand is that in your original post you mention you already tried softspi and failed, so what's different now?

                    http://yveaux.blogspot.nl

                    F 1 Reply Last reply
                    0
                    • YveauxY Yveaux

                      @fedor good to hear you got it working!
                      What I don't understand is that in your original post you mention you already tried softspi and failed, so what's different now?

                      F Offline
                      F Offline
                      Fedor
                      wrote on last edited by
                      #10

                      @yveaux
                      I tried to use SoftWire in sketch without any libs and missed repeated start.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      28

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.1k

                      Posts


                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular