Electronics Miscellaneous

DESIGNING STEPS OF PCB

Hello Friends, This is the second blog of the series of PCB designing. Today we are discussing Steps for PCB Designing, Types of Component and methods for mounting components onto a PCB and designing steps. So before discussing the Method for Mounting Components on PCB, first we will discuss the process or different stages of PCB designing. In order to design a PCB, one has to follow below steps : 1. Create the schematic 2. Link footprints to the components in the schematic 3. Generate a netlist 4. Create desired PCB shape in PCB editor 5. Import the netlist in PCB editor 6. Define design rules 7. Place the footprint of the component at desired location 8. Route the tracks to form electrical connections       between various components 9. Add labels and identifiers on PCB 10. Generate design file Types of Components and Its Symbol :- So these are some symbols that are used to prepare the schematic. Methods for mounting components onto a PCB. 1. Through Hole: Through-hole components are best used for high-reliability products that require stronger connections between layers. Through-hole component leads run through the board, allowing the components to withstand more environmental stress. This is why through-hole technology is commonly used in military, automobile, and aerospace products that may experience extreme accelerations, collisions, or high temperatures. Through-hole technology is also useful in test and prototyping applications that sometimes require manual adjustment and replacement. 2. SMD (surface-mount devices): SMD components are much smaller than THM components. This will increase the overall density of the board tremendously. Using a Pick and Place machine for placing the components will reduce production time.SMD components are mostly cheaper compared to THM components. surface-mount devices (SMDs) are secured only by solder on the surface of the board SMD components are not suitable for prototyping or testing of small circuits. SMDs cannot be used directly with breadboards SMD solder connections may be damaged by potting compounds going through thermal cycling. EasyEDA Online Tool We will start from EasyEDA, a great web-based EDA(Electronics Design Automation) tool for electronics engineers, educators, students, makers, and enthusiasts. There is no need to install any software. Just open EasyEDA in Browser. EasyEDA Provides: Simple, Easy, Friendly, and Powerful drawing capabilities Works Anywhere, Anytime, on Any Device Real-time Team Cooperation Sharing Online Thousands of open-source projects Integrated PCB fabrication and Components purchase workflow API provided Script support Schematic Capture PCB Layout: Design Rules Checking(DRC) Multi-Layer, 6 copper layer supported Document export(PDF, PNG, SVG) Altium Designer format export BOM export 3D View Generate fabrication file(Gerber) Export Pick and Place file Auto Router Designing Steps Open EasyEDA Tool On Browser Register in EasyEDA Create New Project Draw Schematic Convert that file into BoARD FILE Track the air wire Select needed layers Print the Document Summary In this second blog, we introduced designing steps. Then we discussed the method of mounting components. Introduced the Easyeda Online tool. Reference : https://payatu.com/blog/rupesh/PCB%20Designing%20-%20Basics https://blog.thedigisource.com/through-hole-smt https://www.vishay.com/docs/45242/throughholevssmdcomponents.pdf https://eprpartner.com/through-hole-vs-surface-mounted https://docs.easyeda.com/en/Introduction/Introduction-to-EasyEDA/index.html https://circuitdigest.com/article/design-electronic-circuits-online-with-easyeda

Tech

Overview of Programming languages

Compiled language: are translated to the target machine\’s native language by a program called a compiler. This can result in very fast code, especially if the compiler is effective at optimizing however the resulting code may not port well across the operating system & the compilation process may take a while e.g C or CPP. Interpreted Language: is read by a program called an interpreter & is executed by that program called an interpreter and is executed by that program. While they are portable as their interpreter & have no long compile times. e.g Python & Java. High-Level Programming: Refers to how much the nature of language reflects the understanding system. In other words, a programming language level refers to how similar the language is to a computer\’s native language. Low-Level language is generally quite similar to machine code & thus is more suitable for programs like device drivers or very high-performance programs that really need access to hardware. Since a low-level language is subject to all the nuances of the hardware it\’s accessing. Supported Paradigm:      

AVR MCU Embedded MCU's

Starting Up with AVR

