Quantcast
Channel: pic12f629 | Battery Guide
Viewing all 85 articles
Browse latest View live

4 ALARM SOUNDS using PIC12F629

$
0
0

This project is a miniature 1-chip alarm. All you need is a tilt switch, battery and piezo to produce a complete alarm.
If you want a very high output, you can add a Darlington buffer transistor, piezo tweeter and a 10mH choke.
The chip does all the work.
It sits in sleep mode (100 microamps) and waits for the enable line to go high via the tilt switch.
It then produces a SPACE GUN alarm for approx 3 minutes and goes into sleep mode again.
The .asm and .hex for  4 Alarm Sounds chip with Space Gun selected when A0 and A1
HIGH, is in the following files:
4 Alarm Sounds.asm
4 Alarm Sounds.hex

4 ALARM SOUNDS

 

Below is the program written by the original designer of the project. It is complex and contains an instruction: movlw wabl_dir_mask ;change direction  This instruction is now allowed. Possibly it should be: movfw wabl_dir_mask ;change direction. I don’t know how he was able to compile the program. I could not assemble it.
Read through the program then look at the next program for PIC12F629. It is shorter, easier to read, has better sounds, includes sleep mode (100microamps) and a 3 minute timer. You can always learn from other peoples work.
Here are some of the things to consider.
1. The second program has has fewer instructions for each sub-routine. For instance:
decf      dwell,1 ; test if dwell = 0
btfsc     ZERO
has been replaced with:
decfsz   dwell,1 ; test if dwell = 0
goto       $-2    ;go up the program two instructions
2. The piezo lines toggle via the following instructions:
movlw       b’00100001′
xorwf        GPIO,1         ;toggle bits 0 & 5
This makes GP0 and GP5 change state each time the sub-routine is executed. You do not need to know the previous state of either line. They change state each time the sub-routine is called.
3.  Instruction:  goto $+1   uses 2 cycles and saves writing:    nop    nop  and saves one  line of code.

 

For more detail: 4 ALARM SOUNDS using PIC12F629

Current Project / Post can also be found using:

  • software program for women security project using pic 16f877a

The post 4 ALARM SOUNDS using PIC12F629 appeared first on PIC Microcontroller.


Joy Stick Controller using PIC12F629

$
0
0

This project controls two servo motors – both clockwise and anticlockwise and has variable speed.
You can use the Joy Stick to “pan and tilt” a remote camera or provide “left-right-up-down” action for a crane or an animation on your model layout. The project also tests servo motors.

The CIRCUIT
The circuit is fairly simple.
The input from the Joy Stick has been separated into two sections to make detection easy and this requires 2 inputs.
A pot is connected to another input line and 2 more lines are required for the servos. Pin 8 is connected to 0v and pin 1 is connected to the supply. The only unused pin is GP3 (Input ONLY),
Most of the work is done by the micro. It uses a technique of charging a capacitor via a resistor and determining how long it takes to charge, to work out which switch is pressed or the position of the pot.
It then outputs a 1mS or 2mS pulse to one of the servo motors to create clockwise or anticlockwise rotation of the output shaft and the speed of rotation can be set by adjusting the pot. The two LEDs on the output pins let you see the pulses being delivered to the servo’s when the project is used to test these devices. The photo’s below show the circuit built on prototype board:

Joy Stick Controller

THE JOY STICK
There are 7 different (actually more) combinations of positions for the joy stick and we need to decode them and work out what to do with the result.
This is too many resistance-values for a single input and so we have used two inputs with 3 resistance-values for each plus the possibility of all switches being pushed at the same time.
The resistance values we have used are 22k and 47k. When 2 switches are pressed, the resistors are in parallel to produce 15k, but only 22k and 47k is detected in this program.
The program creates a loop that detects up to 19k, to produce an output of loop=1, then up to 38k for a value of loop=2 and higher than 38k for a value of loop=3. But if the program keeps looping for 10 loops, it determines that no button is pressed and creates a value of 4. The change-points are mid-way between the resistance-values we have used and thus any tolerances on the capacitors and resistors can be accommodated.
This means a resistance of 15k produces a value of 1, 22k produces a value of 2 and 47k produces a value of 3. This is most important as we don’t want the cut-off points to be on the border as the program may produce an output of 1 instead of 2. The project is fairly voltage sensitive and if the right-hand buttons are not detected, the battery voltage is low.

THE SERVO
A servo module consists of a motor and gearbox, with a PC board containing the electronics to drive the motor in clockwise and anticlockwise direction. The electronics also detects the width of the incoming pulse to drive the motor to mid-position and also other positions, but this feature is not used in this project.
The motor is connected to the positive rail of the supply via a bridge of transistors within the servo and the red and black wires from the module are taken to the positive and negative of a battery to provide the current to drive the motor.
The third lead (white) is the control line and this is taken to the micro.
This line needs a pulse and the maximum repetition-rate accepted by the servo is every 18mS – it will accept a longer timing between pulses. This is the timing between pulses, the actual pulse-width is very short, between 0.9mS and 2.2mS.
If the pulse is less than 1mS duration (wide) the servo will travel fully in the anticlockwise direction.
If the pulse is 2mS, the servo will travel in the clockwise direction.
If the pulse is 1.5mS, the servo will travel to the mid position.
If the time between pulses is longer than 18mS, the speed of rotation is decreased.
This is what we have done. We have provided a 1mS or 2mS pulse and created a long time-interval between pulses to produce a reduced rate of movement.

 

For more detail: Joy Stick Controller using PIC12F629

The post Joy Stick Controller using PIC12F629 appeared first on PIC Microcontroller.

2 Digit Counter using PIC12F629 Microcontroller

$
0
0

This article describes a 2-Digit Counter using a Microchip PIC12F629.
It shows what can be done with an 8-pin chip having just 5 output lines and one input line.
The chip drives two7-segment displays and this would normally require 7 lines to drive the segments plus another one or two lines to select the displays.
We have shown how a single line can be used to drive two different segments by using the tri-state of an output.

2 Digit Counter

