Using Arduino sensors with an STM32Does my open source project need be Arduino based to be successful?Bit bang ATmega328 with Arduino bootloader using AVRDUDEAdvantages of 32-bit 48-96 Mhz microprocessors (such as in Arduino Due)Selecting an Arduino for automotive DashboardHow to connect RFduino to internet?A good MCU which supports Arduino library but is not as expensiveHow do MCUs and RAM wire up for programmatic access?Measure current of multiple loads with one sensor?Microcontrollers and SensorsSTM32F103C8T6 dev board with C and debugging

ed command: Delete from line 1 until the first blank line

Why we don’t make use of the t-distribution for constructing a confidence interval for a proportion?

How can I get an unreasonable manager to approve time off?

What to do when surprise and a high initiative roll conflict with the narrative?

Can the concepts of abstract algebra be visualized as in analysis?

Check if three arrays contains the same element

Are there any important biographies of nobodies?

CSV how to trim values to 2 places in multiple columns using UNIX

Why are trash cans referred to as "zafacón" in Puerto Rico?

Why can I traceroute to this IP address, but not ping?

Has there been a multiethnic Star Trek character?

Warning about needing "authorization" when booking ticket

Does the Long March-11 increase its thrust after clearing the launch tower?

With Ubuntu 18.04, how can I have a hot corner that locks the computer?

Who are the Missing Members of this Noble Family?

What is the maximum number of net attacks that one can make in a round?

Missing delay in heavyside step function

Is it possible to have a wealthy country without a middle class?

How can I end combat quickly when the outcome is inevitable?

How to use memset in c++?

How to communicate to my GM that not being allowed to use stealth isn't fun for me?

Someone whose aspirations exceed abilities or means

Who won a Game of Bar Dice?

Wooden cooking layout



Using Arduino sensors with an STM32


Does my open source project need be Arduino based to be successful?Bit bang ATmega328 with Arduino bootloader using AVRDUDEAdvantages of 32-bit 48-96 Mhz microprocessors (such as in Arduino Due)Selecting an Arduino for automotive DashboardHow to connect RFduino to internet?A good MCU which supports Arduino library but is not as expensiveHow do MCUs and RAM wire up for programmatic access?Measure current of multiple loads with one sensor?Microcontrollers and SensorsSTM32F103C8T6 dev board with C and debugging






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3












$begingroup$


I want to start an electronic project, and found that an ARM based MCU, like STM32F103C, fits my needs more than AVR like Arduino Uno (mostly because of CPU and RAM.)



I was wondering if I can use any Arduino sensor with my STM32 board?



Looking a list of the sensors related to STM32, they seem much more expensive.










share|improve this question











