You are on page 1of 35

INDUSTRIAL TRAINING REPORT

A report submitted in partial fulfilment of the requirements for


the Award of Degree of
BACHELOR OF TECHNOLOGY
In
ELECTRONICS AND COMMUNICATION ENGINEERING
By
SAGAR GARG
(10611502820)
Under Supervision of

Hexnbit Edtech Private Limited


(Duration: 1st August, 2022 to 10th September, 2022)

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


Bharati Vidyapeeth's College of Engineering, New Delhi.
Approved by AICTE, Affiliated with GGSIPU
2020– 2024
DECLARATION
(16 Times New
Roman)
I hereby declare that the
Industrial Training Report
on Name of the Department/
Section,
Industry is an authentic
record of my own work
as requirements of Minor/
Major
Industrial Training during
the period from _______
to_______ for the award of
degree of
1
B.Tech. (Mechanical
Engineering), O P Jindal
Institute of Technology,
Raigarh (C.G.),
under the guidance of
(Name of Faculty
Facilitator) (12 size)

(Signature of student)
(Name of Student)
(University Roll No.)
Date:
____________________

2
Certified that the above
statement made by the
student is correct to the
best of our
knowledge and belief

Examined by:
(Signature)
Name of Faculty Facilitator

(Signature)
Head of Departme

CANDIDATE'S DECLARATION

I, Sagar Garg hereby declare that I have undertaken 6 weeks of Industrial Training at
Hexnbit Edtech Private Limited during a period from August to September in partial
fulfilment of requirements for the award of degree of B. Tech (Electronics and
Communication Engineering) at Bharati Vidyapeeth's College of Engineering, Delhi.

3
The work which is being presented in the training report submitted to Department of
Electronics and Communication Engineering at Bharati Vidyapeeth's College of
Engineering, Delhi is an authentic record of training work.

________________ ____________________
______________________
Signature of HOD Signature of the Trainer Signature of the Student

ACKNOWLEDGEMENT

First, I would like to thank the Director of Hexnbit Edtech Private Limited for giving
me the opportunity to do my industrial training within the organization.

I also would like all the people that worked along with me in Hexnbit Edtech Private
Limited with their patience and openness they created an enjoyable working
environment.

4
It is indeed with a great sense of pleasure and immense sense of gratitude that I
acknowledge the help of these individuals.

I am highly indebted to founder Mr. Abhishek Gupta who guided me and my mentor
Mr. Satish for the facilities provided to accomplish this training.

I would like to thank my college and Head of the Department Prof. Kirti Gupta for
giving me this wonderful opportunity to do a training program in the first place.

I am extremely grateful to my department, staff members and friends who helped me


in successful completion of this industrial training.

_________________ ________________________ _______________________


Signature Of HOD Signature of the Trainer Signature of the
Student Sagar Garg
(10611502820)

5
CONTENTS

S.NO TOPIC PAGE NO.

1 ABSTRACT 4

2 LEARNING OBJECTIVES 5

3 WEEKLY OVERVIEW OF INTERNSHIP ACTIVITIES 6

4 INTRODUCTION TO EMBEDDED SYSTEMS 11

5 OVERVIEW OF INTERNET OF THINGS (IOT) 13

6 TECHNICAL DETAILS 15

7 TARGET BOARD NUCLEO MICROCONTROLLER 17


BOARD (STM-32)

8 PROJECT IMPLEMENTATION 19

9 SOURCE CODE 20

10 DATA SHEETS 28

11 CONCLUSION 30

12 REFERENCES 30

ABSTRACT
6
Embedded Software industry is the system of controlling numerous gadgets and
machines which might be specific from conventional computers, the usage of
software program engineering. Integrating software program engineering with non-
laptop gadgets results in the formation of embedded structures. Embedded structures
are normally famous in clinical science, client electronics, production science,
aviation, automobile technology. A traditional embedded gadget calls for a huge
variety of programming tools, microprocessors and working structures. Embedded
software program engineering, accomplished through embedded software program
engineers, desires to be tailor-made to the desires of the hardware that it has to
manipulate and run on.

The software program and working gadget necessities of an embedded gadget is


likewise specific from a conventional laptop primarily based totally gadget. Typically,
embedded structures use fundamental embedded gadget software program together
with C, C++, ADA, etc. Some specialized embedded structures might also
additionally use OS together with Windows CE, LINUX, TreadX, Nucleus RTOS,
OSE, etc.

