Practical PIC Projects

   

Variable Chase Speed Option
for #481 and #483 LED Chasers

  • Description
     
  • Schematic
     
  • Circuit Description
     
  • Firmware
     

 


 

Description

The PWM LED Chaser projects #481 and #483 have fixed chase speeds determined by the sequence data and internal timing of the software.

Lots of people have asked for the option to vary the speed of the chaser using an external control, however this posed a couple of problems; firstly the speed of each step of each chase sequence is defined in the data for that sequence and isn't fixed.  Secondly, the PIC16F627 and PIC16F628 don't have any analogue-to-digital inputs to measure an external variable resistor.

After some thought and a bit of prototyping I've come up with a solution to the problem that now gives the PWM LED Chaser the capability to alter the chase speed while still using the timing from the sequence data.  The kit can be bought as an option to work with either the #481 or #483 LED Chaser Kits and can be retrofitted to existing kits with a firmware upgrade (download free from here)

Summary

  • The variable speed option only works with the V3.x.x PWM LED Chaser firmware.
     
  • All #481 / #483 PWM LED chaser kits shipped after 08-August-2011 include V3.x.x firmware.
     
  • #481 / #483 PWM LED chaser kits bought before 08-August-2011 will need the PIC reprogramming with V3.x.x firmware.
     
    • If you have access to a PIC programmer the V3.x.x firmware can be downloaded free-of-charge from this page.
       
    • If you don't have a PIC programmer a new PIC programmed with the firmware can be purchased from the Picprojects eShop
       
    • If you want to buy a PIC Programmer, see 'Where to buy a PIC Programmer'
       
  • V3.x.x firmware supports but does not require the use of the variable speed option kit.  If the option kit is not installed the LED Chaser functions correctly using internal timing exactly as the original version 2.x.x firmware did.
     
  • The UFO Round LED Chaser kit #432 will not work with V3.x.x firmware.
     
  • The new redesigned UFO Round LED Chaser kit #433 uses the V.3.x.x. firmware with an alternative sequence data set pre-programmed into the supplied PIC.  The speed control option with miniature on-board variable resistor are included with the kit #433K. (see project page for full details)

Schematic

Download schematic in PDF

See the section title ' Variable Speed Option for #481 and #483 PWM LED Chaser' for the variable speed upgrade.  Other areas of the schematic pertain to the base 481 and Power MOSFET 483 projects.

Circuit Description

To make a variable speed control I've used a software controlled oscillator.  One output pin of the PIC is switched high and low alternately.  The output is fed via a 10K variable resistor to a capacitor which is charged and discharged by the output  A second pin configured as an input is connected to the capacitor and monitored to determine if it is high or low.  The output pin is always driven to the opposite logic level seen on the input.  The input pin buffer inside the PIC uses a Schmitt trigger which provides the necessary hysteresis for the digital input.  This is also the reason I had to use a link wire to connect to RA7 port pin as the available port B I/O pins don't have schmitt triggers on the input buffers.

The chaser sequence has a 'hold time' value which is individualy defined for each step in a chase sequence (see description of data )  When running from the internal timer the hold timer counts down at 10mS intervals (100Hz).  When the external timing is used the hold timer counts down using the software oscillator at a frequency set by the variable resistor.

Range of speed control

Capacitor C6 is specified as 2.2uF and gives a good range of speed control both faster and slower than the internal fixed timing.  Increasing it to 10uF will give a much slower chaser with the fastest speed about the same as the internal fixed timing, while using a 1uF capacitor results in a very fast chaser with the slowest speed about the same as the internal timing.  You can also change the variable resistor (P1) from 10K to 20K or 47K which will give a wider range of speed control.

If C6 and the variable resistor are omitted, any clock source feeding a logic level signal to the PORTA RA7 input can also be used for the chaser timing.

