Sunday, December 9, 2012

Quiz on digital basics

Digital Basics Quiz

Digital Basics Quiz

  1. Which of the following is not a weighted code ?

  2. XS3
    BCD
    Decimal
    Hexadecimal

  3. A decoder is a

  4. Combinational Circuit
    Seuential Circuit
    Neither
    Could be both

  5. Carry look ahead adder is faster than ripple carry adder

  6. True
    False
    Both operate at same speed
    Depends on input

  7. The truth table of "sum" of a half adder is same as

  8. OR gate
    AND gate
    XOR gate
    XNOR gate

  9. If the inputs to an NAND gate are negated, it becomes equivalent to

  10. AND gate
    OR gate
    XOR gate
    NOT gate

  11. A 64:1 Mux will have how many select lines ?

  12. 64
    4
    8
    6

  13. A circuit that converts input Decimal to BCD is a

  14. Encoder
    Decoder
    Mux
    Demux

  15. To perform BCD addition using an IC meant for adding Binary numbers we need to

  16. Add 6 to the all result obtained from the binary addition
    Subtract six from all the results obtained from the binary addition
    Add 6 to the all results greater than 9, obtained from the binary addition
    Subtract six from all the results greater than 9, obtained from the binary addition

  17. Convert the binary number 1111 to its grey code equivalent

  18. 1001
    1000
    1111
    1010

  19. In a 1:8 DEMUX if select lines are 011 and Data input is 1, output will be available on

  20. Line 0 of output
    Line 3 of output
    Line 2 of output
    Line 7 of output

Hope you had fun.


Wednesday, July 11, 2012

Answers to Basic Embedded Systems quiz

Answers to Basic Embedded Systems quiz

1. A volatile memory is one in which
Ans. data is lost if power is removed

2. Which as more number of transistors SRAM or DRAM
Ans. SRAM

3. Super Speed usb is part of
Ans. USB3.0

4. PWM is generally used to control
Ans. A DC motor

5. Cache is made of ____ kind of memory
Ans. SRAM

6. If the length of wires being used for communication is too large then
Ans.Serial communication is preferable

7.Parity bit is used for
Ans.Error Detection

8. Which of the following is a serial communication protocol
Ans. CAN

9. DMA stands for
Ans. Direct Memory Access

10. Generally when the time of watchdog timer expires,it causes
Ans. System reset


Wednesday, June 27, 2012

Basic Embedded Systems quiz

Basic Embedded Systems quiz

Basic Embedded Systems quiz

This is a quiz on basics of embedded systems
  1. A volatile memory is one in which

  2. data is lost if power is removed
    data is not lost if power is removed
    data can be written only once
    data can be erased using UV rays

  3. Which has more number of transistors SRAM or DRAM

  4. SRAM
    DRAM
    Both have the same number
    Could be either

  5. Super Speed usb is part of

  6. USB3.0
    USB2.0
    USB OTG
    All of them

  7. PWM is generally used to control

  8. ADC
    A DC motor
    Microcontrollers
    MMU

  9. Cache memory is made of ____ kind of memory

  10. EPROM
    Flash
    DRAM
    SRAM

  11. If the length of wires being used for communication is too large then

  12. Parallel communication is preferable
    Serial communication is preferable
    Both are same
    Should be combined and used

  13. Parity bit is used for

  14. Error counting
    Error Correction
    Error Detection
    Handshake

  15. Which of the following is a serial communication protocol

  16. Bluetooth
    IEEE802.11
    PCI
    CAN

  17. DMA stands for

  18. Discrete Memory Access
    Direct Memory Access
    Direct Multiply Accumulate
    Dual Memory Access

  19. Generally when the time of watchdog timer expires,it causes

  20. System reset
    System to go to sleep
    System to crash
    System to continue its normal operations.

Answers can be found at : Answers to Basic Embedded Systems quiz

Saturday, May 12, 2012

Controlling a led using temperature sensor (lm35) and arduino

The lm35 is a simple temperature sensor whose signal can be used to find you the temperature of what ever the lm35 chip is contact with .

Steps to convert the lm35 signal to temperature

  • lm35 outputs 10mv/degree Celsius.
  • When this analog signal is connected to the arduino, it converts the signal to a value between 0-1023.
  • The voltage range of the arduino analog pin is 0-5V.
  • Thus if the arduino board reads 0 at the sensor pin it means there is 0V as input and if it reads 1023 it means the input is 5V.
  • A value in between 0-1023 indicates a value in between 0-5V, which can be calculated by the formula