Embedded software programs engineering differs from conventional utility


improvement in phrases of the extra attention to outside elements together with
temperature and different environmental elements that could have an effect on
performance.

Aim of the Training


In the training period we aim to get a basic understanding of the embedded systems.
Use of STM32-Nucleo F401RE board was the major part of my training program.
Wide range of Topics were covered in the training period like serial communication
protocols, ADC, DMA, various types of interrupts and a hint of IOT was also done in
the training period. We aimed to implement a temperature sensor with the NUCLEO
board and upload its data on a Thingspeak Server.

Organization Information
Hexnbit is an Ed-tech company founded in year 2020 which provides one-stop
solutions for the students & working professionals in Industry-connect Skill
development courses. The platform not only provides subject expertise to the
candidates but also, give them industry exposure to apply their learnings analytically
in a practical real-world.

Hex N Bit creates a bridge between Industry & Academia with its unique delivery
model involving Academicians, Faculty, Mentors, Industry & Students together on a
single platform. One of HexnBit’s biggest strengths is strong R&D and the process
which guide students in firming up their plans. Each student/professional can interact
with other peers, seniors/mentors and even universities/companies in order to make
the best decision for their career.

7
LEARNING OBJECTIVES IN TRAINING

 Knowledge of embedded systems.

 Knowledge of controller programming.

 STM32 based NUCLEO Development Board Basics

 Advanced ARM controllers programming.

 Gain understanding of ARM Cortex-M features and applications.

 Getting familiar with most frequently used peripherals for basic


applications.

 Architecture and protocols used in a 32-Bit microcontroller.

 Integration of microcontrollers with IOT

8
WEEKLY OVERVIEW OF INTERNSHIP ACTIVITIES

WEEK 1: -

Introduction to C Language Programming

* Basics Of C language

* Operators and Loops in C

* Functions in C

* Stack, Queues and Pointers in C

* Structures and Classes in C

* Pre-processors in C

WEEK 2: -

Introduction to ST Portfolio and Tools offered

* Overview of ST Microelectronics

* Registration over official website of ST Microelectronics

* Downloading & installing the required Hardware & Software Environment

Getting Started with Embedded System & ARM Architecture

* Introduction to Embedded Systems

* Types and Applications of Embedded Systems

* Getting to know about ARM & Its Architecture profile

* Features of ARM Cortex-M controllers

* Features of Controller manufactured by ST Microelectronics

9
Getting familiar with Target Hardware & Software Tools

* Introduction to ARM Cortex-M4 based NUCLEO development board (by ST)

* Getting familiar with the on-board components

* Detailed overview of STM32 CUBEMX Configuration Tool & STM32CUBE IDE

* Creating first project using the STM32CUBEMX & STM32CUBEIDE

WEEK 3: -
General Purpose Input / Output (GPIO)

* GPIO Overview in STM32F4 Board (Cortex-M4 Core)

* A brief discussion of registers involved in GPIO

* Configuration of GPIO as Output & Input mode

* Working with GPIO to read or write logic to a dedicated pin

Getting familiar with MCU Clocks & On-board Debugger

* Types of clock sources supported

* Introduction to Clock tree and its configuration

* Getting familiar with ST-Link debugger and its applications

* Additional features of ST-Link debugger

Nested Vector Interrupt Controller (NVIC)

* Getting familiar with exceptions handling

* Introduction to Nested Vector Interrupt Controller

* Exploring Interrupt Vector table & Interrupt priorities

* Getting to know software & hardware exceptions

* Working with external interrupts vector to perform desired operations

10
 WEEK 4: -

Analog to Digital Converter (ADC)

* Overview of Analog to Digital Converter

* Basic terminologies and process involved in ADC

* Features of ADC in STM32F4 controllers & Interrupts associated

* Working with external and internal channels of ADC

* Integrating analog sensors like temperature, pressure, accelerations etc.

Direct Memory Access Controller (DMA)

* Overview and needs for DMA Controller

* Data transfer mechanism of DMA

* Streams and Channels for DMA Requests

* Block diagram of DMA for data transfer

* Modes of DMA operations

* DMA implementation with ADC peripheral in STM32F4

Universal Synchronous Asynchronous Receiver and Transmitter


(USART)

* Overview of Serial Communications

* Difference between Synchronous & Asynchronous modes

* Applications of USART and USART Interrupts

* Pin outs and Hardware flow control signals in USART

* Frame format of USART