$endgroup$


















    3












    $begingroup$


    I want to start an electronic project, and found that an ARM based MCU, like STM32F103C, fits my needs more than AVR like Arduino Uno (mostly because of CPU and RAM.)



    I was wondering if I can use any Arduino sensor with my STM32 board?



    Looking a list of the sensors related to STM32, they seem much more expensive.










    share|improve this question











    $endgroup$














      3












      3








      3





      $begingroup$


      I want to start an electronic project, and found that an ARM based MCU, like STM32F103C, fits my needs more than AVR like Arduino Uno (mostly because of CPU and RAM.)



      I was wondering if I can use any Arduino sensor with my STM32 board?



      Looking a list of the sensors related to STM32, they seem much more expensive.










      share|improve this question











      $endgroup$




      I want to start an electronic project, and found that an ARM based MCU, like STM32F103C, fits my needs more than AVR like Arduino Uno (mostly because of CPU and RAM.)



      I was wondering if I can use any Arduino sensor with my STM32 board?



      Looking a list of the sensors related to STM32, they seem much more expensive.







      arduino microcontroller sensor






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 23 at 13:51









      JRE

      26k64886




      26k64886










      asked May 23 at 9:45









      CreatorCreator

      162




      162




















          3 Answers
          3






          active

          oldest

          votes


















          3












          $begingroup$

          Yes, of course you can use those sensors. The sensors are not Arduino exclusive, just look up the datasheets to the parts and you should have no problem using them.



          To make it easier, you can get an STM32 Nucleo board, which has the same header pin configuration as an Arduino for quick and easy prototyping.






          share|improve this answer









          $endgroup$












          • $begingroup$
            Thanx for quick answer. I had in mind STM32F103C8T6 blue pill, because of low pricing and some protoboard for prototyping, but I got your point. So, bottom line is that sensors in the list I mentioned, matches smt32 gpio and can use all of them with stm32?
            $endgroup$
            – Creator
            May 23 at 10:17










          • $begingroup$
            Yes, it'll be fine. As long as you pay attention to where your leads are going. If doing I2C, hook up SDA and SCL on your sensor board to SDA and SCL on your STM32 board. The sensors will work on any microcontroller, the only reason those are sold as 'Arduino sensors' is because they will have a library in the Arduino IDE. This means ready made example code, but it isn't that difficult to translate most of it over to STM32
            $endgroup$
            – MCG
            May 23 at 10:29






          • 1




            $begingroup$
            Upvoted your answer too, and thanks for your comment, I will add it.
            $endgroup$
            – Michel Keijzers
            May 23 at 10:35






          • 1




            $begingroup$
            @MichelKeijzers no problem! It made sense to add it to your answer rather than mine!
            $endgroup$
            – MCG
            May 23 at 10:39


















          3












          $begingroup$

          As MCG already mentions, you can use in principle any sensor that also can be used by Arduino. The main issue is if you want to use libraries. For the Arduino, there are for almost any sensor a library available, for the STM32 this is much less the case. Writing a library can take quite some time (depending on the complexity of the sensor communication).



          The Nucleo board can help if the sensor is placed on a board that can be pushed on top of an Arduino; otherwise you need to use separate wires anyway.



          Another way that could be worthwhile checking, is STM32Arduino, which is a project to make some STM32's compatible with Arduino, and can be programmed like an Arduino, but not all libraries are compatible.
          See also MCG's comment below and check the following helpful starting point for STM32Duino: getting-started-with-stm32-development-board-stm32f103c8.



          In most cases, Arduino is the most easiest solution, mostly because of the existence of a large library support, however, the Arduino also has some big advantages: very less SRAM, mostly bigger in size than STM32 boards, no (easy) debugging, very less peripherals.



          Another problem with Arduino libraries (and probably STM32 libraries too), is to check if multiple (different) libraries work together; you get into problems when e.g. they use both the same timer.






          share|improve this answer











          $endgroup$








          • 1




            $begingroup$
            I was just about to edit my answer to mention the STM32/Arduino compatibility, but no need now you mention it here! In fact, there is a page on how to set up the exact same board OP is using to the Arduino IDE here:circuitdigest.com/microcontroller-projects/… which may be useful to add to your answer. +1 from me too for the mention of the Arduino compatibility!
            $endgroup$
            – MCG
            May 23 at 10:31











          • $begingroup$
            Thanx, I have already checked links you sent me before. So basically, library repos is small when it comes to SMT32. What about some another MCU sensor libraries, is it better support for ESP32 or NodeMCU (I saw they are both programmable via Arduino IDE and C language)? Or in general, what would be your suggestions guys, in the case that I need ARM based platform (obviously because of performance), which is programmable via Arduino IDE in C/C++ and which support larger library set for sensors?
            $endgroup$
            – Creator
            May 23 at 11:01










          • $begingroup$
            I added some more comments, you also could check Arduino Due, but also there not all Arduino libraries will work ... first make a list of possible models you can use (which meet your performance), than check on which of those platforms your needed libraries will work and make a decision based on those.
            $endgroup$
            – Michel Keijzers
            May 23 at 13:55


















          2












          $begingroup$

          May work for some, but definitely not for all.



          Notice that the Arduino operates at 5V supply and I/O voltages, while the STM32 uses 3.3V!



          While many of the STM32's I/O pins may be 5V-tolerant for input (see datasheet), they cannot output 5V signals which many Arduino-targeted sensor( board)s are built for.



          So,



          • best case: The sensor is ok with 3.3V signals at its inputs and sends 5V signals to 5V-tolerant pins on the µC.


          • good case: The sensor does not work (as expected) because the 3.3V signals are too low, but neither end takes any damage.


          • bad case: The sensor sends a 5V output signal to a non-5V-tolerant µC (input) pin and damages the µC and possibly the sensor by excessive current.


          Check and make sure that the sensor's inputs can operate with 3.3V signals, and that the µC's inputs can handle the (likely 5V) signals from the sensor.



          Some sensors can operate on a range of supply voltages, e.g. 3.3V~5V, so if you supply them with 3.3V they will work perfectly in a 3.3V system. And there are, of course, sensors which can only operate on 3.3V but not on 5V. For use with 5V Arduinos, these typically have some sort of level-shifting included on the board ("shield") they come mounted on. In these cases, even though the sensor could work on 3.3V, the board cannot.






          share|improve this answer











          $endgroup$












          • $begingroup$
            It looks like voltage should not be a problem at MCU input side, but seems like you are most likely right regarding input voltage for sensors, since most of them operate at ~5V (or they are most reliable at that voltage)
            $endgroup$
            – Creator
            May 23 at 11:27










          • $begingroup$
            cdn1.imggmi.com/uploads/2019/5/23/…
            $endgroup$
            – Creator
            May 23 at 11:40






          • 1




            $begingroup$
            @Creator "It looks like voltage should not be a problem at MCU input side" - How do you get to that conclusion? Depending on the STM MCU some or most I/O pins are 5V-tolerant, but you have to make sure to connect 5V signals only to those pins, or use some sort of level shifter (e.g. a voltage divider). Otherwise, irreversible damage will occur.
            $endgroup$
            – JimmyB
            May 23 at 13:17











          • $begingroup$
            @Creator Notice that we're talking about too low "high" signal levels from MCU to sensor (3.3V instead of 5V expected), but too high "high" signal levels from sensor to MCU (5V instead of maximum permissible 3.3V).
            $endgroup$
            – JimmyB
            May 23 at 13:24










          • $begingroup$
            I understand your voltage concerns. Thanx. anyway, I am going to do some testing after all.
            $endgroup$
            – Creator
            May 23 at 20:08











          Your Answer






          StackExchange.ifUsing("editor", function ()
          return StackExchange.using("schematics", function ()
          StackExchange.schematics.init();
          );
          , "cicuitlab");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "135"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f439961%2fusing-arduino-sensors-with-an-stm32%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          3 Answers
          3






          active

          oldest

          votes








          3 Answers
          3






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3












          $begingroup$

          Yes, of course you can use those sensors. The sensors are not Arduino exclusive, just look up the datasheets to the parts and you should have no problem using them.



          To make it easier, you can get an STM32 Nucleo board, which has the same header pin configuration as an Arduino for quick and easy prototyping.






          share|improve this answer









          $endgroup$












          • $begingroup$
            Thanx for quick answer. I had in mind STM32F103C8T6 blue pill, because of low pricing and some protoboard for prototyping, but I got your point. So, bottom line is that sensors in the list I mentioned, matches smt32 gpio and can use all of them with stm32?
            $endgroup$
            – Creator
            May 23 at 10:17










          • $begingroup$
            Yes, it'll be fine. As long as you pay attention to where your leads are going. If doing I2C, hook up SDA and SCL on your sensor board to SDA and SCL on your STM32 board. The sensors will work on any microcontroller, the only reason those are sold as 'Arduino sensors' is because they will have a library in the Arduino IDE. This means ready made example code, but it isn't that difficult to translate most of it over to STM32
            $endgroup$
            – MCG
            May 23 at 10:29






          • 1




            $begingroup$
            Upvoted your answer too, and thanks for your comment, I will add it.
            $endgroup$
            – Michel Keijzers
            May 23 at 10:35






          • 1




            $begingroup$
            @MichelKeijzers no problem! It made sense to add it to your answer rather than mine!
            $endgroup$
            – MCG
            May 23 at 10:39















          3












          $begingroup$

          Yes, of course you can use those sensors. The sensors are not Arduino exclusive, just look up the datasheets to the parts and you should have no problem using them.



          To make it easier, you can get an STM32 Nucleo board, which has the same header pin configuration as an Arduino for quick and easy prototyping.






          share|improve this answer









          $endgroup$












          • $begingroup$
            Thanx for quick answer. I had in mind STM32F103C8T6 blue pill, because of low pricing and some protoboard for prototyping, but I got your point. So, bottom line is that sensors in the list I mentioned, matches smt32 gpio and can use all of them with stm32?
            $endgroup$
            – Creator
            May 23 at 10:17










          • $begingroup$
            Yes, it'll be fine. As long as you pay attention to where your leads are going. If doing I2C, hook up SDA and SCL on your sensor board to SDA and SCL on your STM32 board. The sensors will work on any microcontroller, the only reason those are sold as 'Arduino sensors' is because they will have a library in the Arduino IDE. This means ready made example code, but it isn't that difficult to translate most of it over to STM32
            $endgroup$
            – MCG
            May 23 at 10:29






          • 1




            $begingroup$
            Upvoted your answer too, and thanks for your comment, I will add it.
            $endgroup$
            – Michel Keijzers
            May 23 at 10:35






          • 1




            $begingroup$
            @MichelKeijzers no problem! It made sense to add it to your answer rather than mine!
            $endgroup$
            – MCG
            May 23 at 10:39













          3












          3








          3





          $begingroup$

          Yes, of course you can use those sensors. The sensors are not Arduino exclusive, just look up the datasheets to the parts and you should have no problem using them.



          To make it easier, you can get an STM32 Nucleo board, which has the same header pin configuration as an Arduino for quick and easy prototyping.






          share|improve this answer









          $endgroup$



          Yes, of course you can use those sensors. The sensors are not Arduino exclusive, just look up the datasheets to the parts and you should have no problem using them.



          To make it easier, you can get an STM32 Nucleo board, which has the same header pin configuration as an Arduino for quick and easy prototyping.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered May 23 at 10:03









          MCGMCG

          7,69532152




          7,69532152











          • $begingroup$
            Thanx for quick answer. I had in mind STM32F103C8T6 blue pill, because of low pricing and some protoboard for prototyping, but I got your point. So, bottom line is that sensors in the list I mentioned, matches smt32 gpio and can use all of them with stm32?
            $endgroup$
            – Creator
            May 23 at 10:17










          • $begingroup$
            Yes, it'll be fine. As long as you pay attention to where your leads are going. If doing I2C, hook up SDA and SCL on your sensor board to SDA and SCL on your STM32 board. The sensors will work on any microcontroller, the only reason those are sold as 'Arduino sensors' is because they will have a library in the Arduino IDE. This means ready made example code, but it isn't that difficult to translate most of it over to STM32
            $endgroup$
            – MCG
            May 23 at 10:29






          • 1




            $begingroup$
            Upvoted your answer too, and thanks for your comment, I will add it.
            $endgroup$
            – Michel Keijzers
            May 23 at 10:35






          • 1




            $begingroup$
            @MichelKeijzers no problem! It made sense to add it to your answer rather than mine!
            $endgroup$
            – MCG
            May 23 at 10:39
















          • $begingroup$
            Thanx for quick answer. I had in mind STM32F103C8T6 blue pill, because of low pricing and some protoboard for prototyping, but I got your point. So, bottom line is that sensors in the list I mentioned, matches smt32 gpio and can use all of them with stm32?
            $endgroup$
            – Creator
            May 23 at 10:17










          • $begingroup$
            Yes, it'll be fine. As long as you pay attention to where your leads are going. If doing I2C, hook up SDA and SCL on your sensor board to SDA and SCL on your STM32 board. The sensors will work on any microcontroller, the only reason those are sold as 'Arduino sensors' is because they will have a library in the Arduino IDE. This means ready made example code, but it isn't that difficult to translate most of it over to STM32
            $endgroup$
            – MCG
            May 23 at 10:29






          • 1




            $begingroup$
            Upvoted your answer too, and thanks for your comment, I will add it.
            $endgroup$
            – Michel Keijzers
            May 23 at 10:35






          • 1




            $begingroup$
            @MichelKeijzers no problem! It made sense to add it to your answer rather than mine!
            $endgroup$
            – MCG
            May 23 at 10:39















          $begingroup$
          Thanx for quick answer. I had in mind STM32F103C8T6 blue pill, because of low pricing and some protoboard for prototyping, but I got your point. So, bottom line is that sensors in the list I mentioned, matches smt32 gpio and can use all of them with stm32?
          $endgroup$
          – Creator
          May 23 at 10:17




          $begingroup$
          Thanx for quick answer. I had in mind STM32F103C8T6 blue pill, because of low pricing and some protoboard for prototyping, but I got your point. So, bottom line is that sensors in the list I mentioned, matches smt32 gpio and can use all of them with stm32?
          $endgroup$
          – Creator
          May 23 at 10:17












          $begingroup$
          Yes, it'll be fine. As long as you pay attention to where your leads are going. If doing I2C, hook up SDA and SCL on your sensor board to SDA and SCL on your STM32 board. The sensors will work on any microcontroller, the only reason those are sold as 'Arduino sensors' is because they will have a library in the Arduino IDE. This means ready made example code, but it isn't that difficult to translate most of it over to STM32
          $endgroup$
          – MCG
          May 23 at 10:29




          $begingroup$
          Yes, it'll be fine. As long as you pay attention to where your leads are going. If doing I2C, hook up SDA and SCL on your sensor board to SDA and SCL on your STM32 board. The sensors will work on any microcontroller, the only reason those are sold as 'Arduino sensors' is because they will have a library in the Arduino IDE. This means ready made example code, but it isn't that difficult to translate most of it over to STM32
          $endgroup$
          – MCG
          May 23 at 10:29




          1




          1




          $begingroup$
          Upvoted your answer too, and thanks for your comment, I will add it.
          $endgroup$
          – Michel Keijzers
          May 23 at 10:35




          $begingroup$
          Upvoted your answer too, and thanks for your comment, I will add it.
          $endgroup$
          – Michel Keijzers
          May 23 at 10:35




          1




          1




          $begingroup$
          @MichelKeijzers no problem! It made sense to add it to your answer rather than mine!
          $endgroup$
          – MCG
          May 23 at 10:39




          $begingroup$
          @MichelKeijzers no problem! It made sense to add it to your answer rather than mine!
          $endgroup$
          – MCG
          May 23 at 10:39













          3












          $begingroup$

          As MCG already mentions, you can use in principle any sensor that also can be used by Arduino. The main issue is if you want to use libraries. For the Arduino, there are for almost any sensor a library available, for the STM32 this is much less the case. Writing a library can take quite some time (depending on the complexity of the sensor communication).



          The Nucleo board can help if the sensor is placed on a board that can be pushed on top of an Arduino; otherwise you need to use separate wires anyway.



          Another way that could be worthwhile checking, is STM32Arduino, which is a project to make some STM32's compatible with Arduino, and can be programmed like an Arduino, but not all libraries are compatible.
          See also MCG's comment below and check the following helpful starting point for STM32Duino: getting-started-with-stm32-development-board-stm32f103c8.



          In most cases, Arduino is the most easiest solution, mostly because of the existence of a large library support, however, the Arduino also has some big advantages: very less SRAM, mostly bigger in size than STM32 boards, no (easy) debugging, very less peripherals.



          Another problem with Arduino libraries (and probably STM32 libraries too), is to check if multiple (different) libraries work together; you get into problems when e.g. they use both the same timer.






          share|improve this answer











          $endgroup$








          • 1




            $begingroup$
            I was just about to edit my answer to mention the STM32/Arduino compatibility, but no need now you mention it here! In fact, there is a page on how to set up the exact same board OP is using to the Arduino IDE here:circuitdigest.com/microcontroller-projects/… which may be useful to add to your answer. +1 from me too for the mention of the Arduino compatibility!
            $endgroup$
            – MCG
            May 23 at 10:31











          • $begingroup$
            Thanx, I have already checked links you sent me before. So basically, library repos is small when it comes to SMT32. What about some another MCU sensor libraries, is it better support for ESP32 or NodeMCU (I saw they are both programmable via Arduino IDE and C language)? Or in general, what would be your suggestions guys, in the case that I need ARM based platform (obviously because of performance), which is programmable via Arduino IDE in C/C++ and which support larger library set for sensors?
            $endgroup$
            – Creator
            May 23 at 11:01










          • $begingroup$
            I added some more comments, you also could check Arduino Due, but also there not all Arduino libraries will work ... first make a list of possible models you can use (which meet your performance), than check on which of those platforms your needed libraries will work and make a decision based on those.
            $endgroup$
            – Michel Keijzers
            May 23 at 13:55















          3












          $begingroup$

          As MCG already mentions, you can use in principle any sensor that also can be used by Arduino. The main issue is if you want to use libraries. For the Arduino, there are for almost any sensor a library available, for the STM32 this is much less the case. Writing a library can take quite some time (depending on the complexity of the sensor communication).



          The Nucleo board can help if the sensor is placed on a board that can be pushed on top of an Arduino; otherwise you need to use separate wires anyway.



          Another way that could be worthwhile checking, is STM32Arduino, which is a project to make some STM32's compatible with Arduino, and can be programmed like an Arduino, but not all libraries are compatible.
          See also MCG's comment below and check the following helpful starting point for STM32Duino: getting-started-with-stm32-development-board-stm32f103c8.



          In most cases, Arduino is the most easiest solution, mostly because of the existence of a large library support, however, the Arduino also has some big advantages: very less SRAM, mostly bigger in size than STM32 boards, no (easy) debugging, very less peripherals.



          Another problem with Arduino libraries (and probably STM32 libraries too), is to check if multiple (different) libraries work together; you get into problems when e.g. they use both the same timer.






          share|improve this answer











          $endgroup$








          • 1




            $begingroup$
            I was just about to edit my answer to mention the STM32/Arduino compatibility, but no need now you mention it here! In fact, there is a page on how to set up the exact same board OP is using to the Arduino IDE here:circuitdigest.com/microcontroller-projects/… which may be useful to add to your answer. +1 from me too for the mention of the Arduino compatibility!
            $endgroup$
            – MCG
            May 23 at 10:31











          • $begingroup$
            Thanx, I have already checked links you sent me before. So basically, library repos is small when it comes to SMT32. What about some another MCU sensor libraries, is it better support for ESP32 or NodeMCU (I saw they are both programmable via Arduino IDE and C language)? Or in general, what would be your suggestions guys, in the case that I need ARM based platform (obviously because of performance), which is programmable via Arduino IDE in C/C++ and which support larger library set for sensors?
            $endgroup$
            – Creator
            May 23 at 11:01










          • $begingroup$
            I added some more comments, you also could check Arduino Due, but also there not all Arduino libraries will work ... first make a list of possible models you can use (which meet your performance), than check on which of those platforms your needed libraries will work and make a decision based on those.
            $endgroup$
            – Michel Keijzers
            May 23 at 13:55













          3












          3








          3





          $begingroup$

          As MCG already mentions, you can use in principle any sensor that also can be used by Arduino. The main issue is if you want to use libraries. For the Arduino, there are for almost any sensor a library available, for the STM32 this is much less the case. Writing a library can take quite some time (depending on the complexity of the sensor communication).



          The Nucleo board can help if the sensor is placed on a board that can be pushed on top of an Arduino; otherwise you need to use separate wires anyway.



          Another way that could be worthwhile checking, is STM32Arduino, which is a project to make some STM32's compatible with Arduino, and can be programmed like an Arduino, but not all libraries are compatible.
          See also MCG's comment below and check the following helpful starting point for STM32Duino: getting-started-with-stm32-development-board-stm32f103c8.



          In most cases, Arduino is the most easiest solution, mostly because of the existence of a large library support, however, the Arduino also has some big advantages: very less SRAM, mostly bigger in size than STM32 boards, no (easy) debugging, very less peripherals.



          Another problem with Arduino libraries (and probably STM32 libraries too), is to check if multiple (different) libraries work together; you get into problems when e.g. they use both the same timer.






          share|improve this answer











          $endgroup$



          As MCG already mentions, you can use in principle any sensor that also can be used by Arduino. The main issue is if you want to use libraries. For the Arduino, there are for almost any sensor a library available, for the STM32 this is much less the case. Writing a library can take quite some time (depending on the complexity of the sensor communication).



          The Nucleo board can help if the sensor is placed on a board that can be pushed on top of an Arduino; otherwise you need to use separate wires anyway.



          Another way that could be worthwhile checking, is STM32Arduino, which is a project to make some STM32's compatible with Arduino, and can be programmed like an Arduino, but not all libraries are compatible.
          See also MCG's comment below and check the following helpful starting point for STM32Duino: getting-started-with-stm32-development-board-stm32f103c8.



          In most cases, Arduino is the most easiest solution, mostly because of the existence of a large library support, however, the Arduino also has some big advantages: very less SRAM, mostly bigger in size than STM32 boards, no (easy) debugging, very less peripherals.



          Another problem with Arduino libraries (and probably STM32 libraries too), is to check if multiple (different) libraries work together; you get into problems when e.g. they use both the same timer.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 23 at 12:46

























          answered May 23 at 10:28









          Michel KeijzersMichel Keijzers

          7,40893473




          7,40893473







          • 1




            $begingroup$
            I was just about to edit my answer to mention the STM32/Arduino compatibility, but no need now you mention it here! In fact, there is a page on how to set up the exact same board OP is using to the Arduino IDE here:circuitdigest.com/microcontroller-projects/… which may be useful to add to your answer. +1 from me too for the mention of the Arduino compatibility!
            $endgroup$
            – MCG
            May 23 at 10:31











          • $begingroup$
            Thanx, I have already checked links you sent me before. So basically, library repos is small when it comes to SMT32. What about some another MCU sensor libraries, is it better support for ESP32 or NodeMCU (I saw they are both programmable via Arduino IDE and C language)? Or in general, what would be your suggestions guys, in the case that I need ARM based platform (obviously because of performance), which is programmable via Arduino IDE in C/C++ and which support larger library set for sensors?
            $endgroup$
            – Creator
            May 23 at 11:01










          • $begingroup$
            I added some more comments, you also could check Arduino Due, but also there not all Arduino libraries will work ... first make a list of possible models you can use (which meet your performance), than check on which of those platforms your needed libraries will work and make a decision based on those.
            $endgroup$
            – Michel Keijzers
            May 23 at 13:55












          • 1




            $begingroup$
            I was just about to edit my answer to mention the STM32/Arduino compatibility, but no need now you mention it here! In fact, there is a page on how to set up the exact same board OP is using to the Arduino IDE here:circuitdigest.com/microcontroller-projects/… which may be useful to add to your answer. +1 from me too for the mention of the Arduino compatibility!
            $endgroup$
            – MCG
            May 23 at 10:31











          • $begingroup$
            Thanx, I have already checked links you sent me before. So basically, library repos is small when it comes to SMT32. What about some another MCU sensor libraries, is it better support for ESP32 or NodeMCU (I saw they are both programmable via Arduino IDE and C language)? Or in general, what would be your suggestions guys, in the case that I need ARM based platform (obviously because of performance), which is programmable via Arduino IDE in C/C++ and which support larger library set for sensors?
            $endgroup$
            – Creator
            May 23 at 11:01










          • $begingroup$
            I added some more comments, you also could check Arduino Due, but also there not all Arduino libraries will work ... first make a list of possible models you can use (which meet your performance), than check on which of those platforms your needed libraries will work and make a decision based on those.
            $endgroup$
            – Michel Keijzers
            May 23 at 13:55







          1




          1




          $begingroup$
          I was just about to edit my answer to mention the STM32/Arduino compatibility, but no need now you mention it here! In fact, there is a page on how to set up the exact same board OP is using to the Arduino IDE here:circuitdigest.com/microcontroller-projects/… which may be useful to add to your answer. +1 from me too for the mention of the Arduino compatibility!
          $endgroup$
          – MCG
          May 23 at 10:31





          $begingroup$
          I was just about to edit my answer to mention the STM32/Arduino compatibility, but no need now you mention it here! In fact, there is a page on how to set up the exact same board OP is using to the Arduino IDE here:circuitdigest.com/microcontroller-projects/… which may be useful to add to your answer. +1 from me too for the mention of the Arduino compatibility!
          $endgroup$
          – MCG
          May 23 at 10:31













          $begingroup$
          Thanx, I have already checked links you sent me before. So basically, library repos is small when it comes to SMT32. What about some another MCU sensor libraries, is it better support for ESP32 or NodeMCU (I saw they are both programmable via Arduino IDE and C language)? Or in general, what would be your suggestions guys, in the case that I need ARM based platform (obviously because of performance), which is programmable via Arduino IDE in C/C++ and which support larger library set for sensors?
          $endgroup$
          – Creator
          May 23 at 11:01




          $begingroup$
          Thanx, I have already checked links you sent me before. So basically, library repos is small when it comes to SMT32. What about some another MCU sensor libraries, is it better support for ESP32 or NodeMCU (I saw they are both programmable via Arduino IDE and C language)? Or in general, what would be your suggestions guys, in the case that I need ARM based platform (obviously because of performance), which is programmable via Arduino IDE in C/C++ and which support larger library set for sensors?
          $endgroup$
          – Creator
          May 23 at 11:01












          $begingroup$
          I added some more comments, you also could check Arduino Due, but also there not all Arduino libraries will work ... first make a list of possible models you can use (which meet your performance), than check on which of those platforms your needed libraries will work and make a decision based on those.
          $endgroup$
          – Michel Keijzers
          May 23 at 13:55




          $begingroup$
          I added some more comments, you also could check Arduino Due, but also there not all Arduino libraries will work ... first make a list of possible models you can use (which meet your performance), than check on which of those platforms your needed libraries will work and make a decision based on those.
          $endgroup$
          – Michel Keijzers
          May 23 at 13:55











          2












          $begingroup$

          May work for some, but definitely not for all.



          Notice that the Arduino operates at 5V supply and I/O voltages, while the STM32 uses 3.3V!



          While many of the STM32's I/O pins may be 5V-tolerant for input (see datasheet), they cannot output 5V signals which many Arduino-targeted sensor( board)s are built for.



          So,



          • best case: The sensor is ok with 3.3V signals at its inputs and sends 5V signals to 5V-tolerant pins on the µC.


          • good case: The sensor does not work (as expected) because the 3.3V signals are too low, but neither end takes any damage.


          • bad case: The sensor sends a 5V output signal to a non-5V-tolerant µC (input) pin and damages the µC and possibly the sensor by excessive current.


          Check and make sure that the sensor's inputs can operate with 3.3V signals, and that the µC's inputs can handle the (likely 5V) signals from the sensor.



          Some sensors can operate on a range of supply voltages, e.g. 3.3V~5V, so if you supply them with 3.3V they will work perfectly in a 3.3V system. And there are, of course, sensors which can only operate on 3.3V but not on 5V. For use with 5V Arduinos, these typically have some sort of level-shifting included on the board ("shield") they come mounted on. In these cases, even though the sensor could work on 3.3V, the board cannot.






          share|improve this answer











          $endgroup$












          • $begingroup$
            It looks like voltage should not be a problem at MCU input side, but seems like you are most likely right regarding input voltage for sensors, since most of them operate at ~5V (or they are most reliable at that voltage)
            $endgroup$
            – Creator
            May 23 at 11:27










          • $begingroup$
            cdn1.imggmi.com/uploads/2019/5/23/…
            $endgroup$
            – Creator
            May 23 at 11:40






          • 1




            $begingroup$
            @Creator "It looks like voltage should not be a problem at MCU input side" - How do you get to that conclusion? Depending on the STM MCU some or most I/O pins are 5V-tolerant, but you have to make sure to connect 5V signals only to those pins, or use some sort of level shifter (e.g. a voltage divider). Otherwise, irreversible damage will occur.
            $endgroup$
            – JimmyB
            May 23 at 13:17











          • $begingroup$
            @Creator Notice that we're talking about too low "high" signal levels from MCU to sensor (3.3V instead of 5V expected), but too high "high" signal levels from sensor to MCU (5V instead of maximum permissible 3.3V).
            $endgroup$
            – JimmyB
            May 23 at 13:24










          • $begingroup$
            I understand your voltage concerns. Thanx. anyway, I am going to do some testing after all.
            $endgroup$
            – Creator
            May 23 at 20:08















          2












          $begingroup$

          May work for some, but definitely not for all.



          Notice that the Arduino operates at 5V supply and I/O voltages, while the STM32 uses 3.3V!



          While many of the STM32's I/O pins may be 5V-tolerant for input (see datasheet), they cannot output 5V signals which many Arduino-targeted sensor( board)s are built for.



          So,



          • best case: The sensor is ok with 3.3V signals at its inputs and sends 5V signals to 5V-tolerant pins on the µC.


          • good case: The sensor does not work (as expected) because the 3.3V signals are too low, but neither end takes any damage.


          • bad case: The sensor sends a 5V output signal to a non-5V-tolerant µC (input) pin and damages the µC and possibly the sensor by excessive current.


          Check and make sure that the sensor's inputs can operate with 3.3V signals, and that the µC's inputs can handle the (likely 5V) signals from the sensor.



          Some sensors can operate on a range of supply voltages, e.g. 3.3V~5V, so if you supply them with 3.3V they will work perfectly in a 3.3V system. And there are, of course, sensors which can only operate on 3.3V but not on 5V. For use with 5V Arduinos, these typically have some sort of level-shifting included on the board ("shield") they come mounted on. In these cases, even though the sensor could work on 3.3V, the board cannot.






          share|improve this answer











          $endgroup$












          • $begingroup$
            It looks like voltage should not be a problem at MCU input side, but seems like you are most likely right regarding input voltage for sensors, since most of them operate at ~5V (or they are most reliable at that voltage)
            $endgroup$
            – Creator
            May 23 at 11:27










          • $begingroup$
            cdn1.imggmi.com/uploads/2019/5/23/…
            $endgroup$
            – Creator
            May 23 at 11:40






          • 1




            $begingroup$
            @Creator "It looks like voltage should not be a problem at MCU input side" - How do you get to that conclusion? Depending on the STM MCU some or most I/O pins are 5V-tolerant, but you have to make sure to connect 5V signals only to those pins, or use some sort of level shifter (e.g. a voltage divider). Otherwise, irreversible damage will occur.
            $endgroup$
            – JimmyB
            May 23 at 13:17











          • $begingroup$
            @Creator Notice that we're talking about too low "high" signal levels from MCU to sensor (3.3V instead of 5V expected), but too high "high" signal levels from sensor to MCU (5V instead of maximum permissible 3.3V).
            $endgroup$
            – JimmyB
            May 23 at 13:24










          • $begingroup$
            I understand your voltage concerns. Thanx. anyway, I am going to do some testing after all.
            $endgroup$
            – Creator
            May 23 at 20:08













          2












          2








          2





          $begingroup$

          May work for some, but definitely not for all.



          Notice that the Arduino operates at 5V supply and I/O voltages, while the STM32 uses 3.3V!



          While many of the STM32's I/O pins may be 5V-tolerant for input (see datasheet), they cannot output 5V signals which many Arduino-targeted sensor( board)s are built for.



          So,



          • best case: The sensor is ok with 3.3V signals at its inputs and sends 5V signals to 5V-tolerant pins on the µC.


          • good case: The sensor does not work (as expected) because the 3.3V signals are too low, but neither end takes any damage.


          • bad case: The sensor sends a 5V output signal to a non-5V-tolerant µC (input) pin and damages the µC and possibly the sensor by excessive current.


          Check and make sure that the sensor's inputs can operate with 3.3V signals, and that the µC's inputs can handle the (likely 5V) signals from the sensor.



          Some sensors can operate on a range of supply voltages, e.g. 3.3V~5V, so if you supply them with 3.3V they will work perfectly in a 3.3V system. And there are, of course, sensors which can only operate on 3.3V but not on 5V. For use with 5V Arduinos, these typically have some sort of level-shifting included on the board ("shield") they come mounted on. In these cases, even though the sensor could work on 3.3V, the board cannot.






          share|improve this answer











          $endgroup$



          May work for some, but definitely not for all.



          Notice that the Arduino operates at 5V supply and I/O voltages, while the STM32 uses 3.3V!



          While many of the STM32's I/O pins may be 5V-tolerant for input (see datasheet), they cannot output 5V signals which many Arduino-targeted sensor( board)s are built for.



          So,



          • best case: The sensor is ok with 3.3V signals at its inputs and sends 5V signals to 5V-tolerant pins on the µC.


          • good case: The sensor does not work (as expected) because the 3.3V signals are too low, but neither end takes any damage.


          • bad case: The sensor sends a 5V output signal to a non-5V-tolerant µC (input) pin and damages the µC and possibly the sensor by excessive current.


          Check and make sure that the sensor's inputs can operate with 3.3V signals, and that the µC's inputs can handle the (likely 5V) signals from the sensor.



          Some sensors can operate on a range of supply voltages, e.g. 3.3V~5V, so if you supply them with 3.3V they will work perfectly in a 3.3V system. And there are, of course, sensors which can only operate on 3.3V but not on 5V. For use with 5V Arduinos, these typically have some sort of level-shifting included on the board ("shield") they come mounted on. In these cases, even though the sensor could work on 3.3V, the board cannot.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 24 at 10:20

























          answered May 23 at 11:07









          JimmyBJimmyB

          3,1081417




          3,1081417











          • $begingroup$
            It looks like voltage should not be a problem at MCU input side, but seems like you are most likely right regarding input voltage for sensors, since most of them operate at ~5V (or they are most reliable at that voltage)
            $endgroup$
            – Creator
            May 23 at 11:27










          • $begingroup$
            cdn1.imggmi.com/uploads/2019/5/23/…
            $endgroup$
            – Creator
            May 23 at 11:40






          • 1




            $begingroup$
            @Creator "It looks like voltage should not be a problem at MCU input side" - How do you get to that conclusion? Depending on the STM MCU some or most I/O pins are 5V-tolerant, but you have to make sure to connect 5V signals only to those pins, or use some sort of level shifter (e.g. a voltage divider). Otherwise, irreversible damage will occur.
            $endgroup$
            – JimmyB
            May 23 at 13:17











          • $begingroup$
            @Creator Notice that we're talking about too low "high" signal levels from MCU to sensor (3.3V instead of 5V expected), but too high "high" signal levels from sensor to MCU (5V instead of maximum permissible 3.3V).
            $endgroup$
            – JimmyB
            May 23 at 13:24










          • $begingroup$
            I understand your voltage concerns. Thanx. anyway, I am going to do some testing after all.
            $endgroup$
            – Creator
            May 23 at 20:08
















          • $begingroup$
            It looks like voltage should not be a problem at MCU input side, but seems like you are most likely right regarding input voltage for sensors, since most of them operate at ~5V (or they are most reliable at that voltage)
            $endgroup$
            – Creator
            May 23 at 11:27










          • $begingroup$
            cdn1.imggmi.com/uploads/2019/5/23/…
            $endgroup$
            – Creator
            May 23 at 11:40






          • 1




            $begingroup$
            @Creator "It looks like voltage should not be a problem at MCU input side" - How do you get to that conclusion? Depending on the STM MCU some or most I/O pins are 5V-tolerant, but you have to make sure to connect 5V signals only to those pins, or use some sort of level shifter (e.g. a voltage divider). Otherwise, irreversible damage will occur.
            $endgroup$
            – JimmyB
            May 23 at 13:17











          • $begingroup$
            @Creator Notice that we're talking about too low "high" signal levels from MCU to sensor (3.3V instead of 5V expected), but too high "high" signal levels from sensor to MCU (5V instead of maximum permissible 3.3V).
            $endgroup$
            – JimmyB
            May 23 at 13:24










          • $begingroup$
            I understand your voltage concerns. Thanx. anyway, I am going to do some testing after all.
            $endgroup$
            – Creator
            May 23 at 20:08















          $begingroup$
          It looks like voltage should not be a problem at MCU input side, but seems like you are most likely right regarding input voltage for sensors, since most of them operate at ~5V (or they are most reliable at that voltage)
          $endgroup$
          – Creator
          May 23 at 11:27




          $begingroup$
          It looks like voltage should not be a problem at MCU input side, but seems like you are most likely right regarding input voltage for sensors, since most of them operate at ~5V (or they are most reliable at that voltage)
          $endgroup$
          – Creator
          May 23 at 11:27












          $begingroup$
          cdn1.imggmi.com/uploads/2019/5/23/…
          $endgroup$
          – Creator
          May 23 at 11:40




          $begingroup$
          cdn1.imggmi.com/uploads/2019/5/23/…
          $endgroup$
          – Creator
          May 23 at 11:40




          1




          1




          $begingroup$
          @Creator "It looks like voltage should not be a problem at MCU input side" - How do you get to that conclusion? Depending on the STM MCU some or most I/O pins are 5V-tolerant, but you have to make sure to connect 5V signals only to those pins, or use some sort of level shifter (e.g. a voltage divider). Otherwise, irreversible damage will occur.
          $endgroup$
          – JimmyB
          May 23 at 13:17





          $begingroup$
          @Creator "It looks like voltage should not be a problem at MCU input side" - How do you get to that conclusion? Depending on the STM MCU some or most I/O pins are 5V-tolerant, but you have to make sure to connect 5V signals only to those pins, or use some sort of level shifter (e.g. a voltage divider). Otherwise, irreversible damage will occur.
          $endgroup$
          – JimmyB
          May 23 at 13:17













          $begingroup$
          @Creator Notice that we're talking about too low "high" signal levels from MCU to sensor (3.3V instead of 5V expected), but too high "high" signal levels from sensor to MCU (5V instead of maximum permissible 3.3V).
          $endgroup$
          – JimmyB
          May 23 at 13:24




          $begingroup$
          @Creator Notice that we're talking about too low "high" signal levels from MCU to sensor (3.3V instead of 5V expected), but too high "high" signal levels from sensor to MCU (5V instead of maximum permissible 3.3V).
          $endgroup$
          – JimmyB
          May 23 at 13:24












          $begingroup$
          I understand your voltage concerns. Thanx. anyway, I am going to do some testing after all.
          $endgroup$
          – Creator
          May 23 at 20:08




          $begingroup$
          I understand your voltage concerns. Thanx. anyway, I am going to do some testing after all.
          $endgroup$
          – Creator
          May 23 at 20:08

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Electrical Engineering Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f439961%2fusing-arduino-sensors-with-an-stm32%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

          What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

          Esgonzo ibérico Índice Descrición Distribución Hábitat Ameazas Notas Véxase tamén "Acerca dos nomes dos anfibios e réptiles galegos""Chalcides bedriagai"Chalcides bedriagai en Carrascal, L. M. Salvador, A. (Eds). Enciclopedia virtual de los vertebrados españoles. Museo Nacional de Ciencias Naturales, Madrid. España.Fotos