For eg if the value read is 58 then the input voltage would be



Once we have the input voltage it can be converted to temperature using the information that for every degree celsius lm35 output is 10mV.
Thus for an input voltage V volts temperature would be (to convert volts to mV multiply it by 1000)



Thus for the above example the temprature would be



In this post we will see how lm35 can be used to light up leds when a certain limit of temperature is reached.
We will need

  • Two leds
  • Two resistors (220ohm) (Value chosen randomly)
  • lm35
  • arduino uno
Goal:

Light up led1 when the temperature is below 30 degrees and led2 when the temperature is above 30 degrees.

Connections

The bread board and schema of connections are shown in the figures below.



Working:

Analog I/O A0 acts as input
Digital I/O 2 and 4 act outputs.
we read the analog signal at A0, convert it to temperature using the steps shown above. compare the temperature with 30
Set the pins 2 and 4 based on the result of the comparison.

Program :



Load the program into the arduino uno board and depending on the surrounding temperature one of the two leds should glow , we can modify the temperature by holding it between our fingers or placing it near something warm etc.


Friday, May 4, 2012

Controlling a robot just by thoughts

The scientists at the Federal Institute of Technology in Lausanne, Switzerland demonstrated how a robot can be controlled jut by thoughts and than too over a distance of 100KM.

In the experiment a partially quadriplegic person wearing a head gear, which reads his brain's signals, was able to control a robot just by thinking. That is, if he thought about lifting a finger the robot would lift its finger and so on.

Such experiments have been going on for a while in various countries but this was the first occasion where a paralyzed person could control a robot by his thoughts, with out having to have any thing implanted into his body.

One of the major problems in thought controlled robots has been to be able to pick the right signals from the brain, and for the user to remain completely focused on the task as even small distractions can send wrong signals to the robots.

According to Duc, who was the person who controlled the robot found it easy to control it when he was not in pain. Indicating that the system would still struggle if the user's mind is not completely focused on controlling the robot.

The age old proverb says "Think before you leap", but if are the one controlling this robot you will have to "Think before you Think"

Sources:
https://plus.google.com/u/0/118292867302583509179/posts/DUdixZW9oJ9
http://consciouslifenews.com/swiss-scientists-demonstrate-mind-controlled-robot/1127731/

Thursday, May 3, 2012

Cache memory animation

The cache memory is defined as the first level of memory after an address encounters after it leaves the processor. In the memory hierarchy, it is placed right below the processor registers as shown in the figure below.

The following animation shows the traversal of address along the memory hierarchy.



The higher the data is found in the hierarchy the faster it can be fetched by the processor.

The cache is generally made up of SRAM because of the high speed of operation of SRAMs and the faster a cache operates, faster data can be made available to the processor for processing.

The cache stores in it the data of memory locations that the processor uses repeatably or is expected to use very soon in future. When the processor wants to access data of a certain memory location, the data might be present in cache or not, this is defined by the terms cache hit and cache miss respectively.

Note: In the examples below we assume the cache to be made of 8 blocks and main memory to be made of 32 blocks.
A block is the minimum amount of memory that is accessed in on operation, it could be one byte or one word etc depending on the design of the cache.


Cache miss: When the processor does not find, the memory location which it wants to access, stored in the cache it has to fetch the data from the main memory. As the data is missing in the cache this is termed as a cache miss. The following animation depicts a cache hit



Cache hit: On the other hand if the memory location is present in the cache, processor can fetch the data from cache itself and need not go to the main memory to fetch it. This is termed as a cache hit. The following animation depicts a cache miss.



The design of applications as well as the cache should always aim to achieve as high a cache hit ratio as possible.

To able to store the data in the cache in such way as to maximize the cache hit two principles are made use of, temporal locality and spatial locality.

Temporal locality : A memory location accessed once will be accessed again soon and hence need to be stored close to the processor.
The following animation depicts the working of temporal locality



Spatial locality : The memory locations around the memory that the processor accesses might also be accessed by the processor soon and hence need to stored close the processor in the cache.
The following animation depicts the working of spatial locality.




Tuesday, May 1, 2012

Reaction timer using arduino

A reaction timer is the one that measures the time we take to react in response to an external event.