Each output of the chip has three states: HIGH, LOW and FLOATING (high impedance). The high impedance state occurs when the line is in the input state and any line can be changed from output to input at any time during the running of the program.
The circuit is more complex than shown in the diagram. The interface circuit between the chip and the displays is duplicated two more times for the other 4 lines to the displays. This means we have used 9 transistors to drive 6 lines, whereas it would have normally taken 6 transistors.
The other secret behind driving the displays is multiplexing.
Since we can only show 3 or 4 segments of a display at any time, we need to alternately show up to 3 segments for a short period of time and then the other 4 segments.
We can then repeat the procedure for the other display.
This means any segment will only be illuminated for a maximum of 25% of the time and if we deliver a higher current for this short period of time, we can achieve a very good brightness.
This is one of the features of a LED. It can be pulsed with a higher current for a short period of time and the brightness will be equivalent to a lower constant current.
In fact the overall current will be less in pulse-mode and this represents a saving in power.
To deliver this higher current we need driver transistors as the chip is only able to deliver 25mA from each drive line and we need about 30mA.
The other secret to the operation of the circuit is the voltage divider. It is designed to  put 0.5v between the base and emitter of the two transistors when the output of the chip is floating.
This means neither of the transistors is turned on and no segment will be illuminated.
When the output of the chip is HIGH, the lower transistor is turned on and this turns on the middle transistor to illuminate a segment.
When the output of the chip is LOW, the upper transistor is turned on.

The multiplexing and driving the segments involves a lot more programming and setting the lines to input and then output, but this will not inhibit the running of the program as the displays must be illuminated for long periods of time compared with the time taken for carrying out the instructions.
The whole purpose of this project is to show what can be done with a small micro

For more detail: 2 Digit Counter using PIC12F629 Microcontroller

The post 2 Digit Counter using PIC12F629 Microcontroller appeared first on PIC Microcontroller.

RGB LED Mood Light Standalone PWM controller for RGB LEDs using PIC12F629

$
0
0

This project is an update to the original RGB LED PWM Driver.  The new version allows the use of either 5mm LEDs or the square bodied Superflux / Piranah style LEDs.  The circuit now uses bipolar transistors rather than MOSFETs which make it more suitable for novice constructors and for the first time this project is available as a kit with all parts required to assemble the PCB including the superflux LEDs. (power supply not included)

RGB LED Mood Light

Full schematic and construction details are shown on this page, as well as the firmware download for those who want to create their own effects or build their own version from the schematic.  If you’re not into programming the kit includes a PIC microcontroller pre-programmed with the firmware and a number of mood lighting effects.

Circuit Description

The circuit itself is fairly straightforward.  Diode D1 provides reverse polarity protection for the board in case the power supply is connected backwards.  C1/C2 and IC2 take the incoming 12 volt supply and provide a regulated 5 volt supply required by the PIC microcontroller.

The red, green and blue LEDs are arranged in three parallel strings of three LEDs.  Resistors R1, 2 and 3 limit the current through the LEDs to a safe value when using a 12 volt power supply. The low side of each LED string connects to a BC547 NPN transistor which is used to switch the LEDs on and off.  These transistors are in turn controlled by the PIC microcontroller which drives each of the red, green and blue channel transistors with a PWM signal to control the average brightness of the LEDs.  Switch S1 is used to select different effect sequences.   The firmware program running on the PIC microcontroller is the smart part of the circuit and determines what colours are generated and how they fade from one colour to the next.

The three colours of LEDs are positioned on the PCB in an irregular arrangement to improve the colour mixing effect when placed behind / inside a diffuser such as a frosted glass globe.

The controller uses (RGB) Red, Green and Blue high brightness LEDs that are pulse width modulated (PWM) to vary the intensity of each colour LED.  This allows effectively any colour to be generated with rapid changing strobe effects, fast and slow colour fades as well as static colours.   The data used to set and change the colours is held in an easy to edit file so if you don’t like the sequences provided with it, you can modify the sequence data include file yourself and reprogram with your own sequences. (you will need a PIC programmer and some practical knowledge of microcontrollers and programming if you want to do this.)

The dimensions of the PCB are 50mm x 50mm. 

The PCB supplied with the kit is professionally manufactured thru-plated with solder mask top and bottom and screen print overlay on FR4 laminate with RoHS finish.

If you want to etch your own PCB you can use the artwork above.  Unless you are able to thru-plate your own PCB you will need to solder component leads top and bottom where required. Also look for the single via on the board that will need to be wired through.

The ready made PCB supplied in the kit has through plated holes so this does not apply.

The kit available from the Picprojects On-line store contains all the parts required to build the RGB LED Moodlight.  This includes all the components, quality FR4 double sided PCB, Superflux LEDs and a PIC12F629 microcontroller pre-programmed with the firmware.

12 volt power supply is not included in the kit

A 2.1mm chassis mount DC power jack and 100mm of red/black wire are available as an option

 

For more detail: RGB LED Mood Light Standalone PWM controller for  RGB LEDs using PIC12F629

Current Project / Post can also be found using:

  • pic of LED

The post RGB LED Mood Light Standalone PWM controller for RGB LEDs using PIC12F629 appeared first on PIC Microcontroller.

RC5 remote control using PIC12F629

$
0
0

All remote controlled projects from this site can be controlled with remote controls which use the RC5 protocol, like the TV-remotes from Philips.
When all buttons from such a remote are in use then you could make a remote control by yourself.

RC5 remote control
Your own build remote control with only one button or maybe you want to build a remote with more then hundred buttons.
It is possible, however, you need the PIC Basic compiler from Crownhill seeing that everyone has his own wishes and you have to fill in which button sends which RC5 code (mentioned in the RC5 tables, see here and here).
The TRANSMIT.HEX file underneath is only an example, a TV-remote controller with only 5 buttons, namely Stand-by, Program + and -, Volume + and -.
On basis of the downloaded PIC Basic example you can expand the program to your own wishes.
If you need more buttons but the PIC has not enough inputs free, you have to write your own routine which read the buttons when they are connected in a matrix or with use of i.e. a 74HC165.
To see what system- and command codes your remote-control sends, you can build an other (easy) project: RC5/RC6 codes on a LC-Display.

 

For more detail: RC5 remote control using PIC12F629

The post RC5 remote control using PIC12F629 appeared first on PIC Microcontroller.

Tiny Remote for iRobot Roomba using PIC12F629

$
0
0

Description

The Tiny Remoteis a very compact infrared remote control with only two buttons to control an iRobot Roomba. It produces three different infrared control signals that the robot interprets as Clean, Spot and Virtual Wall/Lighthouse.