Table of Contents Introduction AVR stands for a Alf and Vegard’s RISC processor and is a microcontroller. Microcontroller is like a mini computer or a processor dedicated for a particular task. We can code AVR using C, C++ or Assembly language. AVR PINOUT Brief description of AVR pins Pin 1 – Pin 8 (PB0 – PB7): General Input / Output pins used as GPIOs i.e. General purpose Input-Output. Pin 9: It is a reset pin and resets the microcontroller. The bar above the RESET represents that it is active low i.e. when the reset pin is grounded then it resets the microcontroller. Pin 10, Pin 11 (Power Supply): These pins are used to give power to the microcontroller. We give a positive line to the VCC (Pin 10) and ground to GND (Pin 11). Generally, 5V is given as input. Pin 12, Pin 13 (Crystal Oscillator) : These pins are used to connect a crystal oscillator with AVR to give it an external clock. Pin 14 – Pin 21 (PD0 – PD7) : General Input / Output pins used as GPIOs i.e General purpose Input Output. Pin 22 – Pin 29 (PC0 – PC7) : General Input / Output pins used as GPIOs i.e General purpose Input Output. Pin 30 (AVCC) : It is used to provide power to Analog to Digital Converter of AVR. Also provides immunity to noise while conversion. Pin 31 (GND) : It is a common ground provided to be used. Pin 32 (AREF) : It is used to give a reference voltage to Analog to digital converter of AVR. Pin 33 – Pin 40 (PA0 – PA7) : These pins are used to take analog input and have Analog to Digital converter. For eg: we can sense temperature and convert from values 0-255 (8 bit) or 10 bit values. Programming AVR For any microcontroller to perform any action we need to put some code i.e. a set of instructions in it which it can follow. We write code in computer and then transfer the code to microcontroller using specific toolchain. For AVR MCU,  we can write code using different IDE like Atmel Studio, Arduino IDE, VsCode in Embedded-C language,  C and C++ for hardware purposes. Some SDK used for writing code of AVR are ATMEL STUDIO IDE, Arduino IDE, WinAVR etc. All of the mention SDK are recommended where Atmel Studio is a bit heavy software with loads of features for high performance laptops whereas WinAVR is a really light software to achieve the main motive of AVR coding with some basic and few extra features. WinAVR is recommended for people with laptops having low configurations. WinAVR is a pretty simple tool and can be installed easily. Here we will be discussing on how to install and get Atmel Studio ready for coding of AVR. Setting Up Atmel Studio You should refer to Video 6 – Video 9 of the following playlist created by Gettobyte for detailed tutorial on Atmel Studio. AVRDude AVRDude is a tool or so called utility to download/upload/manipulate the contents of ROM and EEPROM of AVR microcontrollers using your PC and uses ISP i.e. in system programming technique. It is a command line tool and has a huge list of commands which can be referred from its documentation or directly found from the internet as required. Link of Documentation is provided : http://download-mirror.savannah.gnu.org/releases/avrdude/avrdude-doc-6.3.pdf. For quick reference you can also use command: ‘avrdude help’ in command line. To use avrdude, you need to first download and install it which can be done from the provided link: http://download.savannah.gnu.org/releases/avrdude/avrdude-6.3-mingw32.zip. After downloading follow the below steps: 1) Copy the address of folder containing unzipped files 2) Type Env in search bar in start 3) Select ‘Edit the system environment variables’ 4) A dialog box will pop up. Click on environment variables in bottom right corner. 5) Select ‘Path’ in ‘System Variables’. 6) Click on edit button below system variables box. 7) Click on ‘New’ 8) Paste the address that you copied. 9) Click ‘Ok’ on all the dialog boxes. Now you are AVRDude is setup and ready to use. Applications and use of AVR AVR consist of multiple input output pins, ADC, oscillator, timer, interrupts and many more features hence useful in integrating multiple sensors and actuators (Devices that takes signal from microcontroller to perform some action in real world). This lead to use of AVR in variety of applications like home automation, automobiles, medical devices etc. AVR comes in small size with less memory as well as big size with huge memory size and more processing power and features to cover from most simple to much complex applications. Conclusion Congratulations, now your pc is completely ready to code AVR microcontroller. In further blog series of AVR we will dive deep into concepts of programming the AVR and understand different concepts of AVR programming, AVR microcontroller and electronics itself so stay tuned!!

Embedded MCU's Nordic SoC

Introduction of Nordiac NRF5xx SoC\’s

