Wednesday, August 4, 2010

Austere Ni-Cad Cell Charger

This simple,low cost ni-cad cell charger can charger up to two AA or C sized cells at one time at the standard rate of 40 mA.The unique feature of this charger is its extremely compact size and transformer less design(unlike others),hence ending up in the form of a neat and compact little module.There is provision for mounting the cells to be charged within the PCB (hence no external wiring is needed ,thus eliminating chance of failures due to snapping of wires etc).This enhances the utility all the more as the charger can then be used as a rechargeable power pack that can be used to replace the original battery holders in equipment such ac pocket radio etc.to make them rechargeable.The circuit employs the PCR (periodic current reversal) method of charging which increases cell life
.
R1 is used as a surge protector.C1 works as a series dropper.The dropped voltage is rectified and converted into DC by diodes D1 through D4.C2 provides the necessary filtration.The final voltage is applied to the cells for charging.R4 through R7 generate the PCR effect by allowing current in direction opposite to the diodes to pass in minute proportion,it may create the effect just the opposite that desired,These resistors may be simply left out if the normal charging procedure is to adopted.


 The Schematic Austere Ni-Cad Cell Charger

As C1 may be charged to fatally high voltage, an 820 kohm shunt resistor is used to discharge it when the power is turned off.The LED D5 along with R2 provide pilot indication as well as a"don't touch warning indication.
Read more >>

Tuesday, July 27, 2010

This circuit is an ISP Flash Programmer (Schematic parallel downloader)

Schematic parallel downloader


This circuit is used on the ATMEL Microcontroller IC. However, the circuit is used for Microcontroller AT89Sxx. and ATMEGA xxx if you know about MISO,MOSI,SCK AND  RESET


Read more >>

Sunday, July 25, 2010

Graphic LCD

Done working on Graphic LCD (GLCD) interfacing with 89c51. Here is exapmle  asm file and hex code file.
And following are the connection pattern for GLCD and 89c51.



Read more >>

89c51 Microcontroller


8051 Microcontroller is a programable device which is used for controlling purpose.
Basically 8051 controller is Mask porogramble means it will programed at the time of manufacturing and will not programed again, there is a derivative of 8051 microcontroller, 89c51 microcontroller which is reprogramable upto 10000 times, here is small discription abot the 89c51 microcontroller.
It have 4 ports which are used as input or output according to your need.
These prots are also programmed as bit wise pattern, means you can use each bit of microcontroller saperatelly as input or output.
This 89c51 is 8-bit device mean each port have 8-bits for I/O, total of 32-bits in the controller.
This device also have Timer, Serial Port interface and Interrupt controlling you can use these according to your need.
This device have 4K of ROM space to store the program,and 256Bytes of RAM space, this device have ability to interface with TTL based devices and also with the external MEMORY to increase its data space, but when your are using external MEMORY the 2 ports of 89c51 microcontroller are used for this purpose.

source
Read more >>

ISP Flash Microcontroller Programmer

Introduction

 This ISP Programmer can be used either for in-system programming or as a stand-alone spi programmer for Atmel ISP programmable devices. The programming interface is compatible to STK200 ISP programmer hardware so the users of STK200 can also use the software which can program both the 8051 and AVR series devices.

Hardware
Figure 1 shows the circuit diagram of the in-system programmer interface, the power to the interface is provided by the target system. The 74HCT541 ic isolate and buffer the parallel port signals. It is necessary to use the HCT type ic in order to make sure the programmer should also work with 3V type parallel port.


                Figure 1: Circuit Diagram of the ISP Programmer Interface

Figure 2 shows the circuit diagram of the stand-alone spi programmer, the power to the interface is provided by the PC USB port which can supply a max of 100mA current. Get a cheap USB cable, cut the cable other end connector and attach a crimp shell connector to this end, red wire is 5V and black is 0V.

The printer port buffer interface is same as shown in figure 1. For the u-controller a 40 pin ZIF socket can be used.

This programmer circuit can be use to program the 89S series devices and the AVR series devices which are pin compatible to 8051, like 90S8515. For other AVR series devices the user can make an adapter board for 20, 28 and 40 pin devices. The pin numbers shown in brackets correspond to PC parallel port connector.

                    Figure 2: Circuit Diagram of the SPI Programmer

Software
The ISP-30a.zip file contains the main program and the i/o port driver. Place all files in the same folder.
The main screen view of the program is shown in figure 3.

