Posted on Leave a comment

How to generate custom fonts for LCD display

There are various tools to generate font style for LCD display.

  1. Write your own fonts style. But this is will become hectic if you have a larger font size.
  2. Software tool
    1. The Dot Factory by Eran Duchan
    2. GLCD Font Creator

I like “The Dot Factory” font creation tool. It is minimalistic and gets the job done.

Here is the link to the Github page for The Dot Factory https://github.com/pavius/the-dot-factory

Posted on Leave a comment

15V Unregulated DC Power Supply using 12Vrms step-down transformer

There are two ways to make DC power supply

  1. Linear
  2. Switching

Linear Power Supply
Continous control of voltage is done at any instance of time. It uses a pass transistor with an error amplifier to regulate the voltage supply.
example: 7805, 7905, LM317 etc

Switching Power Supply
It also uses the pass transistor along with an inductor and a capacitor to store the energy and release the energy. By controlling the switching of the pass transistor, the Voltage is regulated. It is more complex than the linear power supply.
The advantage of switching is that the transformer size gets reduced. Which reduced the cost of the power supply. The Reduced size also reduced the weight; which further increases the portability of the power supply.

[ A C Mains ] -> [StepDown Transformer] -> [Bridge Rectifier] -> [Filter] -> [Unregulated DC]

I am using a step-down transformer. Which transformer 220V 50Hz AC to 12 Vrms AC.

The Vrms is converted to Vdc which is dc equivalent voltage.

So, 12 Vrms = 12 x 1.414 Vdc

= 16.968 (approx.) Vdc

this Vdc is passed through the bridge rectifier which drops 1.5V to 1.8V

= 16.968 – 1.8

= 15.168 V

which is then filtered through the Capacitor filter

C = ( I x t ) / V

I is the amount of current passing through the capacitor at maximum load.

Let I = 1A

t is the ripple time which is taken 10 mS if using 50Hz cycles.

C = [1 x 10 x 10^(-3) ] / 15.168

= 6.59 x 10^(-4) F

= 659 micro Frad

So we will use a standard capacitor that is either equal to or bigger than the above value i.e 1000uF will OK.

Posted on Leave a comment

STM32F429I-DISC1

Datasheet for stm32F429ZI https://www.st.com/en/microcontrollers-microprocessors/stm32f429zi.html

This board have a 2.4 Resistive touch TFT LCD. which uses the ILI9341  controller.

The touch screen which I got with this display is very bad. you have to press down on the screen before you power ON the device.

The microcontroller is based on the ARM CORTEX M4F which can be clocked up to 180MHz. This particular board has an 8Mbyte of SDRAM included which is basically useless with this screen. If you want to see the full potential you have to use the LTDC peripheral which when configured with DMA2D gives you a very powerful development board with multimedia capabilites.

Posted on Leave a comment

STM32F746IGT6 – An ARM CORTEX M7 Based Microcontroller

Datasheet

It’s an ARM Cortex M7 based microcontroller which has a maximum clock speed of 216Mhz.

Well, it has a few peripherals which when combined with its CPU, makes it a very powerful controller.

Those peripherals are LTDC, SDRAM Controller.

It also has the usual set of peripherals from the ST. But these in particular makes it a very powerful microcontroller.

Posted on Leave a comment

Do not connect microcontroller pins to the VGA monitor directly

I tried to generate VGA signal on stm32f103

I used two timers, the TIMER 2 generate the horizontal sync and then the second timer TIMER 3 is configured in gated slave mode which generates the vertical sync.

Then I used HAL_SPI_TRANSMIT_DMA function inside the timer 2 interrupt handler.

I in a hurried manner connected the video signal to the monitor directly. And that has burned the image onto the monitor.

I connected the green video signal directly from the stm32f103 to the VGA connector.

image is now burned in the monitor.

Posted on 4 Comments

SIMcom A7670c LTE Module with UART

This module can be used with Indian 4G bands. This means it can be used with Vodafone, Airtel or Jio networks.

This module comes preconfigured with AT commands.

The module offers UART to issue commands.

Since the communication speed is really high so the 3.3V and 5V UART lines can not be used for communication with the board.

The company offers technical documents on hardware design for the UART.

Here is the circuit I am using for converting the 1.8V to 5V using the BC547 NPN BJT transistor.

I connected the UART on the module to a USB-to-Serial convertor.

I can then use AT commands to control the module functions like call, SMS, data etc.

Here is the basic AT commands

  • For making calls,SMS or data etc from the module you will need a Registered SIM card
  • For making calls from module
    ATDxxxxxxxxxx;
    x’s are your telephone number
    semi colon must be inserted at the end
  • For issuing DTMF tones
    AT+VTS=[number],[duration]
    Example: DTMF tone for digit 8
    AT+VTS=8,500
  • For Receiving Incoming Calls
    ATA
  • For Disconeccting On-going call
    AT+CVHU=0
    ATH
  • For Sending SMS
    AT+CMGF=1
    AT+CMGF=”+[country ISD code][Mobile number]”
    after sending the above commands you can send your message.
    At the end of your message you need to send number 26 (hex 1A) to mark the end of your message.
Posted on Leave a comment

Raspberry Pi Pico

This board is using an RP2040 microcontroller. Which is using a dual-core arm cortex m0+ processor. The speed of the clock signal can be changed on the fly up to 133MHz.

