Posted on — Leave a comment

Blown LM358P due to transients

An LM358p is a dual opamp IC which I used in a single supply configuration. I drive the LM358 just shy of its absolute maximum voltage which is +30V. So I gave I supplied 28.8V (+-0.1V). It works flawless but the power supply is a Meanwell switching supply which introduces transient when plugging into the mains supply.

The transient arise when I was plugging in the AC wire to the mains. I used an anchor 6A 3-pin male plug for connection. It was at the brief moment when the transient arise.

The transient which arises apparently has enough power that it blew the epoxy off the silicon and it did with a loud bang.

Blown LM358P due to transients

Doing rough calculation at the moment this happened

Let’s say the transient is double the supply voltage of = 2 x 28.9 V= 57.8V

let’s say the current drawn by the IC is 40mA which is its absolute maximum.

power = voltage x current = 57.8V x 40mA = 2.312W

so for a brief moment, this 2W is radiated by the silicon chip. Which caused the heating up of the epoxy and generating enough expanding force which blew out like that.

but let’s take a more reasonable transient voltage(ISO 7637-2: 2011) of approximately 110V at a rise time of 0.5uS.

so power = 110V x 40mA = 4.4W .

Posted on — Leave a comment

FAKE BD139 NPN transistors

I have recently found out that there are FAKE transistors in the market. I have a built a circuit design and when I bought the transistor from the Lajpat rai market in Delhi; I assembled the circuit on a test bench for measurements. But I was surprised that the BD139 did not work with 10mA at 30V and they began overheating. They heat up so much that bubbles appear on the front epoxy and it cracked. I thought that maybe it was damaged so I replaced the whole circuit with a new transistor set. But they also didn’t hold and this time they burnt a resistor along with them. I saw flames engulfing the 1/4 Watt resistors.

So I again made the circuit using the minuscule BC546B. Which neither get warm nor went into thermal runaway.

on the BD139 it was marked that it was manufactured by NXP. And I then checked the NXP website and found out that the NXP closed its manufacturing of this transistor in 2001.

There are a lot of BD139 transistors circulating in the market. It is essential that you must buy from a good source.

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

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.