Tiny Remote for iRobot Roomba

The circuit is built mostly using SMD components to reduce its size, nearly to the size of a keychain and is powered by a CR2032 coin battery.

 

Design Considerations

After having designed the virtual wall, I wanted to be able to remotely control the robot. Most of the work had already been done on the assembler software of Virtual Wallso I was left with the tasks of redesigning the power supply and add two buttons.

Power supply considerations:

  • It should be powered by a CR2032, CR2025 coin battery or similar;
  • Idle current consumption should be 0 (zero) because these batteries have small capacities;
  • Ideally the circuit should only consume power from the battery when a button is pressed;
  • A voltage step-up is needed because 3V are not enough to power the PIC and infrared LED.

 

Like the  Virtual Wall, the infrared pattern generator:

The infrared patterns emitted by the remote control are a form of PWM, modulated with a carrier frequency around 38KHz~40KHz. Below is a picture of the lighthouse pattern captured using a TSOP1238 and an oscilloscope.

Transmitting commands on the remote:

  • Button 1 sends the Spot command;
  • Button 2 sends the Clean command;
  • Both buttons simultaneously send the Virtual Wall/Lighthouse command;
  • Keeping buttons down will repeat its command until they are released.

No Stop command is included in the remote because it’s not needed! Each command, Clean or Spot, act as start when the robot is stopped and stop when it’s already running.

 

Generating the infrared 38KHz~40KHz carrier frequency:

Using a PIC microcontroller it is possible to output the infrared pattern and generate the carrier frequency. Mixing is accomplished by connecting the LED between the PWM output and the carrier output.

A solution is to use the PIC’s master clock oscillator output to produce the carrier frequency. This is the solution proposed by the circuit below. The PIC clock runs at 160KHz (FOSC) using an RC oscillator and the carrier frequency is available on CLKOUT pin as FOSC/4, at 40KHz.

 

Schematic

Schematic Tiny Remote

From left to right we have the CR2032 3V coin battery, the power supply based on a MAX619 regulator, the microcontroller 12F629, two LEDs, one emitting visible light and an infrared one and two push buttons. Connected to the microcontroller’s pin 2 (CLKIN) are R1 and C6 that form the RC pair for the PIC oscillator. There’s also a 5 pin header to connect the programmer (an ICD2 or another compatible one). The two diodes D1 and D2 will drive the MAX619 ~SHDN when any button is pressed.

 

For more detail: Tiny Remote for iRobot Roomba using PIC12F629

Current Project / Post can also be found using:

  • pics of autonomous robot
  • robotics and automation projects

The post Tiny Remote for iRobot Roomba using PIC12F629 appeared first on PIC Microcontroller.

PIC12F629 Lead-Acid Battery Desulfator

$
0
0

Hi everyone,
After reading so many articles on Battery desulfator i’ve decided to come out with my version of Battery desulfator using
Microchip base micro-controller using PIC12F629 or PIC 12F675.

“Please pardon my english” .I don’t really have time to check for minor grammatical errors.

Before we begin this circuit although simple in design requires DIY builders to have at least basic PIC programming knowledge with electronics.

Honestly i had no programming knowledge initially.I started on my own on how to blink led using Pic micro-controller.
PIC12F629 Lead-Acid Battery Desulfator
I have used this circuit i design to recover 5 Maintenancefree battery ranging from 12volts 2AH (UPS battery) to 7.2AH (Previously used in electric bicycle).I have not attempted to recover a CAR battery since i don’t have any old battery in my home.

I have recovered battery eg:2AH which had voltage as low as 0.9v which i have not charged  for around 8 years after removing battery from a defective home UPS.
I  have managed to recover 4 12v 7.2AH battery which i have not charged since 2004.These batteries were in my self assembled electric bicycle years ago.

These batteries were all recovered in within 48hours.For a car battery it would take weeks maybe.

Battery desulfator circuit i used while with charging battery with 12volt 500ma transformer.
I’d believe using slow and steady approach do produce better result most of the time.

The frequency output from Pin 7 is 56us on with 1ms off in a infinite loop.
During programming i have set it to use internal 4MHZ PIC oscillator which have 1% tolerance and i have disabled reset /mclr.
There is only 3 connection to pic.

I noted the current consumption of the desulfator circuit is around 13 to 15mA with a well desulfated battery if connected to the charger with voltage around 13.8volts.

I noted if a old battery needs to be desulfated the voltage would increase up to 17.xx volts on battery with desulfator  circuit consuming about 40 to 50mA.

The D1  diode i used is the fastest recovery diode i could find with 25ns response time.
The purpose of D2 is to prevent accidental polarity reverse at the input to protect the circuit.D2 could be replace with higher amp rating like IN5820 if needed.
It’s better to obtain C1&C2 capacitor which have a low ESR rating with at least 50V.
For L2 toroid if you could get anything from 170uh to 220uh would be sufficient.Please do not wind higher than 30 turns as the resistance would increase and hence lower the circuit efficiency as well.To be honest i don’t know the uH rating for my self made toroid but i got results which what matters in the end.

For the mosfet if you could find a lower turn on resistance with low turn on/off delays which will definitely improve the efficiency of the circuit.

I have connected a piezo speaker temporarily to old battery which needs to be charged since it would have higher internal-resistance.i noticed the piezo speaker would emit a loud 1KHZ sound.But if the battery is already well desulfated i noticed the piezo speaker connected temporarily to battery would hardly emit any sound at all.
We could use piezo speaker as a quick way to test to know if battery to be charged is well desulfated or internal resistance of the batery is already being lowered.

For more detail: PIC12F629 Lead-Acid Battery Desulfator

The post PIC12F629 Lead-Acid Battery Desulfator appeared first on PIC Microcontroller.

Long Period Astable Timer using PIC12F629

$
0
0

Description

This software functions as a long period astable mutivibrator.  The mark and space period can be set from 1 second up to a maximum 65535 seconds (18h12m15s). Using the internal 4Mhz RC oscillator delays with an accuracy of 99% or better can be achieved 

The code also implements an edge triggered reset and an active low hold function.  The reset edge can be configured for rising or falling edge.  The hold function is active low and stretches the timed period for as long as the hold input is held low.

Long Period Astable Timer

In addition to this up to 450 mark/space time pairs can be used which are executed sequentially allowing complex pulse trains to be generated.