* Baud rate calculations using various parameters

* Working with data transmission and reception in STM32F4

* Interfacing Serial devices like Bluetooth or Wi-Fi module with STM32F4

11
Inter-Integrated Circuits (I2C or I Square C)

* Overview of I2C protocol and its features

* Getting familiar with I2C bus for data and clock

* Master and Slave configuration

* I2C Frame format and its components

* Device addressing modes offered by STM32F4

* Reading and writing data through slave devices

* Repeated start & Clock stretching features of I2C.

* Working with I2C to integrate slave device and read and write data

WEEK 5: -  
Timers in STM32F4

* Overview of Timers and its applications

* Different types of timers supported by STM32F4

* Various modes of Timers applications

* Working with Timers to generate programmable delay (Time Base)

* Implementing Timers to generate a programmable waveform (Output Compare)

* Utilizing Timers to measure the input signal (Input Capture)

* Generating waveform of varying pulse width (Pulse Width Modulation)

* Configuration of Timers to integrate range sensor like Ultrasonic

* Configuring Timers for brightness control of LED

Real Time Clock (RTC)

* Overview and application of RTC

* Features of RTC in STM32F4

* Configuration of Calendar and Time using internal RTC

12
* Generating Alarm event for time management activities

WEEK 6: -
Internet of Things (IoT)

* Overview of IoT and its application in real world

* Various IoT Platforms available for integration

* Protocols used in IoT

* Hardware used in IoT applications

* Working with Wi-Fi module to build internet connectivity to STM32F4

* Integrating IoT platform to host the sensors data over the web

13
INTRODUCTION TO EMBEDDED SYSTEMS

Embedded means something connected to something else. An embedded system can


be viewed as a computer hardware system with embedded software. An integrated
system can be a standalone system or part of a larger system. An embedded system is
a microcontroller or microprocessor-based system designed to perform a specific task.
For example, a fire alarm is an integrated system; It only detects smoke.

An embedded system consists of three components: It has hardware. It has application


software. It features the real-time operating system (RTOS) which monitors the
application software and provides a mechanism that allows the processor to schedule
a process to run according to a latency control plan. RTOS defines how the system
works.

It sets the rules during application program execution. A small embedded system may
not have an RTOS. Therefore, we can define an embedded system as a real-time,
reliable, software-driven control system based on a microcontroller.

Characteristics of an Embedded System

 Single-functioned − An embedded system usually performs a specialized


operation and does the same repeatedly. For example: A pager always
functions as a pager.

 Tightly constrained − All computing systems have constraints on design


metrics, but those on an embedded system can be especially tight. Design
metrics is a measure of an implementation's features such as its cost, size,
power, and performance. It must be of a size to fit on a single chip, must

14
perform fast enough to process data in real time and consume minimum power
to extend battery life.
 Reactive and Real time − Many embedded systems must continually react to
changes in the system's environment and must compute certain results in real
time without any delay. Consider an example of a car cruise controller; it
continually monitors and reacts to speed and brake sensors. It must compute
acceleration or de-accelerations repeatedly within a limited time; a delayed
computation can result in failure to control of the car.

 Microprocessors based − It must be microprocessor or microcontroller


based.

 Memory − It must have a memory, as its software usually embeds in ROM. It


does not need any secondary memories in the computer.

 Connected − It must have connected peripherals to connect input and output


devices.

 HW-SW systems − Software is used for more features and flexibility.


Hardware is used for performance and security.

Advantages
 Easily Customizable
 Low power consumption
 Low cost
 Enhanced performance

Disadvantages
 High development effort
 Larger time to market

15
Basic Structure of an Embedded System

The following illustration shows the basic structure of an embedded system –

 Sensor − It measures the physical quantity and converts it to an electrical


signal which can be read by an observer or by any electronic instrument like
an A2D converter. A sensor stores the measured quantity to the memory.

 A-D Converter − An analog-to-digital converter converts the analog signal


sent by the sensor into a digital signal.

 Processor & ASICs − Processors process the data to measure the output and
store it to the memory.

 D-A Converter − A digital-to-analog converter converts the digital data fed


by the processor to analog data.

 Actuator − An actuator compares the output given by the D-A Converter to


the actual (expected) output stored in it and stores the approved output.

Overview Of Internet of Things (IOT)