In this post we will design a basic reaction timer using arduino board.

The external event is the glowing of an led, upon which the user has to press the pushbutton. The time difference between the lighting of the led and the user pressing the button is the reaction time of the user.

We will need


  • An led 
  • A push button or switch 
  • 2 Resistors 220 ohm or higher ( value taken randomly) 
  • An Arduino uno board


Connections:


  • Connect the anode of led to digital I/O pin2 and cathode to the ground through the resistor
  • Connect one end of the pushbutton to 5V of the arudino and the other end to digital I/O pin 7 and to ground through the resistor.
  • The bread board as well as the schematic connections are shown in the figures below.




Working :


  • Digital I/O pin2 acts as output and digital I/O pin7 acts as input.
  • The led connected to digital I/O pin2 should be turned on after some random interval .
  • As soon as the led is turned on the user should press the push button, which is connected to digital i/o pin 7
  • The Push button sends a high to pin 7.
  • While waiting for the press of the push button the program calculates the delay in miliseconds.
  • Once the high on pin 7 is recieved it the delay value is printed to the serial window.


Program :

The random function returns a random number between 0 and the number passed as argument to it, using this we can make sure that the on each iteration the led lights up at random intervals.

The while loop keeps waits for 10 milliseconds before checking the state of the pushbutton, a variable,timer, is incremented on each iteration.

After recieving the high on pin 7,the delay value in milliseconds is written to the serial window.

Wednesday, April 25, 2012

Circuit to understand the working of a xnor gate

The same circuit that was built in the post "Circuit to understand working of and gate"can be made to work as a xnor gate too, just by modifying the program.

The xnor gate is high only when all of its inputs are the same which is just the negation of an xor gate. Here is the modified program to implement an xnor gate, which is just adding a negation to the if condition in the program for xor gate.



Note: The truth table and animation of xnor gate can be found in the post "Animation of a xnor gate"

Now the led3 should turn on only when both the inputs are high and should remain off when he inputs differ.

Circuit to understand working of a "xor" gate

The same circuit that was built in the post "Circuit to understand working of and gate"can be made to work as a xor gate too, just by modifying the program.

The xor gate is high only when one of its inputs is high but not both. Here is the modified program to implement an xor gate using the same circuit.



Note: The truth table and animation of xor gate can be found in the post "XOR gate animation"

Now the led3 should turn on only when one of the inputs are high and should remain off if both inputs are low or both inputs are high.

Circuit to understand working of a "nor" gate

The same circuit that was built in the post "Circuit to understand working of and gate"can be made to work as a nor gate too, just by modifying the program.

The nor gate is negation of the or gate, hence we just need to add a negation to the "if" condition in the previous program of or gate in the post Circuit to understand working of and gate Here is the modified program:



Note: The truth table and animation of nor gate can be found in the post "NOR gate animation"

Now the led3 should turn on only when both the inputs are low and should remain off in all other conditions.

Circuit to understand working of a "nand" gate

The same circuit that was built in the post "Circuit to understand working of and gate"can be made to work as a nand gate too, just by modifying the program.

The nand gate is negation of the and gate, hence we just need to add a negation to the "if" condition in the previous program of and gate. Here is the modified program:



Note: The truth table and animation of nand gate can be found in the post "NAND gate animation"

Now the led3 should turn off only when both the inputs are high and should remain on in all other conditions.

Tuesday, April 24, 2012

Circuit to understand working of an "or" gate

The same circuit that was built in the post "Circuit to understand working of and gate"can be made to work as an or gate too, just by modifying the program.

Here is the modified program:



The only change is in the "if" condition where the inputs are being "ored" in this program.

Note: The truth table and animation of or gate can be found in the post "animation of an or gate"

Now the led3 should turn on, when either of the switches, switch1 or switch2 are turned on and also when both the switches are turned on.

Circuit to understand working of and gate

In this post we will look at a small circuit using arduino which can be used to understand the working of the basic logic gates.

We will require

3 Leds
3 Resistors 220 Ohms or higher (Value picked radomly)
Arduino uno board
Breadboard and wires.
2 buttons or switches.


Circuit:

Connect the anode of 2 leds(led1,led2) to the +5v and cathode to one end of the button.
Connect the second end of the buttons to ground through the resistor.
From the end of the button which is connected to the resistor connect one of the switch to digital I/O pin2 and one to digial I/O pin 3.
Connect the anode of third led(led3) to digital I/O pin 7 and the cathode to ground through the resistor.
The bread board as well as the schema view of the connections are shown in the figure below.