By connecting the hold input to the Q output, the code can also be made to function as an edge-triggered monostable timer, using the reset input as the trigger.

The code will run on a PIC 12F629 or 12F675.

At power on and after an edge triggered reset the outputs enter a mark state with the Q output going high and the notQ output going low.  The first time entry is then read and the code waits for the number of seconds specified.  When this period has elapsed a Space state is entered with the Q output going low, notQ output high and the next time entry is read. 

When the Hold input is taken low the output remains unchanged and the timer is stopped, effectively stretching the current time period. When the Hold input returns high, the timer continues.

If the Reset input is triggered while Hold is low, the outputs are reset to Q == high, notQ == low and the timer is loaded with the first entry from the LongDelayTimes.inc file. It them remains in the Hold state until the Hold input returns high.

Accuracy of timings

Since the timings are generated from the PICs internal 4Mhz RC oscillator the accuracy is subject to the tolerances specified in the Datasheet with respect to operating voltage and temperature. The software itself will generate an accurate timing but any deviation in the RC oscillator from 4Mhz will result in the time period deviating.  You should therefore test the accuracy before committing it to an application.

Since the PIC calibration word can only be correct at a specific supply voltage and temperature it is advisable to calibrate it at the supply voltage it will operate at in the final application.  This will help considerably in obtaining accurate timings.

My investigations with a number of PICs from different batches suggest that Microchip calibrate the PIC at a supply voltage of 3.5 volts.  Therefore if you’re operating it from a 5 volt supply it will be running slightly too fast.  

In the trace below the factory calibration value was 0x2C, the value when recalibrated with a 5 volt supply was  0x34.  For a programmed delay of 60 / 300 seconds it is showing 59.85/ 299.3 seconds which is 99.7% accurate.  This would result in an error of 3m16s over 18h12m.

For more detail: Long Period Astable Timer using PIC12F629

The post Long Period Astable Timer using PIC12F629 appeared first on PIC Microcontroller.


PIC RGB Power Board using PIC12F629 microcontroller

$
0
0

Description

Power Pic RGB is a circuit that generates random RGB colors using a powerful 3W RGB LED and fades

between them.

The initial project goal was to develop the fading algorithm which was successfully achieved. This time the idea was to drive a Prolight 3 Watt RGB LED and place it inside a nice white globe! On the right is a picture of the first prototype board eith a small board attached that doesn’t belong to this project.

PIC RGB Power Board

Design and Implementation

The circuit is basically the same with the addition of 3 BS170 mosfet transistors to drive the LED and a powerful 5V regulator. The PIC is the same but the code has a small big difference, explained below!

Schematic

From left to right we can see the power supply based on a 7805 5V 1A regulator, the microcontroller and finally on the right the three mosfets that will drive the LED. Click the image to enlarge.

Schematic PIC RGB Power Board

Each mosfet can drive a maximum 600mA through its drain but according to Prolight each LED (red, green and blue) can only sustain 300mA which makes this mosfet perfect for the job.

Summing the 3 LED currents we get 900mA not counting the current consumed by the PIC and the 7805 itself which should be around 3 or 4 mA. The 7805 is able to supply 1A of current with a proper Heatsink.

 

For more detail: PIC RGB Power Board using PIC12F629 microcontroller

Current Project / Post can also be found using:

  • rgb board using pic12f675

The post PIC RGB Power Board using PIC12F629 microcontroller appeared first on PIC Microcontroller.

LED Strobe for PIC12F629

$
0
0

Description

This project functions as a simple strobe for driving an LED.  The use of an output transistor allows it to pulse the strobe LED with a current up to 100mA.

Four jumpers provide options for changing the pulse width, strobe repeat interval and single or double strobe flash.  The programmer ready code has default timings which are easily customised by editing values in the PIC’s EEPROM at programming time.

This is one of those applications where it’s arguably better than a 555 timer based solution but in practice you could build it with a 555 timer faster than you can write the PIC code.  However it only needs the code writing once, I’ve done that and designed a small PCB too so away you go.

Download schematic in PDF

Circuit Description

The circuit provides a LED strobe function with jumper selectable operating modes.

LED Strobe

The strobe interval can be configured using 4 jumpers for 1,2,3 or 4 seconds; strobe on time of 30mS or 100mS and single or double strobe pulse. 

Since the PIC can only supply 25mA from its I/O pin a transistor is used to increase the maximum current driven through the LED.  This transistor has a maximum collector current of 100mA which is adequate for driving most types of 5mm LEDs.  The PIC could be used to control a higher powered output switch if desired.

The value of R3 series current limiting resistor for the strobe LED has been selected on the conservative side rather than providing maximum brightness.  With a 5 volt supply and LED with 1.8V forward voltage yields current of approximately 47mA.

The strobe LED can either be installed on the PCB in position LED1 or off-board via connector CN2.  If the off-board option is used do not install a LED into position LED1 on the PCB.

LED2 is a monitor LED, if the off-board strobe LED is used, this LED can be useful for monitoring the operation of the circuit.  If you don’t want this option, just omit LED2 and R4.

Capacitor C1 is used to decouple the 5 volt power supply rail.  If you are building the circuit on a breadboard or stripboard you should ensure it is located close to the PICs Vdd connection (pin 1).

The input voltage must not exceed 5 volts.  It can run from as low as 3 volts but you will need to modify the Strobe LED resistor value.  Also be aware of the LED forward voltage; some high brightness LEDs and in particular white LEDs and some blue and green LEDs have forward voltages in excess of 3 volts.

The operating modes are selected by using jumper block JP1.  If you are building the strobe for a specific application you may want to hardwire inputs to ground as required rather than fit the jumper pin header. 

Choosing R3 / LED1

Obviously we want the strobe LED to be as bright as possible.  It is important that the series resistor R3 is chosen so that the LED current does not exceed the manufacturers rating.  Since different LEDs have different maximum forward current and voltage ratings you must select this resistor to suit the specific LED you are using.

For other LEDs you can use this site to calculate the resistor needed http://led.linear1.org/1led.wiz  When you go to this site it asks for the source voltage.  This will be 5 volts, or if you’ve used batteries to power the strobe, the total battery voltage.  Also note that driver transistor Q1 is only rated to 100mA so do not exceed this even if the LEDs used can.

Strobe Operating Modes