Table of Contents Overview on Nordic IoT Chips Nordic Semiconductor is a semiconductor MNC, which designs & develops a wide range of SoCs supporting IoT protocols. These SoC’s have all functionalities of Microcontroller(MCU) based on ARM cortex Processors, plus they embed 2.4ghz RF transceivers into the chips using RF-CMOS technology for making IoT chips. NRF52 and NRF51 series of SoC’s are widely accepted across the industries where there is a need for Low Power/Ultra Low Power consumption IoT solutions. Nordic Semiconductor NRF5xxx SoC is ideal for Ultralow power and cost-effective short-range wireless solutions. Typical applications for NRF5xxx SoC are: IoT(Internet of Things) devices Wearables Smart Home Wireless Mobile Phone Accessories PC Peripherals Beacons Bluetooth-enabled consumers NRF51 & NRF52 Series have all hardware support of MCU peripherals like ADC, SPI, I2C, UART, GPIO, TIMERS, etc, and 2.4ghz RF transceivers for hardware support of IoT protocols into the chip. Thus NRF5xxx series of SoC can be used for Embedded devices applications(Using MCU peripherals like UART, SPI, I2C, TIMERS, ADC, RTC, USB, etc.)and IoT applications( using protocols like BLE, ZigBee,  Thread, ANT, etc.) simultaneously. NRF5x Series supports the following short-range IoT protocols: BLE THREAD ZigBee ANT Near Field Communication  NRF Proprietary IoT protocols: ESBP & Gazell. Nordic Semiconductor also provides a full suite of IoT stacks to support of above IoT protocols. Nordic Semiconductor has named them Softdevices. To get to know about IoT protocols supported by Nordic chips you can refer to this. Nordic Semiconductor provides a wide range of development hardware from development kits to USB dongles for fast prototyping and hobbyists to play with NRF5x IoT Soc.  How to get started??  We will be using Nordic NRF52840 – DK, which is the official development board for the NRF52840 SoC. Now when I first got the NF52840 DK, it is very different from Arduino, STM, ESP boards. It has lots and lots of chips on it and quite fascinating to explore what all hardware is on it for what purposes. nRF52840-Development Kit At the same time, it is very confusing for me also on how to start with these IoT chips as they have so many features and functionalities on them. From MCU peripherals to IoT stacks, Crypto engines, Power management, analog features, and many more. nRF52 and nRF51 Chips So what I decided at first will start from exploring MCU peripherals, understanding peripheral driver header, and source files: HAL & LL. Subsequently will get to know about the Development environment and SDK of NRF chips. Starting from basics at first and then will move to IoT protocols, in that also we will first start from BLE and then to other IoT protocols. Those who don’t want to explore NRF52840 MCU peripherals can directly start from the BLE part of NRF5x chips. At first, we will make some application code using NRF5x MCU peripherals like GPIO, UART, SPI, I2C, TIMERS and etc. Will understand the HAL APIs provided by Nordic SDK for these peripherals. Will then interface different sensors and modules for making embedded devices. Then will understand the supported IoT protocols architecture and stacks. Now to get started with any MCU or SoC the first couple of things we have to understand are: Its Development Software: Software Development KIT(SDK), Integrated Development Environment (IDE), Debuggers, Environment setup for cross-compilation from our laptop/desktop to the designated MCU processor. Then we have to gather & understand the development board of the corresponding semiconductor chip. As development boards are the fastest and easiest way to get started with semiconductor chips. We will be using NRF52840- Development Board in this series and all the blogs and videos will be on it only.  Development Software for Nordic SoC’s Toolchain setup for Nordic SoC’s At first, we need an IDE. IDE provides a complete solution and one-stop environment for firmware development on microcontrollers. So Nordic Semiconductor provides 2 IDE for the development: Seger Embedded Studio and Arm® Keil µVision. The one which is recommended and preferred to use is Seger Embedded Studio (SES). So, in this tutorial series, we are going to use Seger Embedded Studio (SES). SES is a professional IDE that is highly recommended and used in the industry. SES is free to use for Nordic chips and its installation is pretty easy, can be downloaded from this link. Seger Embedded Studio Nordic chips are programmed and debugged using J-Links. Nordic NRF52840-DK has an onboard Jlink debugger and programmer. So we don’t have to care much about the hardware side of the debugger, but we have to install some software packs for using the Onboard J-Link debugger. We will install the Segger J-link Software and save it along with the same directory as that of SES. So that all that we have to set up for the toolchain of Nordic Chips, successfully installed the IDE and Debugger pack for Developing for Firmware on Nordic chips. At first, when we open the Segger Embedded Studio, it will open with a Hello world example as shown below. Segger Embedded Studio first time open page. How to get started with Seger Embedded Studio for NRF52840 nRF5 Series: Developing with SEGGER Embedded Studio (nordicsemi.com) Software Development Kit for Nordic SoC’s Once we have set up the toolchain, we will now explore and understand the SDK provided by Nordic. SDK includes the building blocks for developing applications. This includes the framework, peripheral libraries, Source & Header files of drivers, RF stacks, example codes for various applications, bootloaders and etc. Every MCU vendor provides the SDK, which is written in C/C++ languages to get started. One will write the source code in SES IDE using SDK provided by Nordic. Now as we navigate to the Nordic Semiconductor website under the Development Software Section, we will see there are a number of SDK packs which are listed: nRF 5 SDK nRF SDK for Mesh/Zigbee/Thread nRF Connect SDK nRF MDK Softdevices Overview of Nordiac SDK’s At first, it is very confusing for me & can’t figure out which SDK is for what

Current/Power Sensors I2C Modules Sensors and Modules

Allegro\’s AC Power monitoring IC ACS71020

