Friday, 18 January 2013

The IR Line sensor

This is a 8 sensor array of iR sensors

The Sensor Array
The sensor board consists of 8 IR sensors. The sensors are placed 1.2 cm apart from each other.Two on oboard LM324 onboard convert the anaglog signals from the IR photodiode and convert them to digital signals. There is a onboard preset to calibrate the sensors. The sensor board PCB is shown below. I used EaglePCB for the designing because it is quite easy to learn and comes free. The sensor board is single sided so it should be possible to etch at home. Just print the board to size and etch it.



The above picture is of the silk side of the sensor array. Here you can clearly see how the components have been placed in the vero board. The symbols marked with "L#" represent respective IR diodes and the symbols marked with "PD#" represent the respective IR sensors.


The solder side of the above sensor module

You need to solder your vero board according to the above given layout. Just try to relate the layout with the silside of the sensor module. Although this module has 8 sensors but in most of the competitions 3 sensors will suffice! One on the line. The other two on both sides of the line; the Left Sensor and the Right Sensor.


Wednesday, 9 January 2013

Loch Master Files for the Serial AVR Programmer


Components List

D1    1N4148  Switching Diode
D2    Zener-diode 500mW, 5.1V
D3    Zener-diode 500mW, 5.1V
T1    BC 846
R1    4.7K
R2    10k
R3    4.7K
R4    33K
R5    10K
J1     DB9-connector
-       Pointed Vero board small (ID : KS 100/4)
-       Pin strip, 6 pins (break from male berg strip)
-       Single core wires
-       Serial (Male-Female) connector

This is the Component List for building the Serial AVR Programmer. Assemble them on a Vero board (general purpose board) according to the LochMaster layouts. The layout has been optimized (for easier routing) from the Schematic for the Serial AVR Development Board which was published in my previous post.You can download them from the following link. 

Click here to download the LochMaster files for the Serial AVR Programmer.


Monday, 7 January 2013

A Low Cost Serial Programmer for AVRs


The Serial Programmer for AVR

A hardware device is required to load your program (in the form of Hex file!) into the Flash memory of the Micro-controller, after which it performs according to the program instructions inside it. The device is called a Programmer. The above circuit is of a serial programmer for AVR micro-controllers which is easy to build at a low cost in home. Most of the PC's and Laptops have a serial port, so it can be used in both with ease.

[N.B. This programmer will not work with USB-SERIAL converters. It only works with native Serial Port.]

In-System Programming 

In-System-Programming is a feature which allows programming and reprogramming of any AVR micro-controller at the end system. Simply put, if you have a micro-controller which lists that it is “In-System-Programmable” then you will be able to program it on site. Which is unlike older MCU’s which would have to be removed from the main target system and then put into a separate hardware programmer to burn their flash (loading the firmware into the flash memory). For example lets say, you need to upgrade the software version in your Android phone (i.e. if you want to install the latest Android Os.), then you don’t need to take your phone to a service centre! You can just download it and upgrade your software version right from your phone. This would be possible because the phone’s processor is “In-System-Programmable”.
"In-System Programming eliminates the physical removal of the chips from the system. This saves time, and money, both during development in the lab, and when updating the software and parameters in the field", 

The Serial Programmer
Here is the PCB etch diagram which is pretty simple and can be etched easily by toner transfer or any other method of PCB etching. Or you can even try to solder the components on a pointed vero board according to the PCB layout.
PCB layout for Etching.


You can connect your serial programmer to an Atmega 8 as shown in the following figure. [Image courtesy : electronics-diy.com]

You can also build a simple socket board for programming your Atmel AVR 8 (you can also have an ISP connector for your development board according to the programmer ISP layout and then you can directly plug in the programmer to your board) as shown in the following picture. [Image courtesy : electronics-diy.com]

Socket PCB for an AVR Atmega 8

Extra bit (For Advanced Readers)

Most AVR devices have a facility known as SPI which stands for Serial Programming Interface. This is the functionality that allows us to program (load the firmware in the flash memory of the MCU) the micro-controller.
The SPI is a pretty simple programming interface (the hardware philosophy behind loading the flash memory with the firmware) which incorporates only three wires. The serial programming interface (SPI) consists of three wires: The MISO (Master Input-Slave Output) line, MOSI (Master Output-Slave Input) line and the SCK (System Clock) line.
Here in this serial programmer we have used these three SPI lines along with the Ground, VCC and Reset pin.
While programming the AVR, the in system programmer always operates as the Master mode, and the target system always operates as a Slave mode.
The In-System Programmer (Master) provides the clock for the communication on the SCK Line. Each pulse on the SCK Line transfers one bit from the Programmer (Master) to the Target (Slave) on the Master Out – Slave In (MOSI) line. Simultaneously, each pulse on the SCK Line transfers one bit from the target (Slave) to the Programmer (Master) on the Master In – Slave Out (MISO) line.
The programmer is quite simple and it is based on the SI-Prog from the author of PonyProg software. The Zener diodes D2, D3 with the resistors R1, R3 reduce the voltage from the ouput pins DTR, RTS on the serial port to around 5V which is suitable for microcontroller (MOSI, SCK). MISO signal is connected directly to the input CTS pin. The Zener diode D1 with the resistor R2 drive the NPN transistor T1, which controls the RESET signal. The AVR microcontrollers are in reset when the signal has low level. The resistor R5 works as a pull-up for reset signal. 