The section refers to the default timings used in the programmer ready firmware download.

The pulse width, interval and strobe mode are user selectable using the JP1 jumper block.  There are two strobe modes, single and double pulse.  The double mode has a (default) 175mS off-time between the two pulses.  As shown in the diagram below, the interval is measured from the end of one pulse group to the start of the next group. 

 

For more detail: LED Strobe for PIC12F629

Current Project / Post can also be found using:

  • led strobe microcontroller
  • led strobo with pic12f629

The post LED Strobe for PIC12F629 appeared first on PIC Microcontroller.

4 ALARM SOUNDS using PIC12F629

$
0
0

This project is a miniature 1-chip alarm. All you need is a tilt switch, battery and piezo to produce a complete alarm.
If you want a very high output, you can add a Darlington buffer transistor, piezo tweeter and a 10mH choke.
The chip does all the work.
It sits in sleep mode (100 microamps) and waits for the enable line to go high via the tilt switch.
It then produces a SPACE GUN alarm for approx 3 minutes and goes into sleep mode again.
The .asm and .hex for  4 Alarm Sounds chip with Space Gun selected when A0 and A1
HIGH, is in the following files:
4 Alarm Sounds.asm
4 Alarm Sounds.hex

4 ALARM SOUNDS

 

Below is the program written by the original designer of the project. It is complex and contains an instruction: movlw wabl_dir_mask ;change direction  This instruction is now allowed. Possibly it should be: movfw wabl_dir_mask ;change direction. I don’t know how he was able to compile the program. I could not assemble it.
Read through the program then look at the next program for PIC12F629. It is shorter, easier to read, has better sounds, includes sleep mode (100microamps) and a 3 minute timer. You can always learn from other peoples work.
Here are some of the things to consider.
1. The second program has has fewer instructions for each sub-routine. For instance:
decf      dwell,1 ; test if dwell = 0
btfsc     ZERO
has been replaced with:
decfsz   dwell,1 ; test if dwell = 0
goto       $-2    ;go up the program two instructions
2. The piezo lines toggle via the following instructions:
movlw       b’00100001′
xorwf        GPIO,1         ;toggle bits 0 & 5
This makes GP0 and GP5 change state each time the sub-routine is executed. You do not need to know the previous state of either line. They change state each time the sub-routine is called.
3.  Instruction:  goto $+1   uses 2 cycles and saves writing:    nop    nop  and saves one  line of code.

 

For more detail: 4 ALARM SOUNDS using PIC12F629

Current Project / Post can also be found using:

  • sms based home safty and security system using pic16f877a
  • pic16f73 projects
  • pic alarm system
  • Transuard puc security

The post 4 ALARM SOUNDS using PIC12F629 appeared first on PIC Microcontroller.

Joy Stick Controller using PIC12F629

$
0
0

This project controls two servo motors – both clockwise and anticlockwise and has variable speed.
You can use the Joy Stick to “pan and tilt” a remote camera or provide “left-right-up-down” action for a crane or an animation on your model layout. The project also tests servo motors.

The CIRCUIT
The circuit is fairly simple.
The input from the Joy Stick has been separated into two sections to make detection easy and this requires 2 inputs.
A pot is connected to another input line and 2 more lines are required for the servos. Pin 8 is connected to 0v and pin 1 is connected to the supply. The only unused pin is GP3 (Input ONLY),
Most of the work is done by the micro. It uses a technique of charging a capacitor via a resistor and determining how long it takes to charge, to work out which switch is pressed or the position of the pot.
It then outputs a 1mS or 2mS pulse to one of the servo motors to create clockwise or anticlockwise rotation of the output shaft and the speed of rotation can be set by adjusting the pot. The two LEDs on the output pins let you see the pulses being delivered to the servo’s when the project is used to test these devices. The photo’s below show the circuit built on prototype board:

Joy Stick Controller

THE JOY STICK
There are 7 different (actually more) combinations of positions for the joy stick and we need to decode them and work out what to do with the result.
This is too many resistance-values for a single input and so we have used two inputs with 3 resistance-values for each plus the possibility of all switches being pushed at the same time.
The resistance values we have used are 22k and 47k. When 2 switches are pressed, the resistors are in parallel to produce 15k, but only 22k and 47k is detected in this program.
The program creates a loop that detects up to 19k, to produce an output of loop=1, then up to 38k for a value of loop=2 and higher than 38k for a value of loop=3. But if the program keeps looping for 10 loops, it determines that no button is pressed and creates a value of 4. The change-points are mid-way between the resistance-values we have used and thus any tolerances on the capacitors and resistors can be accommodated.
This means a resistance of 15k produces a value of 1, 22k produces a value of 2 and 47k produces a value of 3. This is most important as we don’t want the cut-off points to be on the border as the program may produce an output of 1 instead of 2. The project is fairly voltage sensitive and if the right-hand buttons are not detected, the battery voltage is low.

THE SERVO
A servo module consists of a motor and gearbox, with a PC board containing the electronics to drive the motor in clockwise and anticlockwise direction. The electronics also detects the width of the incoming pulse to drive the motor to mid-position and also other positions, but this feature is not used in this project.
The motor is connected to the positive rail of the supply via a bridge of transistors within the servo and the red and black wires from the module are taken to the positive and negative of a battery to provide the current to drive the motor.
The third lead (white) is the control line and this is taken to the micro.
This line needs a pulse and the maximum repetition-rate accepted by the servo is every 18mS – it will accept a longer timing between pulses. This is the timing between pulses, the actual pulse-width is very short, between 0.9mS and 2.2mS.
If the pulse is less than 1mS duration (wide) the servo will travel fully in the anticlockwise direction.
If the pulse is 2mS, the servo will travel in the clockwise direction.
If the pulse is 1.5mS, the servo will travel to the mid position.
If the time between pulses is longer than 18mS, the speed of rotation is decreased.
This is what we have done. We have provided a 1mS or 2mS pulse and created a long time-interval between pulses to produce a reduced rate of movement.

 

For more detail: Joy Stick Controller using PIC12F629

The post Joy Stick Controller using PIC12F629 appeared first on PIC Microcontroller.

2 Digit Counter using PIC12F629 Microcontroller

$
0
0