In many applications, we want to monitor AC electrical parameters like Solar chargers, motor control, Battery Charging stations, or Smart energy meters. Measurement of AC current and voltage, by the means of the electronics, is a quite tricky part, unlike traditional electromechanical systems. Below is a basic block diagram to know about it. AC voltage and current signals are first steps down to low voltage and current values.One can not feed High AC electrical voltage and Current signals which can range from 0-1000 units and are even larger than that, in some applications(Power systems, AC motors and etc)  to the electronics and digital world.  So at first by the use of one of the below listed three methods AC signals are brought to low values( 0-10V, 0-5A) Use of Current Transformer,  Potential Transformer, or  Rogowski coil. Use of shunt resistors. Use of Hall effect-based principal for current measurement.  The signals which we get after processing from these methods are fed into the Digital System where there are signal conditioning circuits, data acquisition circuits, digital signal processing by the use of Digital and Analog Electronics. The Digital System part is designed to embedded into the Integrated chips(ASIC) which are specially designed with the purpose of Energy Metering application. For the digital computation of key electrical parameters like Power factor, Active power, reactive power, Vrms, Irms and etc. Using these key parameters we can monitor the AC electrical parameters through serial interfaces like SPI/I2C with Host MCU. ACS71020 Energy Metering IC Allegro microsystem\’ AC power monitor module ACS71020 is a Single-phase energy monitoring IC that works on the principle of the HALL effect sensing technique (To know about ways to measure current refer to this blog) to measure the AC current and resistor divider network to measure the input AC voltage. It calculates the key electrical parameters using its  Metrology Engine and digital system from which it sends the data to the host MCU via I2C and SPI interfaces. The Voltage and current reading that we get from AC voltage and Current measurement blocks via the sense amplifiers are analog in nature. The analog signals from respective Voltage and Current blocks are then fed into the internal ADC\’s(Analog to Digital converter). ADC samples the current and voltage channels at high frequency and then digitally converts them by filtering and decimating the output signal from sense amplifiers to avoid large anti-aliasing filters. The digital word from the ADC is 16 bits for both the current and voltage, which is fed to the digital system for further calculation of other electrical parameters. Its Key Features are: Without the need for any Transformer, Rogowski coils, oversized current transformers, or the power loss of shunt resistors one can calculate Vrms and Irms up to 517V and 90A respectively It has an advanced digital system with galvanically isolated current sensing technology which achieves reinforced isolation ratings in a small PCB footprint Apart from the calculation of Electrical Key parameters it also has many extra features too which are essential for monitoring purposes. ACS71020 IC Pinout Diagram and Pins description ACS71020 IC has 16 pins, Starting from Pin 1-8 are current channel pins, out of which pins 1-4(Fused internally) are all IP+ and pins 5-8(fused internally) are all IP-.  Pins 16-15 are Voltage measurement pins  ACS71020 IC Schematic For using ACS71020 for typical applications its schematic is pretty easy and less complicated in oppose to other metering IC\’s(STMP32 & ADE series). ACS71020 can be powered directly from the same supply as the system\’s MCU, through its reinforced isolation technology it does need multiple power supplies to power it up. So Vcc and GND pins are connected directly to MCU Vcc and GND pins. I2C  pins are at a high level(5V or 3v3), before the start of the I2C Serial Communication, thus SDA and SCL lines are connected with a pull-up resistor. When using in I2C mode, pins 9 & 10 act as DIO_1 and DIO_0( Digital Input/Output)  respectively, which are connected directly to MCU Digital Pins( Will get in detail about DIO pins in a later section) For SPI communication, MOSI, MISO, CE pin are at a high level and CLK is at GRND before the start of SPI serial Communication. When using in SPI mode, pins 9 &10 are used as MOSI and CS pins. ACS71020 IC  measures the Current and voltage of the input AC signal to calculate all other key parameters. So for inputting the AC voltage & current signals to the ACS71020 IC we will focus on Voltage channel pins(VINP & VINN) and Current channel pins(IP+ & IP-). One thing to recall is that in a single-phase AC supply there are two terminals: Live Wire (Black/Red) carries electricity from the power supply and takes it to the load. Neutral wire(Blue wire) returns the electricity from the load to the power supply to make the circuit complete. VINN &VINP are terminals from where AC voltage is measured, so resistor network divider of 1mega ohm and shunt resistor is made in b/w the VINP and VINN terminals to fit the input AC voltage within the Range of the differential voltage input buffer of ACS71020( +-275mv) as specified in electrical characteristics of the datasheet. IP+[1:4] & IP-[5-8] pins are terminals for AC current measurement. IP+ terminals are fused internally and are connected to a neutral wire of load and IP- terminals are also fused internally and are connected to a neutral wire of supply to complete the current loop of the current channel. EVE ACS71020 Module For doing the practical demonstration with ACS71020 IC we are going to use the EVE ACS71020 breakout board, which is manufactured by the Evelta. The module is cheap and can be used easily with HOST MCU via I2C or SPI communication. The module has pull-up resistors of 10k ohm placed with SDA and SCL pins( pins 12 & 11) of ACS71020  and no pull-up resistors are connected with MOSI and CS  pins(pins 10 & 9) means we can use these