The Internet of Things (IoT) describes the network of physical objects— “things”—
that are embedded with sensors, software, and other technologies for the purpose of
connecting and exchanging data with other devices and systems over the internet.
Over the past few years, IoT has become one of the most important technologies of
the 21st century. Now that we can connect everyday objects—kitchen appliances,
cars, thermostats, baby monitors—to the internet via embedded devices, seamless
communication is possible between people, processes, and things.

By means of low-cost computing, the cloud, big data, analytics, and mobile
technologies, physical things can share and collect data with minimal human
intervention. In this hyperconnected world, digital systems can record, monitor, and

16
adjust each interaction between connected things. The physical world meets the
digital world—and they cooperate.

Main components used in IoT: 

 Low-power embedded systems: Less battery consumption, high performance


are the inverse factors that play a significant role during the design of
electronic systems. 
 Sensors: Sensors are the major part of any IoT applications. It is a physical
device that measures and detect certain physical quantity and convert it into  
signal which can be provide as an input to processing or control unit for
analysis purpose.

Different types of Sensors:


1. Temperature Sensors
2. Image Sensors
3. Gyro Sensors
4. Obstacle Sensors
5. RF Sensor
6. IR Sensor
7. MQ-02/05 Gas Sensor
8. LDR Sensor
9. Ultrasonic Distance Sensor

APPLICATIONS

Embedded systems in IoT are used in home automation, health and wellness, and
security, among others. Likewise, an embedded system in IoT is used in remote
sensing and control for water, gas, utility meters, shipping/transportation
management, robotics integration, and so on. Any IoT device will have an embedded
system. IoT is nothing but connecting and controlling smart devices (read as
embedded systems coupled with network connectivity) through Internet protocols.

There are many things with embedded systems incorporated in the Internet of Things
(IoT), as well as in machine to machine (M2M) devices. Exceptionally versatile and

17
adaptable, embedded systems can be found in all smart devices today. It is difficult to
find a single portion of modern life that doesn’t involve this technology.

Here are some of the real-life examples of embedded system applications. 


 Central heating systems
 GPS systems
 Fitness trackers
 Medical devices
 ATMs
 Factory robots
 Electric vehicle charging stations

TECHNICAL DETAILS

 Serial Communication Protocols

Serial communication is a communication method that uses one or two transmission


lines to send and receive data, and that data is continuously sent and received one bit
at a time. Since it allows for connections with few signal wires, one of its merits is its
ability to hold down on wiring material and relaying equipment costs.

We learned two serial communication protocols in detail namely USART/UART and


I2C.

UART/USART

In Universal synchronous/Asynchronous communication unlike I2C it is a physical


circuit and not a protocol. Two UARTs communicate directly with each other. The
transmitting UART converts parallel data from a controlling device like a CPU into
serial form, transmits it in serial to the receiving UART, which then converts the
serial data back into parallel data for the receiving device. Only two wires are needed
to transmit data between two UARTs. Data flows from the Tx pin of the transmitting
UART to the Rx pin of the receiving UART.

ADVANTAGES
 Only uses two wires
 No clock signal is necessary
 Has a parity bit to allow for error checking
 The structure of the data packet can be changed as long as both sides are set up
for it
 Well documented and widely used method

DISADVANTAGES
 The size of the data frame is limited to a maximum of 9 bits
 Doesn’t support multiple slave or multiple master systems
 The baud rates of each UART must be within 10% of each other

18
I2C Protocol
Inter-Integrated Circuits protocol (I2C) protocol allows embedded engineers to
connect multiple slave devices with one or more master. It is intended primarily for
short-distance communication within two ICs (Integrated Circuits) on the same
printed circuit board (PCB). It requires only two bi-directional wires for transmitting
and receiving data bits. In terms of data rates, the I2C protocol supports speed up to
3.4 Mbps - which is pretty fast.

Here are some of the important advantages of using the I2C protocol:

 Flexibility of using multiple master devices to speed up communication and


improve the design functionality
 Chip addressing eliminates the need of CS (Chip Select) Lines
 Supports a robust error handling mechanism with the ACK/NACK feature.

Uses of the I2C Protocol:


 Changes the various color setting, such as hue, on a monitor.
 Controls the LED/LCD displays in cell phones
 Helps switching on /off the power supply of internal components

 Direct Memory Access (DMA)

A direct memory access (DMA) unit is a digital logic element in computer


architecture that can be used in conjunction with the main microprocessor on the same
chip to offload memory transfer operations. This significantly reduces the load on the
CPU. the DMA controller can perform memory-to-memory data transfers as well as
peripheral-to-memory data transfers or vice versa. The presence of DMA with a CPU
can speed up its performance by orders of magnitude.

