Posts

Showing posts from June, 2018

Serial Communication - UART

Image
Many of you would be aware about two types of communications : Serial and Parallel. Coming to Arduino, it communicates with computers or other devices using serial communication. In this type of communication, data is transmitted between two devices one bit at a time. The most common type of serial communication is UART. Introduction to UART UART stands for Universal Asynchronous Receiver Transmitter. It takes bytes of data and transmits it in a sequential fashion. At destination, a second UART re-assembles these bits into complete bytes. The communication may be simplex ( one direction only), full duplex ( both devices send and receive at the same time), half-duplex ( device takes turns to transmit and receive). For UART communication we need COM ( for communication ) ports. But modern computers does not include them and we need external serial to USB converter when using other micro-controllers. Arduino has an on board serial to USB converter so we can directly connect it to

Tech Talk 1 : Servo Motors and PWM

Image
I bring to you a new series called "Tech Talk". It will be different from my normal posts where I explain different topics. As its name says, it will be more of an informal talk where I will put forth a question or a topic and then brainstorm the answer to it ! While playing with servo motors, I came across an interesting concept of pulse width modulation connected to the servo motors which I will be discussing here. Servo library has to be called and an object has to be made in the IDE for controlling the servo motor. Once we do that we use object_name.write() and specify the angle which the servo should be turned to. Servo control is actually achieved by sending a PWM signal to the servo motor. But since there are only 6 PWM pins on the Arduino Uno does that mean we can connect only 6 servos to it ?  For comparison I used the same servo on both PWM as well as non-PWM pins on the Arduino and there was no visible performance difference ! If PWM is used by servos,

Analog and Digital Signals

Image
In this post we are going discuss something which is used in all the electronics and computers which is the Pulse Width Modulation and the concepts related to it. Logic level is the voltage level that a particular device communicates with. A common logic level that a micro-controller uses is 5V. An analog varies from 0V to 5V for example as a sine wave. So, at any point of time we can get any value between 0 and 5 volts in the case of the analog signal. On the other hand digital signal can have only two values 0V or 5V just like the on or off. Analog to Digital Digital signals are more efficient since the analog signals have a lot of noise in them. So, we usually convert the analog to digital. The analog to digital converter on the Arduino is of 10-bit which means we have 2^10 = 1024 resolutions. Thus the analogRead() reads the analog value from 0 to 5 volts and assigns it a digital value from 0 to 1023. Whereas the digitalRead() reads either high (1) or low (0). The analogWrit

Overview of ATmega328P

Image
While reading about the ATmega328, I came a across a lot of stuff which I would like to share here. There is a humongous amount of information available in its datasheet. Introduction ATmega328 is a single chip micro-controller created by Atmel. It has a In-System Self-programmable Flash memory of 32 KB, SRAM of 2 KB (2048 bytes) and EEPROM of 1 KB (1024 bytes). It has a 8-bit AVR CPU type which means they can process data in 8-bit chunk as its data bus is 8-bit wide.   It contains 23 general purpose I/O pins and 32 general purpose working registers. It has 32 single-byte registers and 8-bit RISC (reduced instruction set computer) devices and hence the name 328. The P is for ' picoPower '. It has 3 flexible timer/counter with compare modes, internal and external interupts , 6-channel 10-bit A/D converter , programmable watch dog timer with internal oscillator and 5 software selectable power saving modes. Digital communication peripherals include 1-USART, 2-SPI and 1-I