Smaller Cheaper Arduino

Well, honestly, [Michael Mayer’s] STM8 Arduino (called Sduino) isn’t actually much to do with the Arduino, except in spirit. The STM8 is an 8-bit processor. It is dirt cheap and has some special motor control features that are handy. There’s a significant library available for it. However, it can be a pain to use the library and set up the build.

Just like how the Arduino IDE provides libraries and a build system for gcc, Sduino provides similar libraries and a build system for the sdcc compiler that can target the STM8. However, if you are expecting the Arduino’s GUI or a complete knock off of the Arduino library, you won’t get that.

That being said, you do get a lot of compatible libraries. The command line Makefile is simple to set up and use. Why not use a “normal” Arduino? The STM8 is not only inexpensive, but you can make use of the specialized hardware for things like quadrature decoding. In addition, the low power modes are super low.

Don’t let the Makefile put you off. The standard Blink sketch looks identical to an Arduino version. Here’s the required Makefile:

BOARD_TAG = stm8sblue
include ../../sduino/sduino.mk

That’s it. Not too hard.

There’s support for a simple breakout board that is inexpensive, as well as the ESP-14 pictured at the top of this article which has an ESP8266 and an STM8 controller onboard. For about $3 you get an STM8003 CPU and the WiFi capability. Hard to beat that. [Elliot Williams] just gave that board a try and found the ESP-14 to be “weird”. He may be right, but this gives you an easy way to use it.

Support for the STM8 version of the Discovery board is supposedly forthcoming.