Direct memory access (DMA) is used in order to provide high-speed data transfer
between peripherals and memory as well as memory to memory. Data can be quickly
moved by DMA without any CPU actions. This keeps CPU resources free for other
operations.

19
 INTERRUPTS

Interrupts are the events that temporarily suspend the main program, pass the control
to the external sources and execute their task. It then passes the control to the main
program where it had left off.

In STM32 there are a lot of different types of interrupts. Interrupts on STM32 MCUs
come in two variants: internal and external. Both types of interrupts use the same core
peripheral in the Cortex-M core: the Nested Vectored Interrupt Controller, or NVIC.
Depending on the exact Cortex-M core, this peripheral can support hundreds of
interrupts, with multiple priority levels. Lower the pre-emption priority the higher the
priority of the task will be.

Target Board NUCLEO Microcontroller Board (STM-32)

20
The STM32 Nucleo-64 board provides an affordable and flexible way for users to try
out new concepts and build prototypes by choosing from the various combinations of
performance and power consumption features, provided by the STM32
microcontroller.

Our target NUCLEO board in the training was the NUCLEO-F401RE.

Some features of this board are: -

The ARDUINO Uno connectivity support and the ST morpho headers allowed easy
expansion of the functionality of the STM32 NUCLEO open development platform
with a wide choice of specialized shields.

The STM32 Nucleo-64 board does not require any separate probe as it integrates the
ST-LINK debugger/programmer.

The STM32 Nucleo-64 board comes with the STM32 comprehensive free software
libraries and examples available with the STM32Cube MCU Package.

NUCLEO-F401RE
Other Components:

Apart from the NUCLEO board we also utilized other components such as WIFI-
module to connect to the server, breadboard for making connections and jumpers
wires.

We also used many other sensors such as temperature sensor, Bluetooth module etc
while learning the basic features such as ADC, DMA, interrupts on the board.

21
REQUIREMENTS
Software Requirements:

1. STM32 Cube IDE v1.10.1


2. Thingspeak

Hardware Requirements:

1. NUCLEO-F401RE
2. ESP-01 WIFI Module
3. DS1621 Temperature Sensor IC
4. Breadboard
5. Jumper Cables

PROJECT IMPLEMENTATION

1. A code was written in STM32 Cube IDE in which DS1621 was integrated
with F401RE using I2C protocol.

2. The resulting temperature data processed by the board is then transmitted to


the WIFI-Module which then uploads the data to the Thingspeak Server.

3. After that we can monitor the temperature of a point being anywhere in the
world as it is uploaded onto the server.

22
Pin Configuration

SOURCE CODE

/* USER CODE BEGIN Header */


/**

***********************************************************************
*******
* @file : main.c
* @brief : Main program body

***********************************************************************
*******
* @attention
*
* <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause
license,
* the "License"; You may not use this file except in compliance with
the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*

***********************************************************************
*******
*/
/* USER CODE END Header */
/* Includes
------------------------------------------------------------------*/
#include "main.h"

23
/* Private includes
----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "string.h"
/* USER CODE END Includes */

/* Private typedef
-----------------------------------------------------------*/
/* USER CODE BEGIN PTD */

/* USER CODE END PTD */

/* Private define
------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */

/* Private macro
-------------------------------------------------------------*/
/* USER CODE BEGIN PM */

/* USER CODE END PM */

/* Private variables
---------------------------------------------------------*/
ADC_HandleTypeDef hadc1;

UART_HandleTypeDef huart1;

/* USER CODE BEGIN PV */

char Response[50];
float nosteps,stepsize=3.3/4096,voltage,temp;

/* USER CODE END PV */

/* Private function prototypes


-----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_USART1_UART_Init(void);
static void MX_ADC1_Init(void);
/* USER CODE BEGIN PFP */

/* USER CODE END PFP */

/* Private user code


---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
void clr_array()
{
for (int i=0; i<49; i++)
Response[i] = '\0';
}
/* USER CODE END 0 */

24
/**
* @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();
MX_ADC1_Init();
/* USER CODE BEGIN 2 */

HAL_ADC_Start(&hadc1);

// commands to test the Wi-Fi startup connection