The internal or external chase timing is selected by using a switch connected to PORTB RB3 input.  When left open it is pulled high by the internal weak pull-up resistor inside the PIC.  The software uses the internal timing when the input is high and the external software oscillator when it is held low.  If you don't want to use the internal timing and will only use the external variable resistor for speed control you can omit the switch and just fit a link wire to the I/O-1 terminal.

IMPORTANT: The circuit can be retrofitted to existing #481 or #483 chasers provided the PIC is reprogrammed with V3.0.0 code available to download here page.

All #481 & #483 kits shipped after 8 August 2011 will be pre-programmed with the V3.0.0 firmware.  Please note, the firmware supports but does not require the use of the variable speed option kit.  If the option kit is not installed the LED Chaser functions correctly using internal timing.


Construction

Please read through this section once before starting construction so you have a overview of the assembly details and options. Click on the photographs for 1024x768 hi-res version. 

The construction photographs below show only the assembly of the variable speed option to a bare PCB to avoid confusion with the components in the main kit.

This option can be retrofitted to existing #481 and #483 PWM LED Chaser kits providing the PIC firmware is also update (see here)

 



step 1

step 2

step 3

Step 1.  Use solder to bridge the five PCB solder jumper pads SJ1, SJ3, SJ4, SJ5-C-2, SJ6-C-2 as shown in the photograph.

Step 2. Fit the two 1K resistors to positions R32 and R33

brown, black, red, gold - 1K0 (R32, R33)

Step 3. Cut approximately 6cm (2¼") of hook-up wire, strip and tin the ends and then solder to the PCB. The wire should link the solder pad from XT1 to the solder pad of IC4 pin 2 as shown.
 


step 4

step 5

step 6

Step 4 /5. Install the 2.2uF capacitor to position C6 as shown.  One lead is shorter and this must be installed to the correct hole arrowed in the photograph.

Step 6.  Install the terminal blocks as shown.  A pair of two-way terminal blocks are supplied in the kit.  These have a key and slot in the side of the plastic body to allow them to lock together forming a single 4-way block. 


step 7

step 8

step 9

Step 7 / 8. Cut two 10cm (4") lengths of hook-up wire.

Solder one end of each wire to the switch as shown.  Only two of the six connections on the switch are used.

Switch fixing holes are 2 x M2 on 19mm centres

Step 9.  Using the remaining hook-up wire solder two wires to the 10K variable resistor.  Note how one wire connects to both the centre terminal and one outer terminal. To make this connection strip back 12-15mm (½") of insulation and tin the lead with solder. Bend into an 'L' shape and solder to both terminals.

The second wire lead connects to the remaining outer terminal.

The supplied variable resistor has a 6mm diameter control shaft.


step 10

step 11

step 12

Step 10.  Connect the switch and variable resistor to the terminal block as shown.

The variable resistor connects to I/O-2, it does not matter which way round the wires connect.

The switch connects to I/O-1, again it does not matter which way round the wires connect.

If you will only use the external speed control and don't need to switch between internal and external timing you can omit the switch and fit a wire link between the terminals of I/O-1.

Step 11 / 12.  Shows a #481 Chaser with the variable speed option on an assembled PCB


Firmware

The variable speed option kit requires V3.0.0 firmware.  All #481 and #483 kits shipped after 8 August 2011 will be pre-programmed with the V3.0.0 firmware.  Please note, the firmware supports but does not require the use of the variable speed option kit.  If the option kit is not installed the LED Chaser functions correctly using internal timing.

The PIC microcontroller requires programming with the firmware which you can download below.

The HEX files are ready to program straight into the respective PIC chip.  The latest code version 3.0.1 supports the PIC 16F628/628A only.

The Source code will allow you to create your own sequences and then reassemble the code to use them.  Quick guide to reassembling firmware using MPLAB

Description Filename Download link
     
Source code for 16F628A pro481v301.zip
V3.0.1  21/02/2021
download
HEX file ready to program into the PIC.
Use with 16F628 / 16F628A only
pro481v301.HEX
V3.0.1  21/02/2021
Sequence data 13/08/2011
download