Embedded Basics Miscellaneous

Communication Protocol\’s in Embedded:

Table of Contents Communication Protocols in Embedded System Serial communication In serial communication, we have only one line for transmitting and receiving data which is why it is half-duplex. It is best for high frequencies as it uses only a single bus or channel for communication, but it can be a bit slower than parallel as it sends only a single bit per clock pulse also because of the single wire here we have fewer chances of cross-talks. It can detect the error as well. When transferring a bit quick change in voltage are required like for 5v OS, 0 bit communicated as a short pulse is 0v, and 1 bit communicated by a short pulse of 5v. In serial communication, the first bit is the most significant bit and the last one is the least significant bit. Parallel Communication In parallel communication, we have a number of lines or buses equal to the number of bits we are transferring. We call it full duplex as the line for transmitting and receiving bits is different. It is faster for small frequencies as all bits are sent at once but as we have to use multiple wires it is costlier also here, we have lots of chances of cross-talks. As in serial, here also we have the first bit is the most significant bit and the last one is the least significant bit. How do they convert? The protocols we have read above communicate in serial form, but they get the data from their peripheral device in parallel form. How do bits get converted into serial form to parallel form? Suppose we have 4 bits, to convert them from parallel to serial we need a Parallel to Serial converter, In the same way, if we want to convert parallel from series, we need a serial to parallel converter. Here comes the D Flip-Flop which is specially designed for such conversions. What is Flip-Flop? A basic memory element or basic digital memory circuit is known as Flip-Flop. It is some medium in which one bit of information (1 or 0) can be stored or retained until it’s necessary. As one flip-flop can store one bit of information. To store multiple bits, we need multiple flip-flops. The group of flip-flops, which are used to store the binary data is known as register. Flip flop circuits are classified into four types based on their use: D-Flip Flop T- Flip Flop SR- Flip Flop JK- Flip Flop. Here for conversion between Serial and parallel bits of data D-Flip Flop is used. Now, what is D Flip-Flop? D flip-flop is also known as Data or Delay Flip-Flop. It has a single D input and a clock input C which is why we call it a D flip-flop. Or for the word delay, it describes what happens to the data at input 0. The data at D input is delayed by one clock pulse before it gets to the output Q. There are two different ways of conversions: Parallel to Serial conversion. First, we need Flip-Flops equivalent to the number of bits. Then we will put the multiplexer in between the Flip-Flop. Multiplexer- It is a combinational circuit that takes input from one of many input lines(parallel) and directs it to a single output line(serial). It has two inputs: 1) From the previous Flip-Flop 2) From Parallel bit data. Now we will load the data which will be transferred one by one.Here msb will be transferred first. Serial to Parallel conversion. First, we need Flip-Flops equivalent to the number of bits. This time we won’t put the multiplexer in between the Flip-Flop. We need to store all the bits at first for this we will pull the clock signal low. Once all bits are loaded, we will pull the clock signal high, and it will shift the LSB to the input of Flip-Flop 1 and output of Flip-Flop 0. Same way all bits gets transferred. Now all the bits are stored in these Flip-Flop and as shown above all the Flip-Flop will transfer the bits at once the way it happens in parallel.. Overview about Serial Communication Protocols in MCU UART Protocol What is UART Protocol? UART stands for Universal Asynchronous Receiver/Transmitter. As we can understand by the name it says it receives and transmits asynchronously. Asynchronously means it doesn’t use clock pulse to synchronize the transmitter and the receiver. In UART, the transmitter takes the signals in parallel from a controlling device[ex-CPU] then it sends the bits to a receiver in serial then the receiver converts those bits in parallel again. UART follows one master one slave approach as it uses only 2 wires for communication. It has one transmitter and one receiver. How does it work? As I, ve mentioned above it transmits asynchronously hence it uses a start and stops a bit, in it contains main data and a parity bit. The parity bit is only needed if the device needs to check the error. When the device wants to start the communication, it pulls the transmitting line low which means it sends a 0 bit and receiving device understands that the transmitter wants to send the data. When the transmission line goes lows it stays low for one clock pulse and then it starts sending the data of 8 bits then the 9th one is a parity bit, the last one is stopping bit it stays high for the one clock pulse until the transmitter sends a low bit to start another frame. To get, in detail understanding on UART Protocol, refer to this blog. SPI Protocol What SPI Protocol is? SPI stands for Serial Peripheral Interface. Just like UART it also uses Serial Communication for transmitting and receiving data but instead of asynchronous it uses synchronous communication protocol for transmission.  Synchronous means the transmitter and the receiver must have the same clock signal. It uses a Full duplex communication protocol which means it can send and receive at the same time. SPI

Electronics Miscellaneous

HOW TO START WITH PCB DESIGNING?