HAL_UART_Transmit(&huart1, (uint8_t *)"AT\r\n",sizeof("AT\r\n"),
100);
HAL_UART_Receive(&huart1, (uint8_t *)Response,sizeof(Response), 200);
clr_array();
HAL_Delay(1000);

// command to set the operating mode of Wi-Fi mosule


HAL_UART_Transmit(&huart1, (uint8_t *)"AT+CWMODE=1\r\
n",sizeof("AT+CWMODE=1\r\n"), 200);
HAL_UART_Receive(&huart1, (uint8_t *)Response,sizeof(Response), 200);
clr_array();
HAL_Delay(1000);

// command to connect the nearest access point using SSID & Password
HAL_UART_Transmit(&huart1, (uint8_t
*)"AT+CWJAP=\"Mystery\",\"qwerty@123\"\r\n",

sizeof("AT+CWJAP=\"Mystery\",\"qwerty@123\"\r\n"), 200);

25
HAL_UART_Receive(&huart1, (uint8_t *)Response,sizeof(Response),
1000);
//clr_array();
HAL_Delay(1000);

/* USER CODE END 2 */

/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{

HAL_ADC_PollForConversion(&hadc1,300);
nosteps = HAL_ADC_GetValue(&hadc1);

temp=(((nosteps*stepsize)-0.76)/0.025)+25;
for (int i=0; i<49; i++)
Response[i] = temp;

/*command to update data over thingspeak.com*/


char get_cmd[] = "GET /update?
api_key=SHVLTX7DW6KQB749&field1=82";
uint16_t cmd_length = strlen(get_cmd);

/*Initiating the TCP/IP connection for thingspeak.com over


http port*/
HAL_UART_Transmit(&huart1, (uint8_t
*)"AT+CIPSTART=\"TCP\",\"api.thingspeak.com\",80\r\n",

strlen("AT+CIPSTART=\"TCP\",\"api.thingspeak.com\",80\r\n"), 1000);
HAL_UART_Receive(&huart1, (uint8_t
*)Response,sizeof(Response), 1000);
clr_array();
HAL_Delay(1500);

/* sending the data size to be inserted in the update


command*/
HAL_UART_Transmit(&huart1, (uint8_t *) "AT+CIPSEND=51\r\n\
r\n", strlen("AT+CIPSEND=51\r\n\r\n"), 1000);
HAL_UART_Receive(&huart1, (uint8_t
*)Response,sizeof(Response), 1000);

/* sending the update command over thingspeak server*/


HAL_UART_Transmit(&huart1, (uint8_t *) &get_cmd,
cmd_length, 1000);
HAL_UART_Transmit(&huart1, (uint8_t *) "\r\n", strlen("\r\
n"), 1000);
HAL_UART_Receive(&huart1, (uint8_t
*)Response,sizeof(Response), 1000);
HAL_Delay(1500);
clr_array();

/*closing the TCP/IP connection after sending the data*/


HAL_UART_Transmit(&huart1, (uint8_t *) "AT+CIPCLOSE\r\n",
strlen("AT+CIPCLOSE\r\n"), 1000);

26
HAL_UART_Receive(&huart1, (uint8_t
*)Response,sizeof(Response), 1000);
HAL_Delay(1500);
clr_array();

/* USER CODE END WHILE */

/* USER CODE BEGIN 3 */


}
/* USER CODE END 3 */
}

/**
* @brief System Clock Configuration
* @retval None
*/
void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

/** Configure the main internal regulator output voltage


*/
__HAL_RCC_PWR_CLK_ENABLE();
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);

/** Initializes the RCC Oscillators according to the specified


parameters
* in the RCC_OscInitTypeDef structure.
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
RCC_OscInitStruct.PLL.PLLM = 16;
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
RCC_OscInitStruct.PLL.PLLQ = 7;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}

/** Initializes the CPU, AHB and APB buses clocks


*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;

if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) !=
HAL_OK)
{

27
Error_Handler();
}
}

/**
* @brief ADC1 Initialization Function
* @param None
* @retval None
*/
static void MX_ADC1_Init(void)
{

/* USER CODE BEGIN ADC1_Init 0 */

/* USER CODE END ADC1_Init 0 */

ADC_ChannelConfTypeDef sConfig = {0};

/* USER CODE BEGIN ADC1_Init 1 */

/* USER CODE END ADC1_Init 1 */

/** Configure the global features of the ADC (Clock, Resolution, Data
Alignment and number of conversion)
*/
hadc1.Instance = ADC1;
hadc1.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4;
hadc1.Init.Resolution = ADC_RESOLUTION_12B;
hadc1.Init.ScanConvMode = ENABLE;
hadc1.Init.ContinuousConvMode = ENABLE;
hadc1.Init.DiscontinuousConvMode = DISABLE;
hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
hadc1.Init.NbrOfConversion = 1;
hadc1.Init.DMAContinuousRequests = DISABLE;
hadc1.Init.EOCSelection = ADC_EOC_SEQ_CONV;
if (HAL_ADC_Init(&hadc1) != HAL_OK)
{
Error_Handler();
}

/** Configure for the selected ADC regular channel its corresponding
rank in the sequencer and its sample time.
*/
sConfig.Channel = ADC_CHANNEL_0;
sConfig.Rank = 1;
sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN ADC1_Init 2 */

/* USER CODE END ADC1_Init 2 */

28
}

