This LED blinking circuit is one of the simplest circuits we designed during our training with four PRODA Staffs in Enugu under the supervision of Mrs. Kesandu Uchenyi, the Director of EPED Department PRODA Enugu.
The schematic circuit diagram and its source code is posted here for those learning Embedded C Programming Language for PIC using Mikro C Compiler. You can build this circuit and ask question to know more.
//THE SOURCE CODE
// PIC16F84 micro-controller used
void main ()
{
PORTA = 0; // neg state as default on port A
TRISA = 1; // Port A used as input
PORTB = 0; // neg state as default for port B
TRISB = 0; // Port B used as output
while(1) // endless loop
{ // while loop
if (PORTA.RA0 == 0) // if the expression of 0 is true
{
PORTB.RB1 = 1; // do the led blinking task here
delay_ms(250); // delay on
PORTB.RB1 = 0; // off the LED
delay_ms(250); // delay off
}
else
PORTB.RB1 = 0; // don't perform the LED blinking task if the switch in RA0 is not pressed
} // while brace
} // end of program brace
// PCB DESIGN
A microcontroller is a microcomputer in a single chip. It has many electronic circuits built in it which can decode written instruction and convert them into electrical signal. Microcontrollers replaced logic gates use in digital electronic. Instead of hard wiring a number of logic gates to perform some functions in a circuit, instructions are used to wire the gates electronically in anyway the programmer wishes. Since microcontroller is a microcomputer, It falls into embedded computer.
An embedded system is a computer system that is built to control one or a few dedicated functions. It is not designed to be programmed by the end user in the same way that desktop computers are been used. In embedded system, a user can make choices concerning the functionality but cannot change the system functionality by adding or replacing software.
The software for an embedded system is often referred to as firmware and is contained in the system’s non-volatile memory.
NOTE: Firmware is something in between hardware and software. It is created from source code to be closely tied to the hardware (embedded system) in order to run it.
In most cases, an embedded system is used to replace an application-specific electronics in the consumer products. By doing so, most of the system’s functionality is encapsulated in the firmware that runs the system, and it is possible to change and upgrade the system by changing the firmware, while keeping the hardware same. This reduces the cost of production even lower because many different systems can share the same hardware base and the functionality is determined by the firmware loaded into them.
Building Block of Embedded System
1. Input Peripherals:
This input is called peripherals because they are outside the embedded system. The input components can be different input such as sensor, button switches, push buttons, thermistor, LDR, IR receivers, touch pads, bluetooth or any analog or digital input traducers that is needed to send signal in the microcontroller.
2. Output Peripherals
The output can be IR transmitter, LED, LCD, Bluetooth or any output device were the result of the microcontroller task will be produced or utilized.
Note: An embedded system communicates with the outside world through peripherals. The main types of peripherals that are used include:
Digital inputs and outputs: These are simple external pins whose logic state can be controlled by the processor to either be logic 1 or logic 0. They can also be used as input pins so that the processor can receive binary inputs from the external world. They can be used individually or grouped together to create parallel ports.
Serial interfaces: These are interfaces that send or receive data using one or two pins in a serial mode. They are less complex to connect but are more complicated to program because the data may also be augmented with additional information as required by the data transfer protocol.
Analog to digital converters: While processors operate on the digital data, the surrounding world is analog in nature. Therefore, interfaces between the system and the external world requires analog to digital conversions and vice versa.
Displays: Displays are used by the processor to display the status information, error messages, and output results. They could be simple LEDs, seven segment displays, or character LCD panels.
Keypads: Keypads are used by the end user to provide inputs to the embedded system. The inputs could be anything such as entering the password, changing functional settings, switching between menu items, etc.
3. Controller:
The controller unit is of course the microcontroller itself that perform the main operations of an embedded system. The microcontroller will monitor the inputs and as a result the program would turn output on and off. the microcontroller stores the program in its memory and execute the instructions under the control of a clock circuit. The controller consists of processor and the memory units such as ROM, RAM ALU, etc. These memories are utilized to perform a different task.
For instance, the ROM which is Read only Memory is the code memory. Only the code will be permanently stored there. The RAM which is Random Access Memory is for the run time data memory and the ALU (Arithmetic Logic Unit) is used for calculations.
The key components inside an embedded system are:
Processor: At the heart of the embedded system is the central processing unit or processor. It is the hardware that executes the software and brings life to the embedded system. It also controls the activities of all the other circuits.
There are varieties of processors available for embedded systems, and the main criteria for selection is “Can it provide the processing power needed to perform the tasks within the system?”
Besides that is the system cost, power consumption, software development tools, and component availability are also important factors to be considered while selecting a processor for embedded system design.
Memory: The embedded system also has memory, often several different types in one system. The memory is used to store the software that the processor will run.It also provides storage for data such as program variables, intermediate results, status information and any other data generated throughout the operation.The memory is an important part of any embedded system because it may dictate how the software (Program) is designed, written, and developed.
Program: The program we write is stored in one area of the microcontroller called EPROM. EPROM is Electrically Programmed Read only Memory. This memory is non-volatile which means that it does not lost its memory or require voltage from any power supply to retain its information. To be able to send information to the microcontroller EPROM, we will need a Programmer. Memory is electrically programmed by a piece of hardware called Programmer.
4. Power supply:
For the microcontroller to carry out a task, it must be energized. The PSU is the power supply unit that provides a regulated DC power to the entire system.
5. Freq Gen:
The frequency generator is the crystal oscillator for the embedded system to complete an operation at a given time. It is use to program a timing operations, to set a particular time for an operation and to perform a calculation task.
In order to step through the instructions, the microcontroller needs a clock frequency to direct the movement of data around its electronic circuits.
The clock frequency determines the speed at which the instruction are executed. The higher the clock frequency the quicker the microcontroller will finish one task and start another.
Conclusively:
Ø A microcontroller is a computer control system on a single chip.
Ø It has many electronic circuits or logic gates into it which can decode written instructions and convert them to electrical signal.
Ø Instead of hard wired logic gates to perform some functions, instructions are given to microcontrollers to wire the gates electronically through programming
Ø Microcontroller will step through the instructions and execute them one by one.
Ø The list of these instructions given to the microcontrollers are called program.
Ø In order to step through the instructions, the microcontroller needs a clock frequency to direct the movement of data around its electronic circuits.
Ø The clock frequency determines the speed at which the instructions are executed. The higher the clock frequency the quicker the microcontroller will finish one task and start another.
Note: The first computer were made by adding external memory, timers, RAM, Program memory, microprocessor, A/D Converter and other circuits but microcontroller has every of these peripherals inside of it that made them to call it an embedded system.
PRODA Smart Battery Charger
PRODA Smart Battery Charger as designed and developed by Able Designs is a microcontroller based intelligent battery charger with wrong battery polarity detection and protection. It observes the battery's status, and, provide the correct charging to replenish the battery energy and to keep it healthy and energized. This ensures that the battery is fully charged and prevents internal damage caused by running battery down when not in use.
Other features that makes the battery charger intelligent or smart includes:
- 1. its ability to detect dead battery and prevent it from charging
- 2. It has terminal short circuit protection. When the battery terminal are mistakenly bridged together, the system shuts down immediately to protects the battery charger
- 3. It is a battery activated automatic power switch system. This means that there is no ON and OFF power switch for the charger. The charger only power ON when the right battery polarity is detected then AC voltage of 220v can be supplied and charging commence immediately.
- 4. If wrong battery connection is detected, the system triggers an alarm, shutdown the system and green LED light comes as an indication that the battery connection is bad until the polarity is reversed.
- 5. The charger has the ability to boost batteries that needs to be revived and equalized the battery cells
- 6. The system voltage and current are displayed on a 16 by 2 LCD as shown below
- 7. it is a fast charger and can charge so many batteries simultaneously
- 8. it has a soft cooling system using fan and heat-sink
In the future upgrade, this system will be designed without a transformer and all parameters will be displayed on the 16 by 2 LCD especially the wrong battery polarity information. This present design uses a 220v to 15v step down transformer and KBU808G Full bridge rectifier diode to convert AC to DC for the charging of the battery. A 12v electromagnetic relays are used to control the transformer supply while a 5v to 6vv buzzer is used for the alarm unit.
Resistors in the circuit designs oppose the flow if current and for the biasing of transistors. LM7805 DC voltage regulator is used to provide a steady voltage of 5v to the microcontroller, with a 1000uf decoupling capacitor that smoothen any ripple AC voltage from the transformer. . PIC16F876A was used for the project.
For more information : call or whatsapp Able Designs on +2348037909203.
Email: abledesigns@yahoo.com or engrable.ea@gmail.com