The Pico board is castellated so that you can mount this board directly on your PCB. This board also has options for mounting male/female headers. which is handy for prototyping on a breadboard.

It can be programmed using micropython and ‘C’ programming language.

Raspberry Pi Pico datasheet
Getting started with Raspberry Pi Pico: C/C++ development
Raspberry Pi Pico C/C++ SDK
Raspberry Pi RP2040 datasheet
Hardware design with RP2040

Technical Specifications

21 mm × 51 mm form factor
RP2040 microcontroller chip designed by Raspberry Pi in the UK
Dual-core Arm Cortex-M0+ processor, flexible clock running up to 133 MHz
264KB on-chip SRAM
2MB on-board QSPI Flash
26 multifunction GPIO pins, including 3 analogue inputs
2 × UART, 2 × SPI controllers, 2 × I2C controllers, 16 × PWM channels
1 × USB 1.1 controller and PHY, with host and device support
8 × Programmable I/O (PIO) state machines for custom peripheral support
Supported input power 1.8–5.5V DC
Operating temperature -20°C to +85°C
Castellated module allows soldering direct to carrier boards
Drag-and-drop programming using mass storage over USB
Low-power sleep and dormant modes
Accurate on-chip clock
Temperature sensor
Accelerated integer and floating-point libraries on-chip

Getting Started with MicroPython on Raspberry Pi Pico using Thonny IDE

Posted on 3 Comments

Mini STM32 V3.0

This development board has an STM32F103RB microcontroller. In this development board,

  • 8 Mhz Crystal
  • 32.768 Khz Crystal
  • 2.8 inch TFT-LCD Touch screen.
    The screen is a TFT-LCD Panel driven by the ili9325 driver.
  • PL2303 USB to Serial IC
  • User Programmable USB port
  • battery holder
  • Potentiometer
  • JTAG Port for debug and programming
  • 2 User programmable LED (both Red Colour)
  • 2 User configurable Push button
  • Boot 0 Button
  • Reset Button
  • AMS117 3.3 V LDO

Mini STM32 Schematic Diagram

2.8 inch TFT LCD Schematic

You can develop a program for this board using Keil, IAR or STM32 Cube IDE

You can program the microcontroller by holding the BOOT0 button and then while holding the boot button pressing the RESET button.
Which enable you to program the microcontroller using UART.

You will need STM32 Cube Programmer to upload hex files into the microcontroller

You can also program the Board using the JTAG port.

You can use the below application note for that.

How to use the ST-LINK/V2-1 in STM32L476G-DISCO Board to program the STM32 on an external application board

How To / Guides

Posted on Leave a comment

How to redirect printf() to USART in STM32f103RB using STM32Cube IDE

Printf() function can be redirected to USART and also towards SWO.

Here you will see how to redirect printf() to USART in STM32f103RB

You need to rewrite this code in your main.c file

/*
* Function Name: _write
* Function Description: Redirect the printf() statement towards the UART using the HAL_UART_Transmit
Author: Abhay

*/
int _write(int fd, char* ptr, int len) {
    HAL_UART_Transmit(&huart1, (uint8_t *) ptr, len, HAL_MAX_DELAY);
    return len;
}

If you have created your project using STM32CubeMX or STM32 Cube IDE, then you can rewrite it in between USER CODE BEGIN 0 as shown

/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
int _write(int fd, char* ptr, int len) {
    HAL_UART_Transmit(&huart1, (uint8_t *) ptr, len, HAL_MAX_DELAY);
    return len;
}
/* USER CODE END 0 */

/**
  * @brief  The application entry point.
  * @retval int
  */
int main(void)
{
  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration--------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* USER CODE BEGIN Init */

  /* USER CODE END Init */

  /* Configure the system clock */
  SystemClock_Config();

  /* USER CODE BEGIN SysInit */

  /* USER CODE END SysInit */

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_USART1_UART_Init();
  /* USER CODE BEGIN 2 */
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */

  while (1)
  {
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */

  }
  /* USER CODE END 3 */
}

After adding the code, connect the uart to your laptop or computer using serial to USB adapter and open serial Terminal application like YAT.
Then you will be able to see printf message over there.

Posted on Leave a comment

How to use the ST-LINK/V2-1 in STM32L476G-DISCO Board to program the STM32 on an external application board

Here is the video showing all the steps.

ST-Link V2-1 on STM32L476G-Disco Board

To use the ST-LINK/V2-1 to program the STM32 on an external application board (out of the STM32L476VGT6 onboard), remove the two jumpers from CN3 as shown in the above figure in red, and connect the board to the CN4 software debug connector according to Table.
Make sure the jumpers JP6.3V3, and JP5.OFF are set.
JP3, must be ON if CN4 pin 5 (NRST) is used in the external application board.

PinCN4 FunctionJTAG PIN NumberJTAG NameNote
1VappVDD from ApplicationDo not Connect Vapp to JTAG.
2SWCLKSWD Clock9TCK
3GNDGround1 to 9GND
4SWDIOSWD data input/output7TMS
5NRSTRESET of target MCU15nSRST
6SWORESERVED

Note: Do not connect Vapp to JTAG on the external board unless you know about the power domain of the external board.
Power the board separately.

You can use STM32CubeProgrammer to read the memory and also write the hex file into the microcontroller.

Here I am using mini stm32 v3.0 as an example.

The mini stm32 v3.0 has an STM32F103RB microcontroller along with a JTAG interface for programming and debugging.