/**
* @brief USART1 Initialization Function
* @param None
* @retval None
*/
static void MX_USART1_UART_Init(void)
{

/* USER CODE BEGIN USART1_Init 0 */

/* USER CODE END USART1_Init 0 */

/* USER CODE BEGIN USART1_Init 1 */

/* USER CODE END USART1_Init 1 */


huart1.Instance = USART1;
huart1.Init.BaudRate = 9600;
huart1.Init.WordLength = UART_WORDLENGTH_8B;
huart1.Init.StopBits = UART_STOPBITS_1;
huart1.Init.Parity = UART_PARITY_NONE;
huart1.Init.Mode = UART_MODE_TX_RX;
huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart1.Init.OverSampling = UART_OVERSAMPLING_16;
if (HAL_UART_Init(&huart1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN USART1_Init 2 */

/* USER CODE END USART1_Init 2 */

/**
* @brief GPIO Initialization Function
* @param None
* @retval None
*/
static void MX_GPIO_Init(void)
{

/* GPIO Ports Clock Enable */


__HAL_RCC_GPIOH_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();

/* USER CODE BEGIN 4 */

/* USER CODE END 4 */

/**
* @brief This function is executed in case of error occurrence.
* @retval None

29
*/
void Error_Handler(void)
{
/* USER CODE BEGIN Error_Handler_Debug */
/* User can add his own implementation to report the HAL error return
state */

/* USER CODE END Error_Handler_Debug */


}

#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line
number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t *file, uint32_t line)
{
/* USER CODE BEGIN 6 */
/* User can add his own implementation to report the file name and
line number,
tex: printf("Wrong parameters value: file %s on line %d\r\n",
file, line) */
/* USER CODE END 6 */
}
#endif /* USE_FULL_ASSERT */

OUTPUT

30
DATASHEET FOR F401RE

31
DATASHEET FOR DS1621 IC

32
CONCLUSION

Embedded systems are emerging as a technology with high potential. In the past
decades microprocessor based embedded system ruled the market. The last decade
witnessed the revolution of Microcontroller based embedded systems. With regards to
the requirements gathered the manual work and the complexity in counting can be
achieved with the help of electronic devices.

The project that I did made me learn a lot about 32-bit microcontrollers. The project
has been successfully designed and tested. Integrating features of all the hardware
components used have developed it. Presence of every module has been reasoned out
and placed carefully thus contributing to the best working of the unit. Secondly, using
highly advanced IC’s and with the help of growing technology the project has been
successfully implemented.

Overall, the industrial training was really informative. The content that we got to learn
was of industry standard. The STM32 NUCLEO board that we worked on was really
powerful too. It is widely used in the industry and even has military applications.

REFERENCES
 Hexnbit LMS Portal
 "STM32 Arm Cortex MCUs - 32-bit Microcontrollers - STMicroelectronics" . www.st.com.
  "Cortex-M4".  developer.arm.com
  "STMicroelectronics Delivers New 32-bit ARM® Cortex™ Microcontrollers for Projects
Needing Digital Signal Control at Competitive Cost".  web.archive.org
 "STM32F4 - ARM Cortex-M4 High-Performance MCUs -
STMicroelectronics". www.st.com.

33
  "ARM and STMicroelectronics Join With Mathworks to Enable Code Generation, Debug
and Modelling For STM32 Microcontrollers"
 Gillis, Alexander (2021). "What is internet of things (IoT)?". IOT Agenda.
 Brown, Eric (20 September 2016). "21 Open Source Projects for IoT". Linux.com.

34

You might also like