Basic electronics continued

Hello, I am back with a new blog post. You can see the first part here-
Simple things to start with first:

What’s pull up and pull down?
Pull up

It is called a pull up circuit. Why? Since when the button isn’t pressed, input is 5V(remember current is 0), and when button is pressed, input is 0V
Why do we need it? It is a way to prevent random voltages to be got as input, since the potential of air might be anything(-100V wrt the MCU ground for example)

Pulse width modulation
It is a very simple concept. In the world of digital electronics, we want to generate a lower voltage, say 1V. To do that, we alternate HIGHs and LOWs to make things think that we are giving them low voltages.
So here, a duty of 50% of period, will mean voltage of half of 5V.

Warning– Don’t use PWM for something that is rated 1V, since we don’t actually generate 1V, we give an effective of 1V, which is composed of 5V and 0V, and will mostly damage the device. We use it for motors usually, to control their speeds. You can try it out on an LED to vary it’s brightness.

Introduction to different sensors

Why would you use sensors?
To detect environment around a system, to know how to react to the outside world.

Let’s start with the very basics- Contact based sensors

Trip switch

They come in different types- We get to know when the switch is pressed, as it completes a simple circuit
Trip switches

How to use?
Very simple, COMMON terminal is our output.
One of the terminals is NC ie NORMALLY CONNECTED to COMMON when the trip switch is not pressed
Other terminal is NO ie NORMALLY OPEN gets connected to COMMON when the trip switch is pressed

Flex sensors

These are interesting sensors, we use them for detecting bending of an object. Their resistance changes with bending, so we can know the amount of bend.
Flex sensor
The diagram shows how to use them- A pull up circuit.

What can you use it for?
Flex application

Let’s explore some Contactless sensors

Simple IR sensors

They work on the basis of IR light. Black surfaces will absorb most of the IR so can’t be detected. A white surface can be detected using it.
Disadvantage- They don’t work in sunlight

IR Transmitter/ receiver
This is what the sensor contains, an IR LED and an IR receiver(the dark colored). The IR receiver is just a phototransistor which receives only IR(since it is painted dark).
IR Module
This is the module that you get in the market- wonder why such a complicated thing? Well the IR receiver generates voltages of the order of millivolts. So, we need an amplifier circuit to get an output that can be read by a microcontroller.
Well, what’s the potentiometer for?
It helps you control the amount of amplification, it depends on the light conditions around you.

TSOP sensors

These also work on the principle of IR light reflection, but they have a nice circuit to make them better than IR sensors. The IR is emitted at a certain frequency(you can think of it similar to PWM), and well the sensor just receives that frequency.
Applications- TV remotes!!
Well in this case, this sensor here is alone capable of doing the whole job, ie detecting IR at 38kHz frequency- Wow, such a small thing doing all the job!! So, what does the remaining circuit do? Well, it simply helps the IR generate a 38kHz signal. And guess how it does that? Yes, you got it right, it uses a 555 timer IC.

SHARP sensors

These are analog distance sensors, and come in varied ranges.

There are more proximity sensors based on the inductive/capacitive principles:

SONAR and Ping sensors

These are sound based sensors and give the analog distance from an object. They work with ultrasound, so normal sounds can’t interfere with them.
Usually they use serial communication to send data, but they might also use other protocols. For instance, Ping sensor has a PWM output ie it gives the sensor output using a PWM wave.


These are used to map an entire region. They used light based distance sensing.
See a LIDAR example of mapping a city:
Why would you need it? To make robots smart and navigate in an unknown region. They are used for Drones etc.


Kinect is a camera with an add on, you can get distance of each point in the image, so makes it easy to regenerate models in 3D! And yes, you can play on XBox with it too!
In this image, different colors correspond to different range of distances.
kinect display

Hall sensors

A Hall effect sensor is a transducer that varies its output voltage in response to a magnetic field


Now let’s first discuss 3 simple sensors:
Aim : See an object’s behaviour in 3-Dimensions
* Tilt sensor/Accelerometer- Acceleration of linear movement in 3 directions
* Compass sensor(magnetometer): Absolute orientation with respect to earth’s magnetic field 3 directions
* Gyroscope sensor(measure angular velocity in 3 directions)

Well, they have defects when used independently, to solve them
We use IMU, which fuses data from all the 3 into one sensor, and is more accurate than any one of them.
To totally model a system, we need to have 9 DOF(3 from each sensor)


Linear encoders : Calculate linear distances covered.
Linear encoders

Rotary encoders : Convert rotation of a shaft into electronic signals.
Rotary encoders

That’s all for today. Will write more when I get some time. See ya!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s