This article describes a 2-Digit Counter using a Microchip PIC12F629.
It shows what can be done with an 8-pin chip having just 5 output lines and one input line.
The chip drives two7-segment displays and this would normally require 7 lines to drive the segments plus another one or two lines to select the displays.
We have shown how a single line can be used to drive two different segments by using the tri-state of an output.

2 Digit Counter

Each output of the chip has three states: HIGH, LOW and FLOATING (high impedance). The high impedance state occurs when the line is in the input state and any line can be changed from output to input at any time during the running of the program.
The circuit is more complex than shown in the diagram. The interface circuit between the chip and the displays is duplicated two more times for the other 4 lines to the displays. This means we have used 9 transistors to drive 6 lines, whereas it would have normally taken 6 transistors.
The other secret behind driving the displays is multiplexing.
Since we can only show 3 or 4 segments of a display at any time, we need to alternately show up to 3 segments for a short period of time and then the other 4 segments.
We can then repeat the procedure for the other display.
This means any segment will only be illuminated for a maximum of 25% of the time and if we deliver a higher current for this short period of time, we can achieve a very good brightness.
This is one of the features of a LED. It can be pulsed with a higher current for a short period of time and the brightness will be equivalent to a lower constant current.
In fact the overall current will be less in pulse-mode and this represents a saving in power.
To deliver this higher current we need driver transistors as the chip is only able to deliver 25mA from each drive line and we need about 30mA.
The other secret to the operation of the circuit is the voltage divider. It is designed to  put 0.5v between the base and emitter of the two transistors when the output of the chip is floating.
This means neither of the transistors is turned on and no segment will be illuminated.
When the output of the chip is HIGH, the lower transistor is turned on and this turns on the middle transistor to illuminate a segment.
When the output of the chip is LOW, the upper transistor is turned on.

The multiplexing and driving the segments involves a lot more programming and setting the lines to input and then output, but this will not inhibit the running of the program as the displays must be illuminated for long periods of time compared with the time taken for carrying out the instructions.
The whole purpose of this project is to show what can be done with a small micro

For more detail: 2 Digit Counter using PIC12F629 Microcontroller

Current Project / Post can also be found using:

  • 2 digit digital counter using microcontroller

The post 2 Digit Counter using PIC12F629 Microcontroller appeared first on PIC Microcontroller.

RGB LED Mood Light Standalone PWM controller for RGB LEDs using PIC12F629

$
0
0

This project is an update to the original RGB LED PWM Driver.  The new version allows the use of either 5mm LEDs or the square bodied Superflux / Piranah style LEDs.  The circuit now uses bipolar transistors rather than MOSFETs which make it more suitable for novice constructors and for the first time this project is available as a kit with all parts required to assemble the PCB including the superflux LEDs. (power supply not included)

RGB LED Mood Light

Full schematic and construction details are shown on this page, as well as the firmware download for those who want to create their own effects or build their own version from the schematic.  If you’re not into programming the kit includes a PIC microcontroller pre-programmed with the firmware and a number of mood lighting effects.

Circuit Description

The circuit itself is fairly straightforward.  Diode D1 provides reverse polarity protection for the board in case the power supply is connected backwards.  C1/C2 and IC2 take the incoming 12 volt supply and provide a regulated 5 volt supply required by the PIC microcontroller.

The red, green and blue LEDs are arranged in three parallel strings of three LEDs.  Resistors R1, 2 and 3 limit the current through the LEDs to a safe value when using a 12 volt power supply. The low side of each LED string connects to a BC547 NPN transistor which is used to switch the LEDs on and off.  These transistors are in turn controlled by the PIC microcontroller which drives each of the red, green and blue channel transistors with a PWM signal to control the average brightness of the LEDs.  Switch S1 is used to select different effect sequences.   The firmware program running on the PIC microcontroller is the smart part of the circuit and determines what colours are generated and how they fade from one colour to the next.

The three colours of LEDs are positioned on the PCB in an irregular arrangement to improve the colour mixing effect when placed behind / inside a diffuser such as a frosted glass globe.

The controller uses (RGB) Red, Green and Blue high brightness LEDs that are pulse width modulated (PWM) to vary the intensity of each colour LED.  This allows effectively any colour to be generated with rapid changing strobe effects, fast and slow colour fades as well as static colours.   The data used to set and change the colours is held in an easy to edit file so if you don’t like the sequences provided with it, you can modify the sequence data include file yourself and reprogram with your own sequences. (you will need a PIC programmer and some practical knowledge of microcontrollers and programming if you want to do this.)

The dimensions of the PCB are 50mm x 50mm. 

The PCB supplied with the kit is professionally manufactured thru-plated with solder mask top and bottom and screen print overlay on FR4 laminate with RoHS finish.

If you want to etch your own PCB you can use the artwork above.  Unless you are able to thru-plate your own PCB you will need to solder component leads top and bottom where required. Also look for the single via on the board that will need to be wired through.

The ready made PCB supplied in the kit has through plated holes so this does not apply.

The kit available from the Picprojects On-line store contains all the parts required to build the RGB LED Moodlight.  This includes all the components, quality FR4 double sided PCB, Superflux LEDs and a PIC12F629 microcontroller pre-programmed with the firmware.

12 volt power supply is not included in the kit

A 2.1mm chassis mount DC power jack and 100mm of red/black wire are available as an option

 

For more detail: RGB LED Mood Light Standalone PWM controller for  RGB LEDs using PIC12F629

Current Project / Post can also be found using:

  • LED Projects with PIC
  • home automation system using mobile microcontroller pic
  • LED dimmer projects using PIC 12F683
  • pic of LED

The post RGB LED Mood Light Standalone PWM controller for RGB LEDs using PIC12F629 appeared first on PIC Microcontroller.

RC5 remote control using PIC12F629

$
0
0

All remote controlled projects from this site can be controlled with remote controls which use the RC5 protocol, like the TV-remotes from Philips.
When all buttons from such a remote are in use then you could make a remote control by yourself.

RC5 remote control
Your own build remote control with only one button or maybe you want to build a remote with more then hundred buttons.
It is possible, however, you need the PIC Basic compiler from Crownhill seeing that everyone has his own wishes and you have to fill in which button sends which RC5 code (mentioned in the RC5 tables, see here and here).
The TRANSMIT.HEX file underneath is only an example, a TV-remote controller with only 5 buttons, namely Stand-by, Program + and -, Volume + and -.
On basis of the downloaded PIC Basic example you can expand the program to your own wishes.
If you need more buttons but the PIC has not enough inputs free, you have to write your own routine which read the buttons when they are connected in a matrix or with use of i.e. a 74HC165.
To see what system- and command codes your remote-control sends, you can build an other (easy) project: RC5/RC6 codes on a LC-Display.

 

