Arduino Thermometer with... TV Output

 Author:   Posted on:   Comments
Analog video is getting replaced by digital signals which provide better resolution and picture without noise or interference. Although receivers for digital signals are cheap and popular, devices for generating such signals are expensive and intended for professional use only. On the other hand, analog video is easy to generate with simple hardware. You can even broadcast it over RF (on wire, not on air) with common modulators (standalone devices or modules from video game consoles, set top boxes, VCRs etc.).

An easy way to generate video signal is by using a microcontroller and some resistors. I'll use for this purpose an Arduino board (ATmega 328p) with the TVout library. The video signal is of low resolution and black&white. But it can be used to display data on a TV screen. If you no longer own a TV with analog video input, an USB capture card can be used. TVout library is interrupt based, therefore will interfere with some of other interrupt dependent microcontroller features.

Thermometer with TV Output
Thermometer with TV Output

Compute Heat Index with Arduino and DHT Sensor

 Author:   Posted on:   Comments
The heat index is a parameter that takes into account temperature and relative humidity, to determine the apparent temperature or the human perceived equivalent temperature. Heat index was developed in 1978 by George Winterling and was adopted next year. It is also known as humiture, according to Wikipedia contributors.

To compute this index, you need to know current temperature and relative humidity. An easy way to find both is by using an Arduino development board with a DHT sensor (DHT11, DHT22). These sensors measure temperature and humidity and send it to the microcontroller using a digital protocol. Thus, there is no need for calibration. You can read the values directly from the sensor module.

However, you should take into account that the accuracy of these sensors is not the best. DHT11 has an accuracy of +/-5% for humidity and +/-2 degrees Celsius for temperature. DHT22 (AM2302) is slightly better with an accuracy of +/-2% for humidity and +/-0.5 degrees Celsius for temperature. More than that, DHT22 has extended ranges for both temperature and humidity.

Compute Heat Index with Arduino and DHT Sensor

Audio Amplifier with Common Transistors

 Author:   Posted on:   Comments
Here is the schematic of a small audio amplifier that can provide up to 300mW to an 8 ohm load and can be used in low power devices like battery powered radios. This circuit can be an alternative to the LM386 IC. Due to the simplicity of the schematic, the circuit can be built also on breadboard, for those of you who want to experiment and learn how an amplifier works.

The design is straightforward. A common small signal NPN transistor (like BC547, 2N2222, 2N3904, S8050) drives a balanced power amplifier made of similar transistors. The output transistor pairs can be BC327 with BC337 or S8050 with S8550. They must handle peak currents of 300-400mA (this is why BC547/BC557 or 2N3904/2N3906 should not be used here).

The amplifier can be powered from a 9V battery or from a 12V power source. The circuit draws a current of about 170mA. The quiescent current is less than 10mA.

Audio amplifier with common transistors build on breadboard
Audio amplifier build on breadboard

Programming STM32 "blue pill" with HAL and Eclipse

 Author:   Posted on:   Comments
The "blue pill" is an STM32F103 based development board. Although it is less popular, the board is cheaper than an Arduino Nano. More than that, STM32F103 is a device with Cortex-M3 ARM CPU that runs at 72 MHz, 20 kB of RAM and 64 or 128 kB of flash memory. The microcontroller (MCU) has USB port, two serial ports, 16 bit PWM pins and 12 bit ADC pins. It runs at 3.3V, but some of its pins are 5V tolerant.

Unfortunately programming this board is not as easy as programming an Arduino board. There is a project named STM32duino aimed at simplifying things which makes use of Arduino IDE and similar programming language. But, STM32 is a complex CPU with more functions than Arduino language offers. You can program it using Eclipse IDE and a set of libraries offered by ST. These libraries are LL (low level), StdPeriph (standard peripheral library) and HAL (hardware abstraction library). HAL uses high level API which simplify developing an application. This post will show you how to configure the development environment and write the first program with HAL that will blink an LED.
Programming STM32 "blue pill" with HAL and Eclipse

CH341A SPI Programming (Windows API)

 Author:   Posted on:   Comments
CH341A is an USB interface chip that can emulate UART communication, standard parallel port interface, parallel communication and synchronous serial (I2C, SPI). The chip is manufactured by Chinese company Jiangsu QinHeng Ltd.

CH341A is used by some cheap memory programmers. The IC is somehow limited in this configuration, because the programmer makes use only of the SPI and I2C interface. A popular device is the so-called "CH341A MiniProgrammer" that you can buy for 2 to 5 USD. And this is probably the cheapest device using CH341A.

If you got a "MiniProgrammer", you may want to use for more than memory chips programming. The device can actually be used as USB to SPI converter (not only SPI, but this article will focus only on SPI function). Let's see how to use the included library and header to communicate with SPI peripherals.
CH341A SPI Programming (Windows API)

CD4017 and NE555 Light Chaser Circuit

 Author:   Posted on:   Comments
This is the classic circuit that uses NE555 timer and CD4017 counter to generate a sequence of pulses. If these pulses drive LEDs, a chaser can be built (also known as water flowing light). It can be used for entertainment purposes or for various light signaling. The following circuit uses 10 LEDs that turn on in a regular sequence. This is the maximum number of outputs. If you need less than 10 output channels, CD4017 features a reset pin that is connected to ground. The following output pin after the last used pin can be rewired to reset (after disconnecting it from ground). Thus, once the pulses sequence reaches the reset pin, CD4017 will start over again, limiting the number of output channels.

NE555 is configured as an astable multivibrator. Oscillation frequency is rather low for this application. It is determined by R1, R2+RV1 and C2. With the values used for this circuit, it can be adjusted between 10 and 65 Hz. The duty cycle is close to 50%. If you want to calculate it yourself, use this tool.
CD4017 and NE555 Light Chaser Circuit