Also make sure do not program the RSTDISBL fuse in ATmega8, ATtiny26 and ATtiny2313 otherwise further spi programming is disable and you will need a parallel programmer to enable the spi programming. For the fuses setting consult the datasheet of the respective device.

For the auto hardware detection it is necessary to short pin 2 and 12 of DB25 connector, otherwise the software uses the default parallel port i.e. LPT1.

Following are the main features of this software,

Read and write the Intel Hex file
Read signature, lock and fuse bits
Clear and Fill memory buffer
Verify with memory buffer
Reload current Hex file
Display buffer checksum
Program selected lock bits & fuses
Auto detection of hardware


Note:
The memory buffer contains both the code data and the eeprom data for the devices which have eeprom memory. The eeprom memory address in buffer is started after the code memory, so it is necessary the hex file should contains the eeprom start address after the end of code memory last address i.e. for 90S2313 the start address for eeprom memory is 0x800.

The software does not provide the erase command because this function is performed automatically during device programming. If you are required to erase the controller, first use the clear buffer command then program the controller, this will erase the controller and also set the AVR device fuses to default setting.


Download
ISP-Flash Programmer Software ISP-30a.zip

                  Figure 3: Main screen of the program ISP-Pgm Ver 3.0a

source
Read more >>

Friday, July 23, 2010

I, Robot' Will Blow Your Circuits