Hello Friends, I’m Taral Mehta. I\’m an Electronics Engineer, This is the first blog of the series to discuss and learn the basics of PCB designing. In this blog, we will discuss, Introduction of PCB and its designing techniques. As well as we will discuss various software that are used for designing the PCB. Table of Contents Starting with Basics of ELectricity Before going to start with PCB designing, we will understand the basic components required: Current – Current is the rate of flow of electric charge. at all points in a series circuit, the current has the same value. If a circuit has a branch, the current flowing into the junction must equal the current flowing out of it.   Voltage – Voltage is also known as potential difference.In a circuit loop, the sum of the voltages across the power supplies is always equal to the sum of the voltages across the rest of the components. RESISTOR – Resistance is a measure of the opposition to current flow in an electrical circuit. Resistance is measured in ohms CAPACITOR – A capacitor is an electronic component that stores and releases electricity in a circuit. It also passes alternating current without passing direct current. Introduction to PCB (Printed Circuit Board) As an Engineer, whether is Mechanical Engineer, Computer Engineer, or IT Engineer, now and then everybody comes across one of the vital parts of the respective industry i.e. Electronic Circuit. This electronic circuit is made or created on a special type of board, which is called PCB (Printed Circuit Board). As you can see in the above image, PCB has electronic components which are connected through conductive pathways, which are usually called Tracks. A PCB is a thin board made of Fiberglass, composite epoxy or other laminate material. Tracks are etched or printed onto a board, which connects different components on PCB, such as Diode, Resistors, Capacitors and Integrated Circuits (IC). These blue and red lines going criss-cross are the Tracks, which form electrical connections between components. And these Yellow and grey objects are actually footprints or pads of components. I Know that tracks, via and Pads are new parameters for you but don’t worry I will give you a simple answer for your understanding. Traces or Tracks: A trace is a piece of copper, think of a wire, that makes an electrical connection between 2 or more points on a pcb. Traces carry current between these two points on the printed circuit board. You can see an image where RED and BLUE are tracked. Pads: Pads are small areas of copper in predetermined shapes normally used to make a connection to a component pin. Vias: A via is a physical piece of metal that makes electrical connections between layers on the printed circuit board. Vias can carry signals or power between layers using plated through holes. Using this technology a via is formed by drilling a hole through the layers to be connected and then plating the inner surface of the drilled hole. Vias should be sized according to the traces connecting between layers and ultimately how much power it must carry. I think You got a basic idea about what exactly a PCB is… correct? So let’s move further and discuss, What are the designing tools of PCB? PCB Designing Software 1) Eagle 2) OrCAD 3) Proteus 4) KiCad 5) Altium Designer 6) EasyEDA These are some of the famous EDA software presently available in the market. One can use any one of the above lists as per their convenience of use. These are some of the famous EDA software presently available in the market. One can use any one of the above lists as per their convenience of use.EagleorCadProteusKiCadAltium DesignerEasyEDA Previous Next Application: Medical and Healthcare Industry Illumination and Lighting Industry Consumer Electronics Industry Industrial Equipment Industry Aerospace Industry Automotive Industry Safety and Security Equipment Industry Telecommunications Industry Military and Defense Summary To summarize, in this blog first, we did an introduction of PCB. Then we discussed the basics of Electronics. We introduce the Basic Concepts of PCB like Schematic, PCB layers, etc. We discuss some of the PCB designing software and applications currently used in the market. References 1.http://www.pic-control.com/pcb-design-service/ 2.https://qualityinspection.org/electronics-videos-basics-pcb-pcba-smt-process/ 3.https://kitflix.com/how-to-study-pcb-design-getting-started-with-printed-circuit-boards/ 4.https://usa.pcbpower.com/application-and-use-of-pcbs.html  5.https://www.goldphoenixpcb.com/html/Support_Resource/arc_177.html

Embedded MCU's Getting Started and Peripheral Coding STM32 MCU's STM32F1

STM32F103 & ADC: Single Channel Conversion

