Saturday, April 26, 2014

4 Digit Seven Segment Up Counter Circuit - 16F628

Views:

In the past I posted a counter and timer circuit and it is used two seven segment displays to display number and it can only count 0-99. you can see it from here. This circuit was developed version of it.

This project shows cheap and accurate up counter and it can count up to 9999 and then it will start from 0. For this circuit i used PIC16F628A micro-controller and four common cathode seven segment displays. Any 7-Segment displays will work in this circuit. You need to identify the pin-out of any display you use. In Proteus schematic i used NOT gate for reduce CPU usage while simulating and you need to replace that NOT gate with NPN transistors such as BC547 and do not connect transistor's base directly with PORTA (A0-A3). Put a 1k-10k resistor for base of each transistor.

4 Digit Seven Segment Counter circuit
Schematic diagram of 4 digit up counter

Operation of Circuit

  • To start counting simply press the 'Count' button and every time you pressed that button the number will increase one by one and displayed on the seven segment displays. if you need to automatic counting, it is also possible to connect this pin with pulse generator.
  • Pressed 'Clear' button to clear the display and start from zero.
  • 'Reset' button is optional and you can omitted it. but you must add pull-up resistor. otherwise device will reset continuously. 'Reset' button is useful when the circuit was stuck or not responded.

The main problem of counter circuit was contact bounce. The contact bounce is a common problem with mechanical switches. When the contacts strike together, their momentum and elasticity act together to cause bounce. The result is a rapidly pulsed electrical current instead of a clean transition from zero to full current. It mostly occurs due to vibrations, slight rough spots and dirt between contacts. This effect is usually unnoticeable when using these components in everyday life because the bounce happens too fast to affect most equipment. However, it causes problems in some analog and logic circuits that respond fast enough to misinterpret on/off pulses as a data stream. Anyway, the whole process doesn’t last long (a few micro or milliseconds), but long enough to be registered by the microcontroller. When only a push-button is used as a counter signal source, errors occur in almost 100% of cases!

To prevent contact bounce I added some extra code. so we can get error less counting from this circuit. When you pressed and hold the Count button this circuit wont count.

PIC16F628A pin
PIC16F628A Datasheet


Friday, April 25, 2014

Infrared Remote Control Transmitter and Receiver Circuit - 16F628 12F683

Views:

Updated [Sep 14, 2014]
  • Fixed some bugs on IR_Tx.hex
  • Increased Accuracy

This is a general purpose remote control project with 16 channels and using PIC16F628 for transmitter & 12F683 for receiver side. Remote controls usually consist of encoder/decoder parts connected to a transmitter/receiver module which takes care of the transmission of digital signals by radio or infra waves.The transmitter has a varying number of buttons and sends the states of these inputs to the receiver. The receiver device decodes the message and sets the outputs accordingly. To get individual out put from receiver you need to connect 4 to 16 decoder like CD4067, 74HS154 etc or you can use another programming ic. Receiver has two versions. chose better one for your task.
I used Proteus 8 for designing. so if you are already used older version, it is not supported to open this files. All the files can be download from below.

Transmitter Circuit

The TX use 16 pin PIC devices, PIC16F628A is the main part of the transmitter run at 4 MHz crystal. Actually, this device has 4MHz RC internal oscillator but not suitable for use with the project that need critical time as remote control. This ic used to send IR command to receiver. It also generate 38KHz carrier frequency and information bit.

You can use 2xAA size batteries or CR2016 battery or 5v for the circuit. For saving power when use with battery powered we need to increased battery life. Therefore when any keys not pressed within 30 seconds the CPU go to SLEEP mode to reduce battery power consumption and wake-up only when any key pressed. To wake-up the CPU from SLEEP mode the CPU use interrupt on change feature which interrupted when the state on PORTB change, then the program execution after an interrupt is at the interrupt vector, if the global interrupt is not enabled, the program starts executing the first line of code right after the SLEEP instruction.In the interrupt service routine the software will scan the key that pressed and send IR command appropriate with key pressed.

Transmitter circuit
Schematic of Transmitter

Receiver Circuit

The receiver used low cost 8 pin PIC16F683 to control all function of receiver side. The IR was received from TX will demodulated by this ic. When power is applied to circuit the CPU will polling the IR input signal which is the output from IR decoder module (TSOP1736). After IR received the CPU decoding the IR command and then turn on/off appropriate channel.

Ex:
If press 1 on TX then RX out put will be A=1, B=0, C=0, D=0
If press 2 on TX then RX out put will be A=0, B=1, C=0, D=0
If press 16 on TX then RX out put will be A=1, B=1, C=1, D=1

For IR decoder module alternatively you can used TSOP48XX series or any common module.
Connect 4 to 16 decoder with A, B, C and D to get all the out puts.
Supply voltage is 5v (Max).


 Receiver circuit
Schematic of Receiver

PIC12F683 Datasheet
PIC16F628A Datasheet


PIC16F628A pin
Pin Connection

 

on line

Labels

Recent comment

Visitors

Free counters!
Copyright © 2012 - Scorpionz™.,All rights reserved | Powered by Blogger