Program "blue pill" with STM32 Cores in Arduino IDE

 Author:   Posted on:    No comments

Back when I wrote Set up STM32 "blue pill" for Arduino IDE I found two Arduino Boards packages for STM32. I didn't know at that time what were the differences between them and that post uses the STM32 package developed by Roger Clark. In fact, that one originates from libmaple which was first developed by LeafLabs for their Maple boards. The library was written in 2012 and it is no longer under active development.

I consider STM32duino to be a better alternative now, since it is actively developed by STMicroelectronics and uses as backend recent versions of STM32 libraries (LL, HAL). More than that it has support for multiple cores and boards including, but not limited to, official evaluation boards, 3D printer boards and flight controllers. To be able to use it you need a board and a programmer, Arduino IDE and STM32CubeProgramer. Fortunately the required software is cross-platform so you can code for STM32 on any platform. In this post I'll show you how to install the required software and how to upload sketches to STM32 "blue pill".

Program blue pill with STM32 Cores in Arduino IDE

Install Oracle Java on Linux Ubuntu

 Author:   Posted on:    1 comment

Java is a cross-platform development platform used by many applications. If you want to run Java based applications, you must install a runtime. Java is developed by Oracle. There are two packages: JDK (Java Development Kit) and JRE (Java Runtime Environment). While the first is needed to develop Java applications, for running them you need the runtime.

Due to licensing, on Linux you have the possibility to install only OpenJDK from software repositories. That is an open source GPL licensed JDK edition. Well, I had this one installed (package openjdk-8-jre) on Ubuntu and I was facing some problems. JabRef, a references manager application, wouldn't run. Initially I thought there is something wrong with the current release. Later I installed (the GUI installer worked) STM32CubeProgrammer, a programming utility for STM32 microcontrollers. Neither this one would launch.

Java JRE Download page for Linux

Java Runtime Download page for Linux

DHT22 sensor web server on ESP8266

 Author:   Posted on:    1 comment

There are plenty of projects using digital temperature and humidity sensors such as DHT11 or DHT22 and various development boards. I'll try to make this one a bit different. A common thing that I didn't like about projects using sensors and web servers is the way most users choose to update sensor data. The easiest way is to use a refresh meta tag in the HTML of the web page.

I don't like this. Asking the browser to refresh the document means to request it again from the server and render it on the client's device. I'll use in this article Javascript code which will request a new sensor reading from the server running on the development board and update the specific HTML element. As additional features, I'll add some user-selectable actions when readings reach a threshold.

DHT22 sensor web server on ESP8266

LM317 Lithium Ion Battery Charger

 Author:   Posted on:    No comments

Even though I have some TP4056 modules for charging Li-Ion cells, those small PCBs generate a lot of heat and the charging current decreases with temperature increase. Since I have parallel pairs of cells from notebook batteries, I would like to charge them with a higher current. Another limitation of those modules would be that the maximum charge current cannot be changed unless I replace a small SMD resistor. Therefore I'll build my own Li-Ion battery charger, with LM317 (LM338). Using a linear regulator does not solve the heat production issue, but at least I can put it on a heatsink.

Li-Ion cells need to be charged in a two-step process. First, until they reach a threshold voltage the charger behaves as a constant current supply. This current is cell-specific, but usually the supplied energy (in Ah) should be less than 80 percent of battery capacity (Ah). When the voltage increases enough, the charger should switch to constant voltage mode, maintaining a stable 4.2 V (or 4.1 V for some cells) until current drops.

LM317 Lithium Ion Battery Charger

Upload files from Arduino IDE to ESP SPIFFS

 Author:   Posted on:    No comments

ESP8266 and ESP32 development boards have SPI flash memory used mainly for program storage. But, if there is enough space, the flash memory can be "partitioned" and used for other purposes. Making a SPIFFS (SPI Flash Filesystem) partition has some advantages. Even though file system is stored on the same flash chip as the program, programming new sketch will not modify file system contents. Since ESP development boards have WiFi connectivity it's easy to think of something useful to do with SPIFFS. For example a web server can store images, scripts, styles and even HTML files that will be used to create the web interface. Another usage would be to create a data log that can be downloaded via a web interface.

Obviously SPIFFS data can be read/written from other interfaces, including serial monitor. If you're developing a web server on ESP8266/ESP32 you'll want an easy way to upload server files to SPIFFS. Fortunately, there are plugins for Arduino IDE that handle this process. We will see how to do this and then check for the existence of files on the SPIFFS partition.

Upload files from Arduino IDE to ESP SPIFFS

Audio Card Infrared Receiver

 Author:   Posted on:    No comments

Looking back at an old post where I described how to view, record and decode infrared remote protocol with no more than an integrated receiver, a few parts and your computer with the right software, I decided to make a PCB for such a circuit. Back then I used the breadboard to quickly connect the required parts. I also made some other tests. There is an inconvenient of a soundcard IR receiver. It requires power to operate, but there's no usable power output through the audio input of the computer. At first, I believed I could use the bias voltage for electret microphones that is present only on microphone input. But the IR receiver requires a minimum of 2.5 V. And my card only supplied 2 V. This voltage output cannot provide enough current to drive a DC-DC converter, therefore I had to find an alternative.

One option is to provide voltage from USB port. I didn't like this. If I'm using the USB port, I could as well use a microcontroller and send IR data over the same USB port without using an additional cable. Obviously, the second option is to use a battery. I used for this circuit a CR2032 cell, but this may not be the best option. The rechargeable type LIR2032 may as well be used.

Audio Card Infrared Receiver

Infrared receiver built on PCB