In the last post, we have gotten to know about the features of ADC Peripheral that we have in STM32 MCU. Now in this blog with the series of bare Metal Programming for Blue Pill, we will understand different register bytes and bits of ADC Peripheral to be used for using it in different features, configurations, and modes as we get to know about in the Previous Post. In this blog, we will be going through how to use  ADC Peripheral for converting a Single Channel of ADC (only one ADC pin) and see its bare metal code. Single  Channel Conversion  Mode: Only one ADC pin is used, this mode is like when we have say connected only one analog sensor to one of the ADC pins of MCU  like the Potentiometer is connected at PA0 pin. ADC Registers In depth for: Let\’s get into an in-depth understanding of which registers and their bits are used for configuring the ADC peripheral of Blue Pill in Single Channel Configuration. We will focus on bits and will give an explanation of why those bits are used for the 1.   ADC_SR(ADC status Register) –>This register tells the status of ADC channel  Conversion, as it name says. STM32F103 ADC Status Register: 11.12.1 Bit 1[EOC ]: This bit is set by hardware when a single channel of any group (Regular or Injected) is converted successfully. So this bit is used for monitoring when the ADC conversion is completed by using it inside the while loop if interrupts are disabled. 0: ADC Channel Conversion is not completed 1: ADC Channel Conversion is completed When hardware set this bit, we can clear this bit from the firmware end by setting the bit to 0 or by reading ADC_DR(ADC Data Register) Bit 4[STRT]: This bit is set by hardware when regular channel conversion has begun. So when we start the Regular Channel Conversion, we will use this bit inside the while loop to check that whether Regular Channel conversion has started or not. 0: No regular Channel Conversion has started 1: Regular Channel Conversion has started When hardware sets this bit, we can clear this bit from the firmware end by setting the bit to 0. Even if we don\’t clear this bit it will cause no effect during ADC Conversion. But its good practise to clear all bits of Status Register before starting the new conversion 2.            ADC_DR(ADC Data Register) –> This register stores the converted digital data at a 12-bit resolution of the converted ADC channel. STM32F103 ADC Data Register 11.12.14 Bit 15:0 [DATA 15:0]: The ADC_DR is divided into two 16 bits groups. The first 16 bits from 0-15 contain the Converted value of the configured ADC Regular Channel. As our ADC is of 12-bit resolution, so this is left aligned or right aligned to 4 bits so as to get the 12 ADC converted data . Left Aligned or Right alignment of ADC Data Depends on ALIGN bit of ADC_CR2 So we will have following code and algorithm for ADC_SR & ADC_DR register:while(!(ADC1->SR & ADC_SR_STRT)) while(!(ADC1->SR & ADC_SR_EOC)); // wait till a group channel converstion has completed adc_data = ADC1->DR; //clear the EOC bit by reading DR register ADC1->SR &= ~ADC_SR_STRT;      3.      ADC_CR1(ADC Configuration register 1) –> This register is used for the  Configuration of ADC peripheral for Analog Watchdog Discontinuous Mode Interrupt Enable/disable Dual Mode configuration Scan Mode  As we are not using any of these features, so all the bits for these registers will be set to zero, and to know about these features and their bit functions, u can navigate to corresponding blogs for those. STM32F103 ADC Configuration Register 1. 11.12.2 Bits 19:16 [DUALMODE 3:0]:  These bits are used to configure the type of operating mode. In the blue pill, we have two ADC peripherals: ADC1 & ADC2. We can use these  2 ADC peripherals simultaneously by configuring the respective ADC in different modes or in independent modes. We are going to use these ADC in independent mode as will be using only ADC1 peripheral, so DUALMODE[3:0] will be set to 0. Bit 8[SCAN]: This bit is used to enable/disable the SCAN Mode feature in the ADC peripheral of BLUEPILL. Scan Mode is used when we convert more than 1 channel to scan all the configured channels in a Regular Group. As we are using only a single channel, means only one ADC pin is used so SCAN mode is not used and this bit will be set to 0. 0: Scan Mode disabled. 1:Scan Mode Enabled. So we will have following code and algorith for ADC_CR1 register:ADC1->CR1 &= ~(ADC_CR1_SCAN); // SCAN DISABLED, if using scan mode then dma must be enabled ADC1->CR1 &= ~(ADC_CR1_JDISCEN | ADC_CR1_DISCEN); // Discontinous mode disabled for both injected and regular groups ADC1->CR1 &= ~(ADC_CR1_DISCNUM_2 | ADC_CR1_DISCNUM_1 | ADC_CR1_DISCNUM_2 ); // no channels are configured in discontinous way. // if discontinous mode is enabled then number of //conversions to be done by discontinous mode has to be configured // DISNUM bits ADC1->CR1 &= ~(ADC_CR1_DUALMOD_0 | ADC_CR1_DUALMOD_1 | ADC_CR1_DUALMOD_2); // INDEPENDENT MODE SELECTED ADC1->CR1 &= ~(ADC_CR1_AWDEN | ADC_CR1_JAWDEN); // Analog watchdog disabled for both groups: regular and ibnjected 4. ADC_CR2(ADC Configuration Register 2) –> This register is used for the configuration of  ADC Peripheral for:  ADC Conversion enables/disabled for regular and injected groups and ADC peripheral enable/disable. Trigger source configuration for regular and injected groups. ADC Data Alignment, DMA, Continous, temperature sensor setting. STM32F103 ADC Configuration Register 2 11.12.3 Bit 0 [ADON]: ADC Peripheral On/OFF. This bit will be set to 1 to enable the ADC peripheral.  All channel configurations and ADC Peripheral configurations have to be made before setting this bit to 1. 0: Disable ADC Peripheral 1: Enable ADC Peripheral Bit 1 [CONT]: This bit configures between Single Conversion mode and Continous Conversion mode. Continuous Conversion mode is selected when we have more than 1 ADC channel to be converted. As in this blog, we have

