top of page

Search Results

119 items found for ""

  • Arduino_DIGITAL_IO | Simple Mechatronics| Simple MECHATRONICSsimple mechatronics

    Introduction to Arduino Digital I/O The most common and highly used data transfer, from and to (Input and Output) the micro-controller is DIGITAL. Digital data means, signal is set at either logic HIGH (i.e. 5V or 3.3V or Vcc) or logic LOW ( i.e., ground or 0V) Most of the times Digital signal may not exactly matching to the Vcc voltage and Ground voltage. So, the voltage at a trigger voltage level is considered as High or Low. The Trigger voltage is dependent on the micro-controller, in use. Normally, for 5V power supplies, above 3.5V is considered as logic High and less than 2V is considered as logic Low. (This may vary slightly and depends on the micro-controller). Another important point to note is, the micro-controller cannot handle high currents. Any micro-controller generates current in milli-amperes only. So, a series resistance to the load, must be connected wherever is required, to limit the current flowing through the micro-controller pin. Understanding Digital Output : A test circuit is to be connected as shown in the figure, using 4 LEDs and 4 resistors , on a bread board. ​ Here, they are connected to four pins of Arduino Nano, i.e. D2, D3, D4 and D5, for testing. You may connect any number of LEDs, to any pins of Arduino Nano (of your choice). Then, Connect the USB cable (USB type-A and micro-USB on either end) to the Arduino Nano and your system USB port. Now, Open Arduino IDE, then select through menu, File->New . Then declare all the LED connected pins, as output in setup function, using pinMode function, as shown below. ​ void setup() { // put your setup code here, to run once: pinMode ( 2 , OUTPUT ); pinMode ( 3 , OUTPUT ); pinMode ( 4 , OUTPUT ); pinMode ( 5 , OUTPUT ); } } Then, send logic High and Low codes to each pin sequentially, to all the LED connected pins, using digitalWrite function (HIGH to glow and LOW to off), with a small delay, as shown below. ​ void loop() { // put your main code here, to run repeatedly: digitalWrite ( 2 , HIGH ); delay(1000); digitalWrite ( 2 , LOW ); ​ digitalWrite ( 3 , HIGH ); delay(1000); digitalWrite ( 3 , LOW ); digitalWrite ( 4 , HIGH ); delay(1000); digitalWrite ( 4 , LOW ); ​ digitalWrite ( 5 , HIGH ); delay(1000); digitalWrite ( 5 , LOW ); } ​ The above code is written for easy understanding. You may use for loop, instead of writing code for each pin, which is shown in the next part (Understanding Digital Input). ​ Then, through menu, do necessary settings for connecting Arduino Nano: Tools->Board->Arduino Nano Tools->Programmer-.USBasp Tools->Port->(select the port connected to Arduino Nano) ​ Then, press compile icon (or through menu, sketch->Verify/Compile) and check for any errors uin typing. Then, press upload icon (or through menu, sketch->upload) and check the RX & TX LEDs on Arduino Nano are blinking, while uploading the sketch. ​ Once uploaded the sketch to Arduino Nano, the LEDs starts glowing one-by-one sequentially for one second each. Since, it was written in loop function, the sequence continues. Understanding Digital Input : The previous test circuit is to be modified as shown in the above figure, by adding a positive probe ( red ) connected to 5V and a negative probe ( blue ) connected to GND (ground). You may connect berg strip pins to A2, A3, A4 and A5 , for easy identification as input pins. ​ Now, in the setup function, set the pins 2 to 5 as Digital OUTPUT , using pinMode function as earlier (same code is modified using for loop). Also, set the A2, A3, A4 and A5 pins as Digital INPUT , using pinMode function, as shown below. ​ void setup() { // put your setup code here, to run once: int i; //variable declaration for ( int i=2; i<=5; i++ ) //for loop to select 2 to 5 pinMode ( i , OUTPUT ); // set 2 to 5 as OUTPUT ​ // set A 2 to A5 as INPUT pinMode ( A2 , INPUT ); pinMode ( A3 , INPUT ); pinMode ( A4 , INPUT ); pinMode ( A5 , INPUT ); } ​ Then, send logic High and Low codes to respective output pins (2, 3, 4 and 5), according to the status of input pins (A2, A3, A4 and A5). Here, digitalRead function is used to read the digital status (HIGH or LOW ) of each input pin. Where as digitalWrite function (HIGH or LOW ), is used to send output code to the respective pins. You may observe in the loop function, four types of logic is used to show the status of input pins to respective output pins. ​ void loop() { // put your main code here, to run repeatedly: bool pin2, pin3; // 1) read the input and act accordingly if it is HIGH pin2 = digitalRead( A2 ); if ( pin2 == HIGH ) digitalWrite ( 2 , HIGH ); else digitalWrite ( 2 , LOW ); // 2) read the input and act accordingly if it is LOW pin3 = digitalRead( A3 ); if ( pin3 == LOW ) digitalWrite ( 3 , LOW ); else digitalWrite ( 3 , HIGH ); // 3) read the input and directly act accordingly if ( digitalRead ( A4 ) ) digitalWrite ( 4 , HIGH ); else digitalWrite ( 4 , LOW ); // 4) set output matches to the input value; single statement digitalWrite ( 5 , digitalRead ( A5 ) ); } ​ Again compile and upload the sketch to Arduino Nano. Then, test the sketch using the circuit. The LED connected to pin 2 glows, when A2 pin is connected to positive probe and goes off, when the A2 pin is connected to negative probe. The same phenomenon is observed with input pin A3 to output pin 3, input pin A4 to output pin 4 and A5 to 5. ​ As the input pins are neither connected to positive nor negative power supply, by default, the A2 to A5 are in floating condition and sensitive to small signal change. Some times, some inputs may be set to either HIGH or LOW status, if not connected to any probe. External Pull-up/ Pull-down to Digital Input(s) : To avoid floating state for digital input(s), the open input(s) should be connected to either positive (5V) or negative (GND) of power supply, through resistors, by default. Now, test the output, using the probe connecting to the input pins for both the Pull-up and Pull-down circuits, which is shown above. In case, the inputs are continuously connected to any external signalling system, then there is no need of pull-up or pull-down resistors. No change is required in the sketch to test the external pull-up or pull-down circuit. Activating Internal Pull-up Resistor(s) to Digital Input(s) : While using external pull-up or pull-down resistor(s) for digital inputs, the resistor(s) have to be tied to either positive or negative power supply. To avoid using any internal resistor, the pull-up resistor(s) may be activated inside the micro-controller, through writing code in the sketch, as shown below. ​ pinMode ( x_pin_number , INPUT ); // set any pin as input digitalWrite ( x_pin_number , OUTPUT ); // activates internal pull-up resistor ​ Now, in the setup function, set the pins A2 to A5 as Digital INPUT , using pinMode function as earlier, and then add digitalWrite function as OUTPUT , as shown below. ​ void setup() { // put your setup code here, to run once: int i; //variable declaration for ( int i=2; i<=5; i++ ) //for loop to select 2 to 5 pinMode ( i , OUTPUT ); // set 2 to 5 as OUTPUT ​ // set A 2 to A5 as INPUT pinMode ( A2 , INPUT ); pinMode ( A3 , INPUT ); pinMode ( A4 , INPUT ); pinMode ( A5 , INPUT ); ​ // activate internal pull-up resistor for A 2 to A5 digitalWrite ( A2 , OUTPUT ); digitalWrite ( A3 , OUTPUT ); digitalWrite ( A4 , OUTPUT ); digitalWrite ( A5 , OUTPUT ); } ​ There is no change in loop function. compile and upload again. Since, the inputs are pulled-up internally (means connected to positive through resistors), all the LEDs glow, by default. Now, connect each input pin to ground to observe the respective LED goes to OFF state. ​ So, this will avoid using resistor(s) and makes the circuit neat. In case the outputs are to be in the off state, by default, you may change the logic in the loop function or may use pull-down resistors as shown in the earlier circuit. ​ Best of Luck.

  • ICs | Simple Mechatronics| Simple MECHATRONICSsimple mechatronics

    ic As the name suggests, An Integrated Circuit (IC), is a summation of electronic elements of a functional circuit available in small package. ​ Integrated Circuit (IC) is also called as Chip or Microchip or Silicon Chip, In other words, IC is a small semiconductor wafer, usually made of silicon, on which multiple tiny transistors, resistors, diodes, capacitors etc., are fabricated to form a useful or functional circuit, which is enclosed in a plastic or ceramic material with the connecting pins on its periphery (or surface). An IC can do following functions in single or combination of counter, timer, amplifier, voltage regulation, oscillator, memory, ADC, DAC , arthematics etc. A microprocessor or a micro-controller also falls under IC catagory. Integration: The complexity and functionality of an IC depends on the number of transistors and associated electronic components used on a silicon wafer. The following is the types of integration and associated number of transistors used in the IC. ICs are available in various packages with specific name. The package name indicates the size, shape, position of pins, pin out format etc. ​ All Micro-Processors, Micro-Controllers, Voltage Regulators, Op-Amps etc., are ICs (Integrated Circuits) only

  • AVR_ADC_DAC | Simple Mechatronics| Simple MECHATRONICSsimple mechatronics

    AVR - ADC (Analog to Digital Conversion) Almost all AVR microcontrollers have ADC (Analog to Digital Conversion) pins, except a few, like ATTINY 2313 / 4313 series. ​ The main concept of ADC is, a stair-case type reference voltage is generated in steps by the micro-controller internally and compares the signal / input voltage with the generated reference voltage. If the input voltage just crosses the reference voltage, then the step number in the stair case is noted and saved in to its related Register (ADC). Our code reads the related Register and process as per our requirement. RESOLUTION AND REFERENCE VOLTAGE SELECTION: So, the Resolution of the ADC value depends on the number of steps generated for a range of voltage. Normally AVR micro-controllers generate 1024 steps (equals to 2 to power 10) from 0VDC to Reference Voltage. So, the data shows 10 bit resolution of ADC. The Reference voltage may be Vcc voltage or separate external input voltage other than Vcc or fixed internal reference voltage ( like 1.2V). The reference voltage input may be selected by setting the required bits in the related register (ADMUX ). ​ Bits 7 & 6 of ADMUX are named as REFS1 and REFS0. The bit setting serves for various input reference voltages in combination as shown below: REFS1=0 and REFS0=0 means external voltage as reference at VREF pin. REFS1=0 and REFS0=1 means Vcc as reference and connect 0.1uF capacitor at VREF pin to ground. REFS1=1 and REFS0=1 means Internal Reference Voltage used as reference and connect 0.1uF capacitor at VREF pin to ground. ​ eg: assume that the reference voltage is set to 5VDC. then, the ADC divides it into 1024 steps, ranging from 0000 to 1023 digital values. so, each step of 5V (= 5000 milli Volts) is equals to 5000/1024 = 4.8828125 mV which is approximately equal to 5 milli Volts. ​ So, the ADC of AVR in this case cannot measure less than 5 milli Volt fraction, in other wards, the ADC value of output available in the Register is approximately multiples of 5 milli Volts (= 0.005V) ​ So, you should not expect less than 5 milli volt accuracy with the above settings. ​ Similarly, you may calculate and set your input. ​ Note/Tip: if the external input reference voltage is 1.023V, then the ADC value is directly proportional to the milli Volt signal input. (1 ADC unit = 1 milli Volt) ACCURACY AND speed of ADC conversion: ​ The accuracy of ADC for AVR micro-controller also depends on the speed of the comparision with the step voltage. You have to sacrifice accuracy to a little extent to get the conversion quickly. The accuracy is sufficiently good upto 200 KHz clock set for the ADC comparision. If the ADC clock speed is set more than 200 KHz, then little accuracy will lost in ADC conversion. The frequency dividing w.r.t. CPU clock is called Prescaling for ADC conversion. ​ ​ In case 8 bit conversion (0 to 255 steps) is suffiecient for your requirement, then the conversion may cross 200 KHz. ​ The clock speed may be set by division factor w.r.t. to the main CPU clock in related Register (ADCSRA ), i.e., ADC Control and Status Register A. The LSB bits of ADCSRA are names as ADPS2, ADPS1, ADPS0 and 16, 4 and 2 are the division factors respectively. The minimum division factor is 2 by default if all set to zeroes. ​ eg: if ADPS2=1, ADPS1=0 and ADPS0=1 means division factor is 16X2 = 32. ​ SELECTING CHANNEL FOR ADC conversion: ​ Normally, AVR micro-controllers have more than one ADC channel connected to specific pins to the exeternal world for ADC conversion. Internally the ADC processor is same for all the channels, but a multiplexer is used to select a specific pin at a time for conversion. ​ The multiplexing Register (ADMUX ) is not only used for selection of the particular pin, but also to select differential input and gain in some micro-controllers by setting the specific bits. The LSBs of the ADMUX are used for directly selecting the channel (or pin). ​ eg: set 000 to LSB of ADMUX , to select channel 0(pin ADC0), 001 for channel 1 (pin ADC1) etc. ​ READING ADC VALUE FROM THE REGISTER: ​ The ADC value, which is the digital value for the analog voltage / signal input is stored in Register (ADC ). The result is also available in ADCL and ADCH registers, which contains 8 LSB of the ADC and 8 MSB of ADC. The value may be directly read from the ADC register by setting / returning to the variable name set by you in the program. ​ eg: a = ADC; or return ADC; b = ADCL; or return ADCL; c = ADCH; or return ADCH; ​ The result of conversion of ADC is 10 bit resolution. i.e. it varies from 0000 to 1023. ​ If required, the result may be converted to 8 bit resolution by setting bit 5 (ADLAR) in ADMUX register as shown below: starting the adc: Before starting the Analog to Digital Conversion, the settings as required, as explained above to be processed in the program. Also, bit 7 ,ADEN (ADC enable), should be set (to 1). ​ Now, to start ADC for every loop, the bit 6 ,ADSC (ADC Start conversion) of ADCSRA should be set to 1. Then the Analog to Digital Conversion will start. On completion of conversion bit 4, ADIF (ADC Interrupt Flag) of ADCSRA will be set (to 1) and also ADSC will be reset (to 0). So, by checking the status of ADIF or ADSC bit in ADCSRA register, you will come to know the conversion status. Example code for adc: ​ //================================================= void initializeAdc ( ) { //SET DIVISION FACTOR FOR F_CPU TO GET ADC CLOCK FREQUENCY ADCSRA |= ( (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0) ); //ADPS2 divides by 16. ADPS1 divides by 4. ADPS0 divides by 2. ​ //SET REFERENCE VOLTAGE SOURCE ADCSRA |= ( (1 << REFS1) | (1 << REFS0) ); //set REFS1,REFS0 = 0,0 for Reference at AREF pin. // 0,1 for AVCC as Reference. 1,1 for Internal Reference Voltage. ​ // ENABLE ADC ADCSRA |= (1 << ADEN); } //================================================= int readAdc ( int channelno ) { // reset previous channel number upto 8 channels, if any. ADMUX &= (0b11111000); ​ // select current Channel number to read ADC. ADMUX = (channelno); // START conversion now. ADCSRA |= (1 << ADSC); // WAIT till conversion is complete while (ADCSRA & (1 << ADSC)); ​ // READ ADC value and return the function. return ADC; } //================================================= Note: ​ This is a general concept of ADC conversion in AVR micro controllers. Some small changes may be observed for each AVR micro-controller, which may be obtained from the data sheet specific to the micro-controller. ​ eg:for ATTINY micro-controllers have only 4 ADC channels and only two options for reference voltage selection. REFS0=0 means Vcc or REFS0=1 means 1.1V internal Voltage Reference. REFS1 is not available. ​ More controls are available while reading ADC of AVR micro controller. The specific ADC usage is available in programs and explained the specific concept and usage in the project. ​ << AVR: TYPES

  • Satellite_Clock | Simple Mechatronics| Simple MECHATRONICSsimple mechatronics

    Satellite CLOCK Normally, RTC (Real Time Clock) ICs are used for time display which are easily available and reasonably accurate. But, the accuracy of RTC, highly depends on the seasonal / atmospheric temperature, which effects the performance of the crystal used in the RTC circuit. So, to have more accurate time, which is independent of temperature change, the Satellite Clock reads the data delivered from GPS ( Geographic Positioning System) satellites and displays in required format, which is highly accurate . NEO-6M module: NEO-6M, a GPS receiver module, used to receive NMEA (National Marine Electronics Association ) data continuously from GPS satellite(s). The data is transimtted through its TX pin (Serial data at 9600 baud rate, by default). A sample data from GPS receiver is shown below. The Arduino processes the data and picks the time stamp (marked using red colour line) in the received data string. TM1637 module: The TM1637 module has 4 digits of seven segment display, with a colon between 2nd and 3rd digits, which is suitable for clock display system. The IC behind the module receives the data using TWI (Two Wire Interface / IIC) and continuously refreshes the 4 digits. By using this module, only two pins of micro-controller (or Arduino) is sufficient for interfacing. The TM1637 module has brightness control of the display and may be changed as required. The basic working of the circuit is, the data received by the GPS receiver module, NEO-6M, is transmitted to Arduino Uno's RX pin (of Serial port). The Arduino Uno processes the data and picks the TIME stamp , by identifying the keyword GPGGA (or you may use GPRMC ) in the received data string. Then, the time string is processed to show on TM1637 module, in UTC (Universal Time Coordinated) format (default format received by the GPS satellite) or Local time format (12 hour / 24 hour) as per jumper settings. ​ Refer full circuit diagram: INITIAL SETUP / TESTING: The circuit is assembled on a general purpose PCB and connected the pins of Arduino Uno using berg strip (refer Video) . Compile and upload SatClock.ino to Arduino Uno, using Arduino IDE. To avoid conflict with GPS data at RX pin of Arduino, while uploading sketch, the GPS module should be connected after uploading the sketch. ​ Once uploaded the sketch to Arduino Uno, all the segements of display module and two LEDs glow for a while as self-test. Then, it shows 1637 number and enters the loop to receive the code from GPS module. For first time use ( or connected after long time ), it takes much time to connect to satellite, to display the time. ​ To know the status / error, two types of indications are programmed in the sketch. 1) single moving horizontal line indicates, that the GPS module is absent or NO data is received from GPS module. 2) three moving horizontal lines indicate, that data is received from GPS, but not in the specified format or time stamp is invalid. ​ Once, valid data is received (means time stamp is received) from the GPS module, then the time stamp is processed and displayed on the TM1637 display, with blinking colon. You may also observe that, an LED on the GPS module is also blinking at 1Hz rate, called PPS (Pulse Per Second) LED. ​ By connecting Jumper J1, the displays shows UTC time, which is matching to time stamp or GMT (Greenwich Mean Time). By disconnecting Jumper J1, the display shows Local time, which is calculated by using the following variables used in the sketch. The values are dependent on the country's time settings as per GMT . Here, +5 hour 30 minutes are used for India. ​ int ADJ_HH = 5; // change the HOURS value as per your country's time w.r.t. GMT int ADJ_MM = 30; // change the MINUTES value as per your country's time w.r.t. GMT Incase, both the Jumpers J1 & J2 are dis-connected, then, the display shows Local time in 12 hour format along with AM / PM indication on any on of the LEDs. Similarly, if the Jumper J1 is disconnected and J2 is connected, then the display shows Local time in 24 hour format. Both the LEDs are OFF in this mode. ​ The serial data output at pin TX of Arduino Uno is suppressed by marking as comment / remark in the sketch. If you want to debug the code, on serial monitor , then remove the double slash before all Serial.print commands, using find and replace option, as shown below. ​ existing in sketch (find word) ---> // Serial.print . . . . . to be modified in sketch (replace with) ---> Serial.print . . . . . ​ Complete Satellite Clock project assembly, using external DC power supply (instead of USB), is shown below: For source code (arduino sketch), (SatClock.ino) , please send message through contact form . The full source code will be sent to your e-mail. If you are not willing to learn, no one can help you. If you are determined to learn, no one can stop you.

  • Transistors | Simple Mechatronics| Simple MECHATRONICSsimple mechatronics

    Transistors A transistor is a semiconductor package having combination of three P-type and N-type semiconductors successively and normally used to switching or amplify weak signals in electronic circuits. It usually have three terminals for connection to an external circuit. Transistors are basically classified into two types: 1)Bipolar Junction Transistors (BJT) and sub-classified as NPN and PNP transistors. 2)Field Effect Transistors (FET) and sub-classified as JFET and MOSFET Bi-Polar Transistors: There are two types of bi-polar transistors, which are differentiated by the order of the P-type and N-type semiconductors and named them accordingly. Both the types have different behavior when used in a circuit. Out of three semiconductor layers, the middle one (called as BASE) is very thin layer and controls the flow of the electrons, i.e., current passing though the transistor. Other two semiconductor layers are on either side of the BASE and called as EMITTER and COLLECTOR. The COLLECTOR is the thickest layer in a transitor. Out of three connections of a transistor, input power supply is connected to EMITTER, power output is connected to COLLECTOR and signal is connected to BASE. A small change in current to BASE of a transistor effects, significant change of flow of current through the transistor, i.e., from EMITTER to COLLECTOR. Two different symbols are used for NPN and PNP transistors and the emitter is marked with a arrow pointer, base is at middle and straight line for collector. The direction of arrow pointer also indicates the direction of current flow. NPN Transistor: In the NPN transistor, P-type material is in between two N-type materials. Even though, both the ends are made of N-type semiconductor material, they are not interchangeable, due to difference in doping. Normally the middle P-type layer is very thin and one of the N-type layer is larger than other end. Here larger layer is called as Collector and other end is called as Emitter . The middle thin P-type layer is called as Base . The two voltage sources (VBE and VCE), required for proper working of an NPN transistor is shown here. Very small current flow through the Base (IB) due to VBE, makes the lower PN-junction, forward biased like a diode. Due to this phenomenon, majority of electrons cross the barrier between the Emitter and Collector also, which makes the current flow from Collector to Emitter in high quantity. So, with a small current flow at Base, high current flows between Collector and Emitter. So, the total current flow at Emitter is sum of Current flow through the Base and Collector. For practical use, NPN transistor is configured as either Common Emitter or Common Collector mode. The power source is connected between the Collector and Emitter and signal (low current and voltage input) is applied at Base pin. The effect of signal in both the configurations are shown below. Resistors are to be used to control the current flow through the Collector, Emitter and Base as required, which is dependent on its design parameters (available in data sheets of the particular transistor) PNP Transistor: Where as in the PNP transistor, N-type material is in between two P-type materials. Like NPN, both the ends (P-type) are not interchangeable, due to difference in doping. Here the middle N-type layer is very thin and one of the P-type layer is larger than other end. Here also, larger layer is called as Collector and other end is called as Emitter . The middle thin P-type layer is called as Base . For the PNP transistor also, the two voltage sources (VBE and VCE), required for proper working, as shown here. Very small current flow through the Base (IB) due to VBE, makes the lower PN-junction, forward biased, and due to this phenomenon, majority of electrons cross the barrier between the Emitter and Collector also, which makes the current flow from Emitter to Collector in high quantity. So, with a small current flow at Base, high current flows between Collector and Emitter. So, here also the total current flow at Emitter is sum of Current flow through the Base and Collector. The main difference w.r.t. NPN is, the Emitter should be connected towards positive supply and Collector to negative supply. For practical use, PNP transistors also configured as either Common Emitter or Common Collector mode. The power source is connected between the Collector and Emitter and signal (low current and voltage input) is applied at Base pin. The effect of signal in both the configurations are shown below. Resistors are to be used to control the current flow through the Collector, Emitter and Base as required, which is dependent on its design parameters (available in data sheets of the particular transistor) The NPN and PNP transistors are highly used as signal amplifiers and logic gates. The ratio of current flow at Collector to Base is called Gain of the transistor, which is always greater than 1 (typically 100). Field-Effect Transistor (FET): A Field Effect Transistor (FET), (also called Uni-polar Device / Transistor), is different from normal Bi-polar Junction Transistor (BJT) in construction and working principle. A BJT (eg NPN or PNP) is current controlled device, which responds to current flow through its base. Where as an FET is voltage controlled device, which responds to the voltage at gate pin w.r.t. source pin, so has very input resistance. Due to its construction and working principle, the FET's are classifed as Junction Field Effect Transistors (JFET) and Metal Oxide Semiconductor Filed Effect Transistor (MOSFET). Junction Field-Effect Transistor (JFET): Junction Field Effect Transistor (JFET), are two types based on the semiconductors used for construction. i.e., n-channel JFET and p-channel JFET, which is depending on the main and control semiconductors used for construction. Both the types of JFETs are shown here. A JFET is operated in reverse biased, between the Gate and Source pins for control. So, when the voltage increases at PN-junction, between the Gate and Source, the Reverse-bias reduces / prevents the current flow (ID) through the Drain pin. Higher the reverse bias voltage causes, higher the resistance (i.e., lower the current) between the source to drain. The working system of n-channel JFET is shown here. The polarity of power supply is reversed for p-channel JFET. Metal Oxide Semicondictor Field-Effect Transistor (MOSFET): Metal Oxide Semicondictor Field Effect Transistor (MOSFET ) is also called as Insulated Gate Field Effect Transistor (IGFET ). The MOSFET does not have PN-junction like JFET, but controlled by P type or N type channel The channel is controlled by a Silicon Dioxide (SiO2) layer. The MOSFET is sub-divided into Depletion type MOSFET (D-MOSFET) and Enhancement type MOSFET (E-MOSFET). The working principle and differences of D-MOSFET and E-MOSFET are explained below. Depletion type MOSFET (D-MOSFET): The D-MOSFET, either n-type or p-type semi-conducting material, is diffused to source and drain, which is connected by a narrow channel of same material. The remaining gap is filled with the opposite (p-type or n-type) semi-conductor. A Silicon-dioxide layer is used at the channel area, which is connected to the gate. When the gate is connected in reverse biased w.r.t. source, the width of the channel near gate (which is connected to SiO2), increases and reduces the flow of current between source and drain. So, the current flow between source to drain is inversely proportional to gate voltage. In case, the gate is connected in forward biased w.r.t. source, then the width of the channel increases and more current flows from source to drain, which is called as enhancement mode and it is very rarely used on D-MOSFET. Enhansement type MOSFET (E-MOSFET): The E-MOSFET, either n-type or p-type semi-conducting material, is diffused to source and drain and there is no connection between them, except a Silicon Dioxide (SiO2) layer connected to the gate pin. The gap is filled with the opposite (p-type or n-type) semi-conductor. When the gate is connected in forward biased w.r.t. source, a channel is created to connected the semiconductors of source and drain, which allows current flow between the source and drain. The width of the channel near gate (which is connected to SiO2), increases with more forward biased voltage, which in turn increases the flow of current between source and drain. So, the current flow between source to drain is directly proportional to gate voltage. Transistor Packages: Transistors are available in various packages, depends on current flow, maxiumum power and response speed (in MHz). Some of the commonly available packages are listed here. TO-3, TO-18, TO-92, TO-220, TO-220AB, TO-226, SOT-32 etc. ​ Transistor Revolution is origin for Modern electronics, Micro-controllers and Computers. – Simple Mechatronics

  • mcuMemory | Simple Mechatronics| Simple MECHATRONICSsimple mechatronics

    microcontroller - MEMORY MANAGEMENT Micro-controller (MCU) uses variety of memories, which are in-built. The size and purpose varies while execution of the program. RAM (Random Access Memory) : RAM is a volatile memory, which will be lost or reset when power is lost or Reset button of the MCU is pressed. The total RAM is logically subdivided into three parts. ​ The first part may be used used for accumulators, stack pointer, various address points used by the ALU (Arithmetic and Logic Unit) and control system. ​ The next part may be used for storing system process values, registers, status, flags used by control system. The left out part is the actual RAM used for the program variables. ROM (Read Only Memory ) : The ROM is non-volatile memory, means the data in the ROM will not be lost on power loss, unless overwritten by the programmer. The ROM is called FLASH MEMORY in micro-controllers. The Flash memory is logically divided into two parts. ​ The main part of Flash Memory is allocated tor the application program in binary code, which is loaded directly through the programmer. Some micro-controllers have option to lock the reading of the flash memory for protecting from copying by others. A small part of the Flash Memory is earmarked to save booting code or booting sequence at one of the extremes. EEPROM ( Elelctrically Erasable and Programmable Read Only Memory ) : This is also a ROM, but, it is used only to save variables either through the program or directly through the programmer. This is also non-volatile program. The values can be altered, if required, by the program. The EEPROM is useful to save settings, parameters which can be changed by the user while MCU is processing/working. Almost all compilers display the summary of actual Flash memory and RAM used for the program after compiling the code, which is useful to proper selection of Micro-controller (MCU).

  • Arduino_TYPES | Simple Mechatronics| Simple MECHATRONICSsimple mechatronics

    Arduino: Introduction & TYPES If you are new to Arduino, just go through the page and successive pages. Just have a glance on the differences in the Arduino Boards. Initially, it is not possible to have full idea about all Arduino boards. Just read on . . . Arduino is a brand name and available as development boards for quick connection and programming. Many varieties of development boards are available from Arduino. Almost all Arduino boards use one AVR micro-controller IC (or chip) on its board, with boot-loader program (pre-loaded by default). In addition to the micro-controller, the board is generally equipped with a voltage regulator IC(s) and USB interface IC. The USB interface IC is useful to UPLOAD the program code and communicate external equipment using USB port (like PC). Now (for the time being), our discussion is made limited to Make-at-Home projects. We are explaining about the Arduino boards, which are easily available and easily used for our projects. Normally, Arduino boards operates between 7VDC to 12VDC (input at Vin pin) and a crystal is used for system frequency (for on-board micro-controller). The voltage regulator IC(s) convert input voltage available through DC jack, to 5VDC & 3.3VDC output voltages, which are available on the Arduino board. You may also directly connect 5VDC supply to 5V pin on Arduino board instead of 7 to 12VDC from DC jack. (refer images below) The basic data about the Arduino boards, which are frequently used in our projects, is listed below for quick reference. The pin outs are labelled and power supply pins are marked in red and blue colours for easy identification. Arduino UNO: Arduino UNO is one of the highly used Arduino boards. Most of the Arduino starters, use Arduino Uno board initially for learning. The ATMEGA328P micro-controller is used for Arduino Uno board. Small differences are observed in Arduino Boards, which are shown here. In case of PDIP, you may replace the micro controller (ATMEGA328P) and upload BOOT LOADER to the new micro-controller. ​ In case of CH340 IC is used for USB to Serial converter, then suitable driver has to be installed on your computer. The main pin-outs of Arduino UNO is shown below for easy identification and under standing. So, some pins are connected internally to work as one or more than one function. You have to write suitable code to control the particular pin for the required functionality. It is a general practice that the code written for Arduino is called as SKETCH. ​ The Arduino Uno board is programmed through USB type-B port (normally available for USB printers) and a separate DC power supply jack is available in addition to Vin pin. Arduino NANO: Arduino NANO board is bread-board friendly pin-outs, smaller in size and frequently used for Arduino projects. Due to its compactness with most of the required features and low-cost, it is loved by Arduino programmers. For Arduino Nano also, ATMEGA328P micro-controller is used. ​ The main differences w.r.t. Arduino Uno are: 1) mini USB socket for programming. 2) two extra ADC channels A6 & A7 3) positions of pin nos 0 & 1 are reversed 4) No DC jack is available. use Vin only for power input. Arduino MEGA: Arduino MEGA board is bigger in size and frequently used for Arduino projects, where more number of digital pins are required. Almost all features and pin-outs will match with Arduino Uno, where as extra pins are available for Arduino Mega. You may replace Arduino Uno with Arduino Mega, but, reverse may not be possible, if the program uses the extra pins. The ATMEGA2560 micro-controller is used for Arduino Mega board. You may expect explanation about some more types of Arduino boards in future . . . ​ SUCCESS is, when your SIGNATURE changes to Autograph. – Dr. A.P.J Abdul Kalam

  • Op-Amps | Simple Mechatronics| Simple MECHATRONICSsimple mechatronics

    op-amp: OP-AMP (Operational Amplifier) is basically a differentiator, which reads two electrical signals as inputs and sends the output signal accordingly with amplification. OP-AMP should have at least 5 pins. i.e., ​ Non-Inverting input pin Inverting Input pin Output pin Positive power supply pin Negative (or sometimes ground ) pin The two inputs are marked as NON-INVERTING INPUT or PLUS (+) and INVERTING INPUT or MINUS (-) . The output swings towards Positive, if the signal voltage at NON-INVERTING INPUT is higher than at INVERTING INPUT and vice-versa. GAIN: Some part of output signal called as feedback is used as input signal to INVERTING or NON-INVERTING inputs to adjust the amplification factor, which is also called as gain. The range of gain varies from 1 (also called as unity gain) to infinity depending on the feedback set to the input pins. So, the value of the output will be depending on the difference in voltage at INVERTING and NON-INVERTING inputs and amplification factor (gain) set by the RLC (resistor, inductor, capacitor) circuit used between output pin to INVERTING or NON-INVERTING input pin(s) as feedback. OPEN LOOP GAIN AMPLIFIER: If the output pin does not send any feedback to any input pin, then the amplification is infinity . It is also known as saturation stage. ​ Means, a small difference in signal at INVERTING and NON-INVERTING inputs, swings the output to either Positive or Negative (ground). In this condition OP-AMP works as BISTABLE (either ON or OFF) amplifier, which may be considered as digital switch. ​ The four conditions of open loop amplifier is presented here. UNITY GAIN AMPLIFIER: Similarly, if the output signal is directly connected to NON-INVERTING input of the OP-AMP, the exact difference in the input voltage is available at output. This is called UNITY GAIN amplifier. ​ This is also called Unity Gain BUFFER, since, the output voltage matches the input voltage and the output current is amplified to drive relays and other electronic equipment with (small current) input signal. So, the main advantage and usage of Unity Gain Amplifier is, high input impedance and least output impedance. Which means, a very weak signal (with low current) will be amplified to high current output to drive other devices, where output voltage being the difference of the voltages at both the input pins. NEGATIVE FEED-BACK GAIN AMPLIFIER: A part of output signal is sent to one of the inputs, which is called as feedback. Most of the times the feedback is sent to INVERTING input, which is called as NEGATIVE FEED-BACK AMPLIFIER. There are two cases of Negative Feed-back amplifiers. In case, the input signal is connected to NON-INVERTING input, the output signal will be amplified (gain) and always more than one with maximum input impedance. ​ The Negative feed-back amplifier configuration is highly used in electronics circuits to control machinery and read & amplify weak signals. POSITIVE FEED-BACK GAIN AMPLIFIER: In case, the input signal is connected to INVERTING input through the resistance, the output signal will be inverted and amplification factor (gain) depends on the resistance network (R1 and R2). ​ Similarly, the feedback may be connected to NON-INVERTING input. The output signal is inverted and swings to extremes with small delay, which is called HYSTERESIS. This is called as POSITIVE FEED-BACK AMPLIFIER. ​ The Positive Feed-back Amplifiers are used as Latches, Oscillating circuits, Filters etc.

  • PIC | Simple Mechatronics| Simple MECHATRONICSsimple mechatronics

    PIC page PAGE IS UNDER CONSTRUCTION. ​ PLEASE ALLOW SOME TIME FOR COMPLETION. ​ SORRY FOR INCONVENIENCE CAUSED.

  • SafeCurrentGuard | Simple Mechatronics| Simple MECHATRONICSsimple mechatronics

    Safe Current Appliance Guard Safe Current Appliance Guard is useful to protect your electrical / electronics equipment / appliance / gadget from over current flow through them. The circuit can display current flow value and guard both AC and DC appliances, when the current flow them exceeds more than trip value set by you. ATTINY84 is used for the project, which is the heart of the circuit to read the current value and trip the relay in case the current flow is more than trip value, for more than one second, which is set by the user. The ADC system of the ATTINY84, continuously reads the voltage (or signal) generated by ACS 712 (hall effect) current sensor. Then the ADC value is multiplied with ACS_MF, and displays as READ CURRENT on the OLED. Before reading AC or DC current flow, the RELAY is switched ON through a transistor. Then, the ADC value is read 25 times continuously with one milli-second interval and records the peak ADC value (out of 25 samples), so that peak value of at least one full wave can be read for 50 Hz or 60Hz AC current. If the peak values, thus read, is exceeding more than three times consecutively (approximately 1.3 seconds), then the ATTINY84 switches off the relay (through transistor). ​ The full circuit diagram is available below: INITIAL SETUP: ​ Once the circuit is ready on general purpose (vero board is preferred) PCB, connect DC power supply (9V battery), then connect AVR programmer to ISP port of ATTINY84 and write/burn SafeCurrentGuard.HEX file to the micro controller. The program displays the title of the project, then displays the READ CURRENT and TRIP CURRENT values on the OLED. To set TRIP value, press SW_UP or SW_DN button. Then the OLED displays the existing Trip value. Now, you may press SW_UP or SW_DN button to increase or decrease the Trip value respectively. If, no input is found from the SW_UP or SW_DN buttons for more than 5 seconds, then the displayed value (new value) is saved to EEPROM and the Trip value is available after switch off the circuit also. ​ To calibrate the READ CURRENT value, connect an DC Ammeter or multi-meter, in current mode (10A or more), in series as shown here. Now, Restart the circuit and observe the difference in READ CURRENT value and multi-meter value in amperes. If, the value is different, then note down the percentage of error. Now, press SW_RST to restart the circuit. While displaying the Title of the project on OLED, press and hold SW_UP or SW_DN button until the current multiplication factor is displayed on the OLED screen. Now, adjust the displayed value to suit the error percentage noted earlier. Increase the multiplication value, if the READ CURRENT is low and vice-versa. The value will be saved to EEPROM, once no button is pressed for more than 5 seconds. Now, compare the READ CURRENT w.r.t. to multi-meter value and adjust the multiplication factor, till the READ CURRENT matches to the multi-meter value. Once calibrated, remove the multi-meter and reset the circuit as shown above. Now, your circuit is ready to use. If, you have no need to change the values, i.e., once calibrated and trip current value is set, then the OLED, SW_UP and SW_DN buttons may be permanently disconnected (or removed). WORKING: ​ Once calibrated and set the trip current value, then connect the actual load, in series as shown in the circuit. Then, power-on the circuit, using any conventional 12VDC power supply (using transformer) or 12VDC SMPS. The Title is displayed on OLED, then Relay is set to ON mode and continuously displays the current flow through the load, which is indicated by slow blinking of LED2 . If, at any time, the current flowing through the load exceeds the set trip value for more than one second, then the relay is set to OFF mode, the trp message is displayed and the LED2 blinks quickly. ​ You may press SW_RST to restart / reset the circuit. The LED1 indicates the presence of DC power supply. The LED3 is complementary (opposite state) to relay status. You may use this output to generate alarm using piezo-buzzer etc. ​ ​ Use shorting jumper in J1 mode, if the relay is operating on 5V and the input DC power supply may be 8VDC to 12VDC. Set in J2 mode, if the relay selected is operating on 12V and input DC power supply should be 12VDC. The current sensor ACS-712 is normally available in 5A or 20A or 30A capacities. Select the capacity/module as per the load requirement. The thick line shown in the circuit should carry the flowing current through the load. The multiplication factor depends on the capacity of ACS-712, which can be adjusted using the SW_UP and SW_DN as explained in calibration method. ​ The theoretical value of multiplication factor for 5A module is 264, for 20A module is 488 and for 30A module is 740. click the link / attachment to download the file and rename as SafeCurrentGuard.HEX , then upload to ATTINY84 using any suitable AVR programmer. SafeCurrentGuard.HEX For source code (in C-language), (SafeCurrentGuard.C) please send message through contact form . The code will be sent to your e-mail.

bottom of page