38 thoughts on “Smaller Cheaper Arduino

    1. I had this question until I started putting ESP8266s in products that were not going into my hands. That chipset requires godly levels of insight to maintain stability, which is doable for gurus, but us yokels are better off tacking on a $1 uC next to the ESP and just using it as a modem, basically giving you a chance to reset the ESP every time it crashes.

      1. What?
        I am using the ESP8266 12E for a couple of projects that milk just about every bit of capability out of these chips and have suffered nothing of the sort.

        Web connection- check
        NTP Time – check
        hardware SPI running an OLED display – check
        SPI running another peripheral chip on top of the OLED – check
        polling buttons – check
        reading and writing to EEPROM on occasion – check
        Running 24 hours a day – check

        I am using the Arduino IDE because LUA is admittedly terrible, maybe that’s the catch? Seems rock stable to me.
        Maybe your power supply sucks? But there again, I’ve been powering off a PC USB port this whole time.

        1. it’s pretty difficult to write any decent sized software with the Arduino IDE, especially for the 8266. Swap to eclipse – you can still use the same libraries bit have something you can write decent code with that does more than turn a LED on and off…

      2. I’m also using esp8266 for at least a year but didn’t see any crashes/instability at all. I have one old esp-01 installed in my wall socket to control outdoor lights working 24/7 and I don’t have even single issue with it.

    2. So along with what others said about the adc pins etc. There’s also the fact that the STM8 uses considerably less power. That’ll let you power down the esp8266 when it’s not in use and let you have a much better battery life on a project that needs to run for a while. You can also add in an SPI flash or something else for storage to log data for even longer periods of time without tying up the esp8266 to send tiny packets.

    3. Many comments here focus on the ESP8266. But the main target for this project the STM8S in general, the ESP-12 just happens to be a widespread device using it. My main target for this project are these 60-cent STM8S103 breakout boards.

      I discuss the “Why?” question on the project page as well. The summary line is:
      For commercial use the STM8 offers significant advantages on the cost side, for motor control and for standby capabilities.
      For one-of private projects stick with the Arduino. Enjoy an amazing community support and don’t worry about 1$ more for the CPU.
      https://github.com/tenbaht/sduino/blob/master/docs/index.md#why-use-a-stm8-instead-of-an-atmega

      This project is not supposed to be “better than Arduino”. It’s purpose is to give you a head start into a different CPU architecture if you happen to have a professional need or a private desire for it.

  1. For compare purposes:
    – STM32F102 boards from china are around USD $1.8 http://s.click.aliexpress.com/e/ZrnaeyZ
    – 8 bit STM boards ( ST programmer needed ) are around USD $0.8 http://s.click.aliexpress.com/e/6EyjqNj .
    – Ardino Pro mini clones are around USD $1.35 but needs USB-TTL interface to be programmed
    – Arduino nano clones ( with USB-TTL CH340 chip onboard) are around US $2.13.
    – ESP12E modules are around USD $1.76
    So in terms of absolute cost per board, yes STM8 are the winner,

  2. This is commendable work. Bringing very low-cost micro-controllers into the realm of individual developers who do not want the complexity of, or (often) high per-seat cost of manufacturer supplied (non-crippled) tool-chains is welcome. A hypothetical case would be development of a product driven by absolute minimum cost totally within a developing country for large-quantity deployment to take advantage of the very low cost of these parts.

    1. That’s exactly what’s going on in China. Legitimate STM8s are so cheap that it’s not worth using poorly documented 8051 clones.

      However it’s been a few years since low cost micros were only usable with payware toolchains. Everything that’s not ARM has a GCC or SDCC port nowadays. Payware tools are still worth it if standards compliance or tight optimization is needed.

  3. If we had an inexpensive ARM along with the ESP8266 …. maybe. The STM8 leaves me cold. I can just use the ESP8266 itself for almost anything the STM8 can do. I don’t know why people don’t wake up to what an amazing device the ESP8266 is all by itself if you ignore the Wifi. I just placed an order a couple of days ago for 10 ESP-12F modules for $20 total.

    No doubt the STM8 has certain virtues. Low power has been the notable one that catches my attention, but I am doing fine putting the ESP8266 to sleep when I have projects that run off batteries. So, we find ourselves asking, “why?”.

    1. I had this question until I started putting ESP8266s in products that were not going into my hands. That chipset requires godly levels of insight to maintain stability, which is doable for gurus, but us yokels are better off tacking on a $1 uC next to the ESP and just using it as a modem, basically giving you a chance to reset the ESP every time it crashes.

      1. The esp8266 is rock solid, many commercial projects use it. I agree, it must be your code. STM8 can’t do wifi and if you need connectivity, why not just use the esp8266? Adding more complexity to any design is a bad idea.

  4. Gotta hand it to ST’s marketing department. The STM8 has been around forever, yet somehow in 2015 or so people started getting interested in a proprietary, single-vendor 8-bit architecture.

    1. When I look at STM8s, they seem to be aimed squarely at AVRs. So if you remove two factors that make AVRs suck (expensive development hardware and high price per unit) and give the Chinese some time.. There you go. Even the software side is improving, perhaps not up to the levels of free stand-alone Atmel Studio, but still.

    2. In April 2014, SDCC 3.4.0 was released. The first release of the free Small Device C Compiler supporting the STM8.
      The SDCC 3.5.0 release in June 2016 brought lots of bug fixes and further improvements in the STM8 backend. SDCC 3.5.0 is in Debian making it easily available to all the users of Debian-based distributions.
      I guess the combination of cheap boards and a free compiler is what got people interested.

      Philipp

      P.S.: Of course there was further development. SDCC 3.6.0 improved standard-compliance substantially. Then came substantial improvements in code speed. By late 2016 SDCC generated faster integer code than the non-free compilers for the STM8 (https://community.st.com/thread/8847).

      1. ST’s marketing department supported SDCC by providing 10 evaluation boards (2 STM8A-DISCOVERY, 2 STM8S-DISCOVERY, 2 STM8L-DISCOVERY, 1 STM8L101-EVAL, 1 STM8S/128-EVAL) in December 2015. Most are still used for improving SDCC. A few were passed on to developers of other free software for the STM8.

        Philipp

      2. Supporting SDCC was probably part of the same push, but the main reason is that ST started promoting them heavily in Asia, particularly China. I don’t know if they also lowered prices at the same time, but they clearly targeted high-volume industrial and white-goods markets. Once this started to bleed back to the West via gadgets and boards from Alibaba and eBay, the maker-types started picking up on it.

  5. I can think of another reason why this is awesome. Remember the web controlled LED board that everyone got excited about because it had an esp and could easily be hacked? The stm8 is very popular and probably ends up in all sorts of devices. Having a tool-chain and good documentation opens up these devices to easy hacking.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s