Tech

Introduction on PlatformIO

Content Index Table of Contents Complete Beginner’s Guide to Platform IO Introduction Platform IO is a platform that allows core developers to compile the same code with different platforms using only one command i.e. platform io run. It is an extension in VSCode and hence can be used with our favorite code editor. It has many features that allow core developers to have a smooth development experience. Also it allows you to export and edit the same project in windows as well as windows or any other systems without any changes required. Installing Platform IO It is a VSCode extension and can be simply installed by adding Platform IO from the extensions center of VSCode Figure 1 Creating a Project in Platform IO Click on Platform IO Logo in VS Code Figure 2 In PIO Home 🡺 Go to Open 🡺 Home Screen of PlatformIO is visible Select New Project 🡺 Give a name and select board for project 🡺 Select Location 🡺 Done Figure 3 Figure 4 Figure 5 Figure 6 New Project will be created You can write code in main.cpp under the src folder, we can edit the platform under platformio.ini to upload to different boards. Different Folders and files in Platform IO Platform IO consists of many folders to support embedded development on multiple systems and compiling information. Platform IO consists of: .pio: This folder consists of complete debug and compiler information of the project. This folder need not be uploaded and is included in gitignore as well to not upload on Github. <br> We don’t have any work in this folder and we don’t need to edit this folder.  .vscode: This folder consists of JSON files required to run platform io and its services in VS Code editor. This folder also doesn’t need to be touched or edited to do our work. include: This folder is present to allow you to add “.h” header files into the PlatformIO project that are not added as libraries in your project. You can place libraries defined by you with .h extension to use them. Also, this code is not compiled and there is no use of putting a .c/.cpp file in this folder. lib: This folder is used to define complete libraries that are private that are made by you. In include, we only add .h files but this folder can consist of complete details like documentation, examples, source files, JSON, etc. Basically, it contains complete information related to a library. src: This folder consists of main.CPP and will contain the code that we want to write. We can add more files in this folder to integrate into our code. This is the main folder we will be working on. Code will start executing from main.CPP. test: This folder is used to write tests that can be used to automate the testing of the code. These tests can be used to see the efficiency of code and how code behaves on boundary conditions. These are generally useful in bigger projects.  .gitignore: This folder is a part of the git family and consists of the name of the folder that needs to be and will not be uploaded on git while uploading the project. It generally includes the .pio folder and some files of the .vscode folder.  platformio.ini: It is a kind of settings folder where you can decide the platform on which code to be uploaded, add libraries, control monitor speed, select framework, and many more things. Visit the given link to explore multiple options and their application in platform io : https://docs.platformio.org/page/projectconf.html Adding Libraries in PlatformIO project Platform IO provides multiple easy ways for you to add libraries to a project. We are going to discuss one of the easiest and most useful ways of adding libraries in Platform IO: Go to Platform IO symbol in the left pane of extension 🡺 Under PIO Home select Open. In the main window select Libraries 🡺 Search the library you need 🡺 Click on that library 🡺 Click on Add to Project 🡺 Select project in which you want to add library and click add. Now the library is added to your project. There are also other ways to add libraries in Platform IO by editing the platformio.ini folder. See the below link under ‘Project Dependencies’ to explore those methods: https://docs.platformio.org/en/latest/librarymanager/quickstart.html Uploading code to hardware using PlatformIO Platform IO provides a very easy way to upload code on the hardware. The following steps should be followed to upload the code: After writing the code, verify the details and environment in platformio.ini. You can select different hardware by removing the lines that look like the following and adding the setting for the required board. Setting can be googled to find the exact lines: [env:pro16MHzatmega328] platform = Atmel Avr board = pro16MHzatmega328 framework = Arduino You can also select multiple boards at one time using the method mentioned in the following link: https://community.platformio.org/t/changing-destination-boards/4751/2 Click on Platform IO Icon in left sidebar of VS Code Under Project Tasks 🡺 General, you have multiple options and operations that can be done for the project. Build 🡺 Compiles the code to see if any errors  Upload 🡺 Compiles and upload the code to the hardware connected. Monitor 🡺 To open serial monitor in VS Code Upload and Monitor 🡺 Compiles uploads the code and open the serial monitor just after uploading code Clean and Clean All 🡺 Used to remove and delete any dangling pointer or function that is left in the stack and not deleted or removed. ** You can also have few options present in the bottom bar to compile, upload and monitor the code. Conclusion In the end I want to say that platform Io is an amazing platform that is used to develop embedded systems code, and has integrated most capabilities like writing, uploading, and even debugging of code in one place. It is a great platform to work on and will help you guys a lot.

Stay Updated With Us

Error: Contact form not found.