Working:

The two switches connected to pins 2 and 3 through the leds act as inputs and the third led connected to pin 7 act as the output.

Woking as And gate :
In an AND gate the output is high only when both the inputs are high.
Note: Truth table along with animation can be found in the post "Animation of an and gate"
Thus the led3 should light up only when both switches are closed that is both led1 and led2 are glowing.

Program:

and:



In the main loop there is an if condition which ands the two inputs of switch1 and switch2 thus making the circuit work like an and gate.

Thus only when both switch1 and switch2 are closed the led3 three will light up. If only one of the two switches is close the led3 does not light up.

The same circuit can be extended with any number of inputs by just modifying the if condition in the program.

Thursday, April 19, 2012

Serial Leds using arduino

In this post we will see how we can use arduino to make a set of leds glow in a serial fashion that is one after the other.

We will use

  • 4 leds
  • 1 push button
  • 1 1kohm resistor(Value picked randomly)
  • Arduino uno board.



Connect the anodes of the 4 leds to 4 digital I/O pins on the board say pin numbers 2,3,4 and 5.

Connect the one side of the push button to digital I/O pin 7 .

Connect the other side of the switch to ground through the 1K resistor.

Connect the cathodes of all the leds also the the ground, you can add a 220 ohm resistor while connecting to the ground.

The bread board and the schema connections are shown in the figures below.

In the program :

Pins 2,3,4, and 5 will be set as outputs

Pin 7 will be set as input.

The push button is used to control the order in which the leds glow i.e. 1,2,3,4 or 4,3,2,1.

We write two functions,direction1 and direction2, to light up the leds. One for each direction/order.

In both the functions we start by writing a HIGH to the first pin, pin 2 or pin 5, and wait for one second before writing a low.

Next we do the same to the pin next to it i.e. pin 3 or 4 .

We repeat the steps for all the four pins and again start from the first one.

In the loop, we keep checking for the input from push button.

On receiving a HIGH from the push button, the HIGH is noted by the chaging the value of variable alt.

Using the value of alt we change the direction of leds by calling the relevant function, i.e. if alt his HIGH led would glow in one direction else in the other direction.

serial_leds:



Load the above program into arduino and connect the power. We should see the leds lighting up one after the other, to change the direction press and hold the push button atleast for 5 seconds as the control comes back to the loop only after finshing the function it is executing.

Tuesday, April 17, 2012

Alternating between a buzzer and an led using a push button and arduino

In this post we will control a led and buzzer using a push button and aroudino uno, turning them on alternately i.e. on one push of the button led is turned on buzzer is turned off and in the next push the led is turned off and buzzer is turned on.

Here are the circuit connections in the breadboard view and the schema view.


The led is connected to digital I/O pin 7 which will be set as digital output

The buzzer is connected to digital I/O pin 3 which will also be set as digital output

The digital I/O pin 2 acts as the input and is connected to the switch.

Each time the push button is pressed it sends a high on the pin 2 which on being read as high, pin 3(buzzer) is set to the value of the variable alt, which starts with a HIGH, and the pin 7(led) is set to negation of alt( !alt ) which will be LOW.

In the next iteration alt starts with LOW and the opposite happens, led gets a HIGH, the buzzer gets a low.

Thus the output switches between the led and buzzer on each push of the button.

Here is the program for the same.

buzzer_led:



Compile and load the above program into the aroudino board and on each press of the button the buzzer and led should turn on alternately.

Monday, April 16, 2012

Making push button work as a switch using arduino

In this post we will look into how we can user a push button like a switch, i.e. it turns on a circuit on one push and turns off the circuit in the next using an arudino uno board.

The circuit that we will use is the same one used in "Controlling a buzzer with a push button" but the program will be modified.

In this program we will have boolean variable,alt,which will be used to control the output at pin 3. Let us say we set the variable "alt" to HIGH intially.

Each time the push button is pressed the variable is used the set the output at digital I/O pin 3 :

Then the value of the variable is negated :

Thus value of alt changes to LOW.

In the iteration when the push button gets pressed again the negated value is applied to the pin 3, changing the value at pin 3 from HIGH to LOW.

The same steps are repeated again and again.