Software 

PonyProg software is required to program using this serial device. Its an open source software hosted by http://www.lancos.com/prog.html

Click here to download the Eagle files for the Schematic and the PCB layout. [This link will soon be available- check this space!]



Saturday, 14 July 2012

A STUPID LINE FOLLOWER ROBOT


Some of us hate programming. For them there is a catch word “KISS”, which stands for “Keep It Simple And Stupid”. Here our objective will be to build a simple and stupid line follower robot that doesn’t even require a microcontroller (and hence no programming!). The question now arises that if we do not use a microcontroller then how would the robot process the information that the sensors will feed it? Well the answer lies in us, humans. We are by far the most intelligent of all species on this planet. Let’s see how, we can make our own logic and drive the robot.

Required Component List

  1. A L293D Motor Driver IC
  2. IR Sensor Array(Construction details are in my published book)
  3. 2 DC Motors (300 RPM)
  4. 2 Wheels (12 cm)
  5. Castor Wheel (3-4 cm diameter)
  6. Cardboard Base (12x15 cm)
  7. Motor clamps (To fix the motors on the chassis)

The Stupid Line Follower Logic

So here we are again at the point where humanity has always been thrown to, simplifying the complexity of nature. Have you ever given it a thought about the logic you use while driving a car on the road? Actually you may not have thought about it, but there is a particular logic we follow while we drive a car on the road. The logic is called the line follower logic. Ok, let’s get into more details now.
IF(Left side of the car is about to touch the left side of the road)
Turn Right:
ELSE IF(Right side of the car is about to touch the right side of the road)
Turn Left;
ELSE
Move straight;

We will use the same logic to drive our own robot, here the sensors will serve as the eyes of the robot and the motor driver IC (L293D) will drive the wheels(Motors).
The whole logic can be divided into two parts:
  • Sensing
  • Controlling

For the sensing part, we will use two IR Sensors. The IR sensor has been described in my previously published book on "Line Follower Robot". One IR sensor on the left side of the robot and the other one on the right side. On white surface they give a “HIGH” output, and on black surface they give a “LOW” output.
The controlling part could be handled by the L293D motor driver IC.

Implementing The Logic On Hardware

We will have two IR sensors mounted one at the left side and the other on the right side of the robot base. The output from each IR sensor will be either “HIGH” or “LOW” based on whether it is on a white surface or a black surface. The sensor outputs has to be connected to the motor driver IC in such a way that when both the sensors are on the white surface they must drive both the motors forward i.e. the robot must move forward.
Connections for the line follower

Note: Not connected pins are set to low by default. i.e., they will be at 0V.

Construction

Sensor Placement and Assembly

Now all that you need to do is to assemble all these parts together into the cardboard chassis as shown in the above figure. Fix the sensors in the front and connect the motors as shown in the above diagram. The sensor outputs from the two sensors must be connected to pins marked as A and B. The pins 4,5,12 and 13 of the motor driver IC are to be connected to the ground. Another important thing is that the ground of the individual sensors must be made common to the whole circuit, including the power supply ground.


Logic Testing

Lets check whether the logic we devised earlier works to drive the robot or not.
The motors are to be connected in such a way that both the motors will pull the robot forward if both the sensors are "ON". You will have to figure out the right combination of connecting the motor wires
  • Case I: Both the sensors are on the white surface (i.e., both are giving output as 'high'). In this case the robot will move forward.
  • Case II: Left sensor is on white and right sensor is on black. In this case robot will take a right turn simply because right motor will stop rotating as both its inputs C and D are low.
  • Case III: Left sensor is on black and right sensor is on white. In this case our robot will take left turn as the left motor will stop rotating as both its inputs A and B are low.
  • Case IV: Both the sensors are on black (i.e., there is a cross or divergence). In this case both the motors will stop, ultimately the robot will stop at this point (as both the sensor outputs are low)
All the four cases that are discussed above are the only possible conditions for a line follower.

We have just finished the Line Follower robot in a very interesting way. Logic is that the motors will act  according to its corresponding sensor, i.e., left motor will be OFF when the left sensor is OFF and ON when the sensor is ON. Same conditions hold true for the right motor as well. Hence, the motor is controlled by its corresponding sensor only. This logic will always work in any kind of line follower. Now its time to create a line follower arena of your own and test the robot.