I’m done with fake uCs (microcontrollers)

I finally managed to flash a project to my Chinese knock-off STM32F103 blue pill. It’s not a task that I relish to try again. The flashing process seems to be deteriorating in its reliability. I’m not sure why. I would have thought that it would work either 100% of the time, or 0%, given the nature of uCs. There does seem to be degradation, though, so I guess my assumption must be wrong.

I have noticed a similar thing happen with my fake STM32F411 black pill. The F4 now seems unflashable.

Compare that with a black pill that I bought from Pimoroni, a reputable retailer. Flashing my projects to the uC has been a pleasure in comparison.

Actually, I finally bit the bullet and bought a Nucleo board for the STM32 F4 from RS Components. I hemmed and harred about it for a long time. The drawbacks in my mind included its steeper price and breadboard unfriendliness. I can’t just plug it into a breadboard. The board also mostly has male connectors, which means that if I want to connect to a breadboard I need female-to-male connectors rather than the more usual male-to-male breadboard leads. Fortunately I bought a selection of Dupont cables some time ago, which included female-to-male connectors.

I recently discovered that splitting the wires away from each other was a good idea. Erstwhile, I was adamant that I didn’t want to break them apart, in case them being together was useful. However, I found that the leads often disconnected from the pins. Separating the wires proved to be a much better idea.

Another downside of the Nucleo board is that the pins aren’t labelled. You need the reference card that comes with the device, and it involves hunting for the right pin and counting along the rows.

However, what finally swung it for me in favour of buying the Nucleo was the simplification of connecting to my desktop computer. One simple USB replaces the three that I had before: one of the programmer (ST-Link), one for the serial port, and one for the USB port to power the device properly. Possibly the latter isn’t strictly necessary, but I think it helps. I’ve had marginal power supply issues before, so I prefer it when the microcontroller has a nice bit of juice to work with.

The way to go, then, is to do development work on the Nucleo, and then transfer the program to the blackpill when you’re happy that everything is working and want to finalise it onto a stripboard.

STM32’s are expensive at the moment, and difficult to obtain. If you’re interested in taking your knowledge further and exploring ARM processors, then the Raspberry Pi RP2040 Pico might be a better way to go. These things cost less than 4 quid; less than half the current prices for a blackpill. The Pico is great for learning, and it is a powerful board.

Your shopping list for Santa

It’s a little early to be thinking about Christmas, but whilst I’m on the subject of comparing different uCs, I thought it would be a good idea to share my views on ideas for presents for those looking to dip their toes into microcontrollers.

And the winner is: Arduino. Yes, an Arduino is comparatively expensive and underpowered for what it is, but it gives you the best “out of the box” experience. And yes, its IDE could be better, but hey, it gets you going. There is an extensive collection of libraries for just about any peripheral you care to mention. The libraries are easy to install. The whole thing is a pleasant experience.

There are those that argue that using the Arduino libraries isn’t “real” programming. I had occasion to play with an Arduino lately and I must say: you will like those libraries. There is nothing to prevent you from peering under the hood if you want to dive deeper. There are a plethora of tutorials out there, and the uCs are amongst the simplest to understand. So don’t dismiss Arduino’s as valuable tool for learning about uCs.

Microsoft’s VS Code integrates with PlatformIO to provide access to the standard Arduino libraries. VS Code even works on Linux. It is fast, and a better programming environment than the standard Arduino IDE. When you’ve got your feet under the table with Arduino, but feel you want a better IDE, then the VS Code/PlatformIO will be your next step.

Microcontrollers are, by themselves, relatively useless. You need a set of components to control. So I recommend buying one of the Elegoo Starter kits from Amazon. It has a whole bunch of stuff for you to play with, including instructions and a (fake) Arduino Uno. Although I have been sworn off Chinese components, I think it may be the best approach if you’re starting completely from scratch.

Arduino Unos are pricey, to say the least. We’re talking 22 quid here, as opposed to less than 4 for the Pico. I prefer the Nano Every, which weighs in at 11 Euros from the official Arduino store. You’ll need to pay extra if you want a USB cable. The Everys are a little more powerful than the Uno. They also plug into a breadboard, which is a big win in my books. I did have trouble programming the Every in the past. Since I upgraded my version of Debian, the Every seems to flash OK. I don’t think I’m the only one who has had problems flashing the devices. So don’t go and order a whole bunch of them at once. Make sure they work smoothly.

Raspberry Pi Pico RP2040 takes second place. Picos are way more powerful, and cheaper than Arduinos. Google for “pico starter kits” if you want components to come with them. The one from Makerfabs looks OK, although I have never tried it. Cost is $35. These kits are, arguably, overpriced, but at least they do give you a collection of bits and bobs to get you started.

Picos can be programmed interactively using MicroPython. Arduinos have no hope of being able to run MicroPython. The Pi Foundation also publishes a freely available guide to using the Pico, and covers a lot of ground.

I prefer using C to program my Pico. There is more setup work to that, though. Once again, the Pi Foundation provides a well-written guide into settings things up for C. The Foundation has tried hard, and succeeded, in providing excellent documentation. There is also an active online community where you can ask questions.

STM32 is third place. I think that just about every Maker experiments with STM32s as their journey into uCs continues, so they are well worth checking out. There is a huge selection of boards to choose from. The prices are – or rather were – cheap. Tools setup tends to be tedious, with plenty of criticism (not least from me) about their general bloatiness. I like both the blackpills and the Nucleo F411RE. The Nucleo works more conveniently than the blackpill. In terms of putting stuff on a stripboard, though, the blackpill is the way to go.

Maybe hold fire on STM32’s at the moment, though, due to supply and price issues. Could this be an opportunity for the Picos steal STM32’s thunder amongst Makers? I wish we could get hold of the Pico sales statistics.

ESP32 comes fourth. When I first played with these devices, I asked myself “how comes these devices don’t rule the world?” They are cheap and powerful UCs. My ESP32 cost me about 4 quid a few years ago, which even came with an onboard DAC. They also feature bluetooth and WiFi, so when I say the ESP’s a powerful machine, I’m not joking. If you want WiFi capability in your project, then an ESP32 is likely to be the way to go. I’ve rated it fourth , though, because I’m not especially interested in WiFi, it is a slightly odd shape for a breadboard, and I’m somewhat indifferent as to their SDK. ESP32 uses the Xtensa core, which isn’t available in Debian repos. The build process also uses Python, and I’ve had library conflicts in the past. You’ll get it going eventually. ESP just isn’t my go-to board. Your mileage may likely vary, though. It is well-respected amongst Makers.

And the others. There is a vast range of uCs to choose from. A huge player in the field are PICs, for example. I’ve never tried a PIC, although they seem OK. They are used in education and manufacturing. They’ll be plenty of people out there who swear by them. The thing that puts me off with these “and the others” is I’ve heard discouraging things either about the development kits or the power of the processor themselves. Although I’m sure there’s nothing “wrong” with the chips, I am just not compelled to try them out given the strong offerings that I’ve listed above. Just my opinion.

Anyhoo, I’ve rattled on too long now. I hope that I have given you food for thought. Take care.

About mcturra2000

Computer programmer living in Scotland.
This entry was posted in Uncategorized. Bookmark the permalink.

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s