For more detail: RC5 remote control using PIC12F629

Current Project / Post can also be found using:

  • codes tv remote control
  • ir remote pic12f629
  • rc5 codes table for lighting

The post RC5 remote control using PIC12F629 appeared first on PIC Microcontroller.


Tiny Remote for iRobot Roomba using PIC12F629

$
0
0

Description

The Tiny Remoteis a very compact infrared remote control with only two buttons to control an iRobot Roomba. It produces three different infrared control signals that the robot interprets as Clean, Spot and Virtual Wall/Lighthouse.

Tiny Remote for iRobot Roomba

The circuit is built mostly using SMD components to reduce its size, nearly to the size of a keychain and is powered by a CR2032 coin battery.

 

Design Considerations

After having designed the virtual wall, I wanted to be able to remotely control the robot. Most of the work had already been done on the assembler software of Virtual Wallso I was left with the tasks of redesigning the power supply and add two buttons.

Power supply considerations:

  • It should be powered by a CR2032, CR2025 coin battery or similar;
  • Idle current consumption should be 0 (zero) because these batteries have small capacities;
  • Ideally the circuit should only consume power from the battery when a button is pressed;
  • A voltage step-up is needed because 3V are not enough to power the PIC and infrared LED.

 

Like the  Virtual Wall, the infrared pattern generator:

The infrared patterns emitted by the remote control are a form of PWM, modulated with a carrier frequency around 38KHz~40KHz. Below is a picture of the lighthouse pattern captured using a TSOP1238 and an oscilloscope.

Transmitting commands on the remote:

  • Button 1 sends the Spot command;
  • Button 2 sends the Clean command;
  • Both buttons simultaneously send the Virtual Wall/Lighthouse command;
  • Keeping buttons down will repeat its command until they are released.

No Stop command is included in the remote because it’s not needed! Each command, Clean or Spot, act as start when the robot is stopped and stop when it’s already running.

 

Generating the infrared 38KHz~40KHz carrier frequency:

Using a PIC microcontroller it is possible to output the infrared pattern and generate the carrier frequency. Mixing is accomplished by connecting the LED between the PWM output and the carrier output.

A solution is to use the PIC’s master clock oscillator output to produce the carrier frequency. This is the solution proposed by the circuit below. The PIC clock runs at 160KHz (FOSC) using an RC oscillator and the carrier frequency is available on CLKOUT pin as FOSC/4, at 40KHz.

 

Schematic

Schematic Tiny Remote

From left to right we have the CR2032 3V coin battery, the power supply based on a MAX619 regulator, the microcontroller 12F629, two LEDs, one emitting visible light and an infrared one and two push buttons. Connected to the microcontroller’s pin 2 (CLKIN) are R1 and C6 that form the RC pair for the PIC oscillator. There’s also a 5 pin header to connect the programmer (an ICD2 or another compatible one). The two diodes D1 and D2 will drive the MAX619 ~SHDN when any button is pressed.

 

For more detail: Tiny Remote for iRobot Roomba using PIC12F629

Current Project / Post can also be found using:

  • pics of autonomous robot
  • robotics and automation projects

The post Tiny Remote for iRobot Roomba using PIC12F629 appeared first on PIC Microcontroller.

PIC12F629 Lead-Acid Battery Desulfator

$
0
0

Hi everyone,
After reading so many articles on Battery desulfator i’ve decided to come out with my version of Battery desulfator using
Microchip base micro-controller using PIC12F629 or PIC 12F675.

“Please pardon my english” .I don’t really have time to check for minor grammatical errors.

Before we begin this circuit although simple in design requires DIY builders to have at least basic PIC programming knowledge with electronics.

Honestly i had no programming knowledge initially.I started on my own on how to blink led using Pic micro-controller.
PIC12F629 Lead-Acid Battery Desulfator
I have used this circuit i design to recover 5 Maintenancefree battery ranging from 12volts 2AH (UPS battery) to 7.2AH (Previously used in electric bicycle).I have not attempted to recover a CAR battery since i don’t have any old battery in my home.

I have recovered battery eg:2AH which had voltage as low as 0.9v which i have not charged  for around 8 years after removing battery from a defective home UPS.
I  have managed to recover 4 12v 7.2AH battery which i have not charged since 2004.These batteries were in my self assembled electric bicycle years ago.

These batteries were all recovered in within 48hours.For a car battery it would take weeks maybe.

Battery desulfator circuit i used while with charging battery with 12volt 500ma transformer.
I’d believe using slow and steady approach do produce better result most of the time.

The frequency output from Pin 7 is 56us on with 1ms off in a infinite loop.
During programming i have set it to use internal 4MHZ PIC oscillator which have 1% tolerance and i have disabled reset /mclr.
There is only 3 connection to pic.

I noted the current consumption of the desulfator circuit is around 13 to 15mA with a well desulfated battery if connected to the charger with voltage around 13.8volts.

I noted if a old battery needs to be desulfated the voltage would increase up to 17.xx volts on battery with desulfator  circuit consuming about 40 to 50mA.

The D1  diode i used is the fastest recovery diode i could find with 25ns response time.
The purpose of D2 is to prevent accidental polarity reverse at the input to protect the circuit.D2 could be replace with higher amp rating like IN5820 if needed.
It’s better to obtain C1&C2 capacitor which have a low ESR rating with at least 50V.
For L2 toroid if you could get anything from 170uh to 220uh would be sufficient.Please do not wind higher than 30 turns as the resistance would increase and hence lower the circuit efficiency as well.To be honest i don’t know the uH rating for my self made toroid but i got results which what matters in the end.

For the mosfet if you could find a lower turn on resistance with low turn on/off delays which will definitely improve the efficiency of the circuit.

I have connected a piezo speaker temporarily to old battery which needs to be charged since it would have higher internal-resistance.i noticed the piezo speaker would emit a loud 1KHZ sound.But if the battery is already well desulfated i noticed the piezo speaker connected temporarily to battery would hardly emit any sound at all.
We could use piezo speaker as a quick way to test to know if battery to be charged is well desulfated or internal resistance of the batery is already being lowered.