The output at pin3 thus will keep switching between the HIGH and LOW states at each press of the push button, just like the operation of a normal switch. Here is the program for same In the above program, there is a delay after the digitalWrite becuase otherwise the processor will loop through the interations at a very fast rate and we will not be able to view the desired operation.

Also note the delay if of 1 second so if the pushbutton is pressed more than once with in a second the output behaviour can not be garunteed.


Friday, April 13, 2012

Controlling a buzzer with a push button using arduino

Here is a small example of how we can control a buzzer using a push button using the arduino uno. This is just an small extension to the example of button available at ardunio site http://arduino.cc/it/Tutorial/Button.

We connect one side of the push button to 5V by connecting one of the two legs to the 5V pin on the board.

The other side of the push button is connected to the ground using a 1K ohm resistor.

The same end of the resistor which connected to ground is also connected to the digital I/O pin 2

The digital I/O pin 3 is connected to the positive leg of the buzzer and the negative leg is connected to the ground.

The following breadboard and schematic figures show the connections.

Program:

The pin2 acts a digital input.

The pin3 acts as digital output.

Whenever the push button gets pressed a high is sent to pin2 which is read as as input and whenever a high is read on pin2 a high is sent on pin3 which turns the buzzer on. Hence making the buzzer beep whenever the push button is pressed.

Thursday, April 12, 2012

4 legged Push button: Working

4 legged push buttons are quite often used in circuits of embedded systems.

But some times , especially for beginners, it gets confusing to understand how should the button be connected and which leg is meant for which connection.

Here is small animation that tries to make the internals a little clear.

A 4 legged push button connected on breadboard can be viewed as shown below.

The legs 1 and 2 are shorted internally in the button and so are the legs 3 and 4.



So when the button is pressed, we are internally shorting all the 4 legs together, meaning, when the button is pressed all the 4 legs are connected to each other and when the button is not pressed, the legs 1 and 2 are connected to each other and 3 and 4 are connected to each other. (Please note the numbering is hypothetical and are not mentioned on the switches).

If it still gets confusing, we can use a multimeter to find out which legs are shorted internally.

Keep the multimeter in the mode where it beeps when shorted and just connect one pin of the multimeter to one of the legs and touch the other pin to all the other 3 legs. On touching which ever other pin the multimeter beeps that is the pair which are shorted and so is the other pair.

Hope using a push button becomes much more easier now .

Wednesday, April 11, 2012

Animation of xnor gate

An XNOR gate is a one whose output is high only when all its inputs are the same, i.e. either all the inputs are low or all the inputs are high. In all other cases, when the inputs don't match, the output remains low. It can be looked at as a combination of a XOR and NOT gate.
It is represented by the symbol
The following truth table and animation depict the operation of the XNOR gate.

Monday, April 9, 2012

Animation of XOR gate

An XOR gate, which stands for exclusive or, is a gate whose output is high only when one of its inputs is high but not all are high. In the conditions of all the inputs being high or low the output is also low. It is represented using the symbol
The following truth table and he animation depict the operation of an XOR gate.

NAND gate animation

A NAND gate can be viewed as a combination of an and and not gate. Thus the output is low only when all the inputs are high else the output remains high for all other input conditions.
The NAND gate is represented using the symbol.
The following truth table and the animation depict the operation of NAND gate.

nor gate animation

A NOR gate is a gate that acts like a combination of an or gate a not gate
The output of the NOR gate is high only when all its inputs are low, in all other conditions the output of the NOR gate remains low.

The NOR gate is represented by the symbol:
The following truth table and the animation depict the working of a NOR gate.

Animation of Not gate

NOT gate is a basic gate whose output is always the inverse of the input, that is if the input is "1" the output would be "0" and if input is "1" output would be "0". There is only one input to the note gate and is represented using the following symbol.



The following truth table and the animation depict the operation of a not gate.



Sunday, April 8, 2012

Animation of an or gate

An or gate is a basic gate whose output goes high when any one of its input is high, and the output is low only when all the inputs are low.

The or gate is represented using the symbol :

The following truth table along with the animation depicts the working of a two input or gate.


Friday, April 6, 2012

Animation of an and gate

An and gate is a basic logic gate whose output goes high only when all its inputs are high and in no other condition.

An and gate is represented using the symbol



The following truth table and animation depict the operation of a two input and gate.


Follow by Email