Get ready for all your circuits to be blown by "I, Robot," an adrenaline rush of a movie that actually excites your mind as it excites your senses.
Debra Scott 
Columnist Graphic In 1950, Issac Asimov -- one of the most famous, inventive and humanistic writers of science fiction -- set down the Three Laws of Robotics in his series of short stories, "I, Robot."1. A robot may not injure a human or, through inaction, allow a human to come to harm.
2. A robot must obey orders given to it by a human, except where it would conflict with the first law.
3. A robot must protect itself, as long as that protection does not violate either the first or second law.
I,Robot: CU Robot Ever since Asimov first wrote those words, many films about robots have used his laws as a blueprint and then theorized what would happen if a robot started to evolve and deviate from its hardwired programming."I, Robot," the movie, takes that premise and then leaves the rest of the robot movies in the dust with its involving murder mystery plot. "I, Robot" has a challenging, complex story structure, characters whose pasts fit together like a jigsaw puzzle and a comforting meld of the familiar and the futuristic in its Chicago 2035 setting. Two characters were taken from Asimov's stories -- robotics pioneer Dr. Alfred Lanning (James Cromwell) and a younger version of Dr. Susan Calvin (Bridget Moynahan), who specializes in the psyches of robots.I, 
Robot: Will In Robots Will Smith plays Det. Del Spooner (who is not a character in Asimov's stories), just about the only cop on the police force who doesn't believe robots are completely harmless -- an attitude that doesn't play well with his boss, Lt. John Bergin (Chi McBride).On the eve of a major rollout of the next generation of robots -- the NS-5's -- Lanning apparently commits suicide and leave behind a holographic message for Spooner. As Spooner pursues breadcrumbs of information, his investigation pushes him closer to the realization that his worst fears could be closer to the truth than anyone could ever imagine.I, 
Robot: Robot With LeadsSmith is absolutely spectacular as the haunted detective. His pumped-up body from "Ali" is still intact, but so is the wit, sensitivity and emotion he has revealed in his other films. Everything he has done has culminated in this mysteriously complex character.At times, the stunts are a little too far-fetched for any human to make believable, but who cares? It's cool, and so are the almost translucent-faced robots -- one of whom, Sonny, is almost irresistable with its childlike curiosity and human-like need for approval. But can it be trusted?Moynahan does an adequate job with the limited role she has been given, playing the robot-believer to Smith's robot-doubter. But this movie is really about Spooner and the robots.Asimov devotees should know that that the movie only takes ideas and characters from the book and those ideas are combined with a previously written script titled "Hardwired."Is it possible that robots could actually evolve to the point where they could come up with their own interpretations of the 3 Laws, or is that just an invention of screenwriters? "I, Robot" is a provocative, exhilarating peek into an unsure future that serves as sobering warning against letting technology take too much control over our lives.


source
Read more >>

Program control PWM for microcontroller

 This program can control motor dc for micorocontroller at mega 8535 .It is make with AVR studio 4
 
#include
#include
#include

#define    DDR_motor    DDRD    //DDR inilisiasi for Motor
#define    PORT_motor    PORTD    //PORT inisialisasi Motor

#define en_ka         5        // Enable L298 for right motor
#define dirA_ka     2        // Direction A for right motor
#define dirB_ka     3        // Direction B for right motor 

#define pwm_right    OCR1A

void delay_ms(int ms)
{for (int i=0;i

void foward(unsigned int pwm)
{
PORT_motor |=(1<
PORT_motor &=~(1<
pwm_right=pwm;                    //pwm for right motor
}

void backward(unsigned int pwm)
{
PORT_motor |=(1<

PORT_motor &=~(1<
pwm_right=pwm;                    //pwm for right motor
}


int main (void)    // excetion
{

DDR_motor=0xFF;
PORT_motor=0x00;


    TCCR1A= (1<<
            (1<<
            (1<<
           
    TCCR1B= (0<<
            (0<<<
    TCNT1=0x0000;
    OCR1A=0;
    OCR1B=0;
    sei( );


while(1)
{
backward(1000);
delay_ms(5000);
foward(700);
delay_ms(3000);

}
}


source
Read more >>

DC Motor Control with Microcontroller ATmega8535

At mega 8535 microcontroller can use control dc motor that is on pin d where there have PWM control. DC motor can rotate because of the induction when the motor is connected to the DC voltage source. DC motor control with microcontroller if it is done more easily than without the microcontroller. We can change the direction of rotation of DC motor directly by changing the polarity of the voltage source. To change the speed of DC motors can be done by changing the size of a fox-voltage source. Control with a microcontroller as well as principled, but with an automated system. We do not have to change the cable from the motor to the battery if you want to change the direction of rotation, we just provide the logic 0 or 1 to the microcontroller is performed on the program in the microcontroller. To change the velocity is also easier because we simply use the existing PWM feature on the microcontroller. Maybe there are still many who do not know what PWM

PWM (Pulse Width Modulation) is a technique to get the effect of the analog signal from a digital signal to falter. PWM can be generated using only digital i / o which functioned as an output.

In the example above the waves, the comparison between high signal (1) and low signal (0th) is the same. Above the wave is said to have 50% duty cycle. Duty cycle is the ratio between the width of high signal (1) the overall width of the cycle (cycle). If the PWM wave amplitude is 5 volts, then the average stress (as if to analog) that we get is 2.5 volts. Here's an example of wave PWM with duty cycle 10%, if the amplitude of wave 5 volts then we will get the average analog voltage 0.5 volts.



In  ATMEGA8535 have two way control PWM, the PWM can be generated from the first port input / output is enabled as output. The second is to utilize the facilities of the function of the PWM timer / counter which has been provided. With this facility, the timing of the process of high / low digital signal will not disrupt the sequence of other programs being executed by the processor. In addition, by using this facility to enter how many servings we lived on and off time period on a wave PWM registers. OCR1A, OCR1B and OCR2 is register a place set PWM duty cycle.
Read more >>

Tuesday, July 20, 2010

PWM Configuration for PIC16F877 microntroller

PWM can be used to control a motor driver or generate sound samples.

The register specifically used to configure PWM are the TRISC, PR2, CCP1CON, CCP2CON, CCPR1L, CCPR2L and T2CON registers. There are two PWM channels on the PIC16F877. These modules are coined CCP1 et CCP2. These modules are implemented on pins 16 and 17 of the PIC16F877. There are two ways to connect these pins to a L293D H-Bridge. I recommend to connect these to the L293D Chip Enable pins. PWM then controls the percentage of time the chip is enabled. 

There are two parameters that affect the behavior of the PWM. The first one is the frequency of the pulses, the second is the length of these pulses. The length of the pulse is also called the duty cycle, e.g. the percentage of time the motor is enabled. In an ideal environment, if a motor normally exhibit 100 RPM, then it should do 25 RPM with a 25% duty cycle

It is important to experiment with these parameters to find the configuration that is right for your application because no two motors are the same. Some motors are better when the frequency is low (between 2 000-5 000 Hz). Other motors are best when the frequency is high, say between 15 000 and 20 000 Hz. Note that a low frequency (between 1 000 and 8 000 Hz) will produce an audible sound that can be very annoying. I have tested three robots with varying weight (500 g to 15 kg) and with different motors and have found that a frequency of 15 000 to 20 000 Hz gives good results. I have never seen any robot move with a duty cycle of less than 50%. If you want to do this, you have to find ways to control PWM in software, i.e. for a duty cycle of 25%, use a 50% duty cycle and turn PWM 50% of the time. Ideally, you will find motors that are not too fast at 50% and fast enough at 100%. 

The TRISC register must be initialized so that RC1 et RC2 are identified as output ports (bits 1 and 2 of TRISC must be set to 0). CCP1CON and CCP2CON are used to configure CCP1 and CCP2 modules mode. A value of 12 configures these modules for PWM mode.

Timer2 is used by CCP1 and CCP2 modules for PWM purposes. Timer2 prescaler is configured using bits TCKPS0 et TCKPS1 of T2CON register (bits 0 and 1). A value of 0 for these two bits configures a prescaler of 1. Bit TMR2ON (bit 2) must be initialized to 1 to start Timer2.PR2 register controls the pulse frequency. The formula used to calculate the pulse period is:(PR2 + 1) * 4 * TOSC * (Timer2 prescaler value).Pulse frequency is 1 / period. If PR2 is equal to 255 and the PIC runs at 20 MHz, pulse frequency is 19.53 kHz with a Timer2 prescaler of 1, i.e. 1 / ((255 + 1) * 4 * 1 / 20 000 000 * 1).

The CCPR1L et CCPR2L registers configure the "duty cycle". The "duty cycle" is relative to PR2. If PR2 is 100 and CCPR1 is 50, then the "duty cycle" is effectively 50% (half of PR2).
CCS provides macros to configure these registers appropriately. Here is an example program that shows how to configure PWM with CCS:

demopwm.c
Read more >>

Timers on PIC16F877

The timer service is one of the basic services offered by a microcontroller. Although CCS compiler provides some simple macros that implement delay routines, in order to determine time elapsed and to maximize use of MCU (see Simple Scheduler section), understanding of the timer functionality is necessary.
To introduce delays in an application, the CCS macro delay_ms and delay_us can be used. These macros provide an ability to block the MCU until the specified delay has elapsed.
For tasks that require the ability to measure time (for instance, how much time has elapsed since a given pin has transitioned to low), it is possible to write code that uses the microcontroller timers.
There are three timers on the PIC16F877: Timer0, Timer1 and Timer2 (there is also a watchdog timer, but it is not typically used to drive application based behavior).
Timer0, Timer1 and Timer2 are essentially counters that increment based on the clock cycle and the timer prescaler. An application can monitor these counters to determine how much time has elapsed. On PIC16F877, Timer0 is an 8-bit counter whereas Timer1 and Timer2 are 16-bit counters. Individual timer counters can be set to an arbitrary value using CCS macro set_timer0, set_timer1 or set_timer2. When the counter reaches its limit (255 for 8-bit and 65535 for 16-bit counters), it wraps around to 0. Interrupts can be generated when wrap around occurs. Timer2 is normally used for PWM or capture and compare functions.
Each timer can be configured with a different source (internal or external) and prescaler. The prescaler determines the timer granularity. A timer with a prescaler of 1 increments its counter every 4 clock cycles (1,000,000 times a second if using a 4 MHz clock). A timer with a prescaler of 8 increments its counter every 32 clock cycles.
Given that Timer1 is set up with a prescaler of 8 on a MCU clocked at 20 MHz. If Timer1 is reset to 0 and the application performs a certain task and if the value of Timer1 read at the end of the task is 6 250, the application can assume that a delay of 10 ms has taken place. To determine the delay, use the following formula:
delay (in ms) = (# ticks) * 4 * prescaler * 1000 / (clock frequency)
or in our example:
delay (in ms) = (# ticks) * 4 * 8 * 1000 / 20 000 000
or
delay (in ms) = (# ticks) / 625
This translates in our example to:
delay (in ms) = 6 250 / 625 = 10 ms
Here is some sample code that shows how to initialize and use the timer to determine the length of a task:
long delay;
/* Set Timer1 prescaler to 8. */
setup_timer_1(T1_INTERNAL | T1_DIV_BY_8);
/* Reset Timer1 to 0. */
set_timer1(0);

/* Perform some task. */
printf("Hello, world!");

/* Calculate delay in ms. */
delay = get_timer1() / 625;

In the above example, it is important that the task performed does not exceed the maximum delay a timer can sustain before wrapping around, otherwise, the calculations may be incorrect.
Here is another code sample that shows how to create a delay of 50 ms before resuming execution (alternative to delay_ms):
/* Set Timer1 prescaler to 8. */
setup_timer_1(T1_INTERNAL | T1_DIV_BY_8);
/* Reset Timer1 to 0. */
set_timer1(0);

for ( ; get_timer1() < 3125; ) ;

/* 50 ms has elapsed. */
Read more >>