For more detail: PIC12F629 Lead-Acid Battery Desulfator

Current Project / Post can also be found using:

  • Pic microcontroller desulfator
  • download source code of pic microcontroller to display battery charging in an lcd screen
  • lion batrey charge with PIC 16F84
  • microcontroller based battery charger circuit

The post PIC12F629 Lead-Acid Battery Desulfator appeared first on PIC Microcontroller.

ELECTRONIC DICE CIRCUIT WITH PIC12F629

$
0
0

the PIC12F629 on a microcontroller based electronic dice. electronic DICE with 14 LEDs dual membranes prepared for application software mikroc used to give random results when a button is pressed for 3 seconds if… Electronics Projects, Electronic Dice Circuit With PIC12F629 “microchip projects, microcontroller projects, “

ELECTRONIC DICE CIRCUIT

the PIC12F629 on a microcontroller based electronic dice. electronic DICE with 14 LEDs dual membranes prepared for application software mikroc used to give random results when a button is pressed for 3 seconds if not used within 15 seconds after it goes to sleep mode normal operation of the circuit of the button continues. Electronic DICE circuit PCB Sprint layout prepared with ISIS simulation software source code that belong to the file and drawing.

ELECTRONIC DICE CIRCUIT

ELECTRONIC DICE MICRO C SOFTWARE

#define Butt GPIO.F3
#define On 0 // button on - GP3=0

void main()
{
unsigned char LED1, LED2, i, Timer = 0, Time_off = 0;

TRISIO = 0;
GPIO = 0;
INTCON = (1<<GPIE); //
IOC=0b00001000; // enable int. on change GP3
T1CON = 1 ; // TMR1-on, 1/65535
CMCON = 7 ;

while(1)
{
if (PIR1.TMR1IF == 1)
{
PIR1.TMR1IF = 0;
Time_off++ ; // increment off-timer to 1 at each 65ms
}

if (Butt == On)
{
Time_off = 0; // clear off-timer
LED1 = (TMR1L%6)+1; //
LED2 = (TMR1H%6)+1; // rand. led1 and led2

for (i=0; i<150; i++) // indication 150*20ms = 3 sec.
{ GPIO = (1<<4)|LED1;
Delay_ms(10);
GPIO = (1<<5)|LED2; Delay_ms(10); } GPIO = 0; } else { if (Time_off > 250)
{ // to sleep in 15s
Time_off = 0;
INTCON.GPIF=0;
GPIO = 0;
asm sleep;
}
}
}
}

ELECTRONIC DICE SCHEMATIC

ELECTRONIC DICE SCHEMATIC

Source: ELECTRONIC DICE CIRCUIT WITH PIC12F629 alternative link: electronic-dice-with-pic12f629.rar

The post ELECTRONIC DICE CIRCUIT WITH PIC12F629 appeared first on PIC Microcontroller.

RGB LED DRIVER CIRCUIT PIC12F629 PWM

$
0
0

RGB LED driver circuit can be controlled with PIC12F629 pic12f675 As an alternative, can be used PIC12F683 PIC GP0, GP1, GP2 STP36NF06 in output MOSFETs are driven by PWM technique internal oscillator of the...Electronics Projects, RGB LED Driver Circuit PIC12F629 PWM “led projects, microchip projects, microcontroller projects, pwm circuits, “

RGB LED DRIVER CIRCUIT
RGB LED driver circuit can be controlled with PIC12F629 pic12f675 As an alternative, can be used PIC12F683 PIC GP0, GP1, GP2 STP36NF06 in output MOSFETs are driven by PWM technique internal oscillator of the microcontroller is used instead of an external crystal. RGB Led source application software prepared by assembly hex asm code, schematics, PCB drawings there.
RGB LED DRIVER CIRCUIT(1)

Code to fade between colours is completely rewritten to use variable rate of change so that all three LEDs arrive at their new levels simultaneously. This code will run on 12F629 / 12F675 and 12F683. Select the desired processor from the Configure – Select Device menu option in MPLAB IDE, then use the Project – Quickbuild option to create the HEX output file.

Look for errors during assembly. In particular errors in the SequenceData.inc file that indicate either a missing comma in the data, or more data than the chosen PIC has available program memory. Be carefull to enter the data in the SequenceData.inc file correctly. The program is only smart enough to work out where your sequences start and finish if you enter it in the correct format. Errors in the data may cause the code to crash.

All timings are based on the internal 4Mhz PIC oscillator. The OSCCAL value is read from program memory at 0x3FF and written to the OSCAL register. This value must be present and correct.

RGB LED DRIVER CIRCUIT(2)

SourceRGB LED DRIVER CIRCUIT PIC12F629 PWM alternative link: rgb-led-driver-circuit-pic12f629-pwm.rar alternative link2

The post RGB LED DRIVER CIRCUIT PIC12F629 PWM appeared first on PIC Microcontroller.

EPSON CARTRIDGE RESET CIRCUIT PIC12F629

$
0
0

The printer of the original cartridge prices excessively expensive when soon cartridge refill, renovation works a lot in technical service began to be made even just engaged in this business there are places many…Electronics Projects, Epson Cartridge Reset Circuit PIC12F629 “microchip projects, microcontroller projects, “

EPSON CARTRIDGE RESET

The printer of the original cartridge prices excessively expensive when soon cartridge refill, renovation works a lot in technical service began to be made even just engaged in this business there are places many manufacturers this situation to prevent various measures took eposo in one of these refill cartridges with the printer operation so that a chip is used but these obstacles were overcome in a short time with some of the programs installed on the computer printer models are deceived resetleniyor with some additional circuitry of the chip.

Built on PIC12F629 chip, EPSON cartridge chip reset circuit modules that appear in the image below is used to working with 3-volt circuit has a simple structure hex may install and use the software to the microcontroller.

EPSON CARTRIDGE RESET (1)

VDD, SHT, SDT, CLK, RESET, DATA, GND connections do hold circuit is open until 5 seconds after the reset operation will take place is called

Source: EPSON CARTRIDGE RESET CIRCUIT PIC12F629 alternative link: epson-cartridge-reset-circuit-pic12f629.rar

The post EPSON CARTRIDGE RESET CIRCUIT PIC12F629 appeared first on PIC Microcontroller.

Viewing all 85 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>