Photography and Projects

Adjustable Lighthouse Simulator

Page under Construction
Stacks Image 164
A lighthouse is a building with a very bright light usually found on the coast warning ships at sea of dangers around the shore. The light is a rotating or pulsing light that can be seen for many miles even in poor weather conditions. Each lighthouse will have a unique pattern or timing to the light.

This module is used to simulate a lighthouse. This can be used on model railways to add scenic interest or on a diorama. The light increases in brightness until it reaches full brightness and then decreases to no brightness (off). This pattern repeats.

0 ratings

Project Description

This project is for a module that can pulse a light to simulate a lighthouse. The module has a variable resistor to adjust the timing to suit your need. It also has an open-collector transistor output to allow the use of a high power LED or lamp. The maximum recommended current for the light source is 500mA. A standard 5mm white LED can also be used.
For this project I created a general purpose circuit and PCB that could also be used for other projects. Therefore it has components on the PCB that are optional.


Stacks Image 166
IC1 is an eight pin microcontroller which will be programmed to flash the light. For this project I will use a microcontroller with Pulse Width Modulation (PWM) to vary the light intensity and an analog input for a variable resistor to manually adjust timing.
Transistor Q1 is used as an open collector switch controlled via output GP2 and resistor R6.
The GP0, GP1 and GP5 outputs are not used so the resistors R2, R3 and R4 are not required.
Power is supplied to the circuit via the 5v regulator IC2 and related capacitors C1, C2 and C3. The diode D1 protects the circuit from reverse polarity connections.

Printed Circuit Board

Stacks Image 168
The PCB measures 27mm by 30mm and has two 2.8mm diameter mounting holes. All the connections are on one side and connections can be made by soldering wires directly to the PCB or by using a pin header connector.


Stacks Image 170
I always start by assembling the smallest components and those less affected by heat first. So I solder the resistors first followed by the diode making sure to orientate the diode correctly. If using an edge connector I would solder that next followed by the socket for the microcontroller. Then solder in the capacitors C1 and C2 followed by the variable resistor.
Next solder in the transistor and voltage regulator. Finally solder in the capacitor C3 as this is the tallest component but make sure it is aligned correctly matching the PCB and the capacitor.
Check all the joints for dry joints and there are no solder splashes.
Do not plug in the microcontroller until the test phase below.

Parts List

Identifier Description Quantity Rapid Code
IC1 12F615 Microcontroller 1 N/A
IC2 78L05 5V Regulator 1 47-3278
Q1 BC337-16 NPN Transistor 1 81-0472
D1 1N4148 Signal Diode 1 51-0100
C1, C2 100nf Ceramic Capacitor 2 11-3454
C3 100uf 35v Electrolytic Capacitor 1 11-3525
R1, R6 10K 0.25W Carbon Film Resistor 2 62-0394
R5 100R 0.25W Carbon Film Resistor 1 62-0346
R7 10K Wr3362p 0.25 1-turn Cermet Trimmer 1 68-0047
PCB Railway 8 PCB 1 N/A
I have quoted Rapid Electronics Order codes above for reference. Not all components are available (12F615) at present and some components may be out of stock. Please note, some items have a minimum order quantity. You can find some items online at a better price.
The PCB and a pre-programmed PIC Microcontroller can be purchased from me on request. Please use the contact form to contact me.


I use Mikroe C compiler to develop the program for the PIC Microcontroller. This compiler sets the microcontroller fuses by selecting the options in the project settings user interface. This makes it easy to select the correct options as only the options relevant to the microcontroller you are using are displayed. This compiler is free to use for programs less that 2k in size.
For other compilers you may have to set the fuses in the program itself.
By using the PWM module built in to the microcontroller the program is more simple. You do not have to take care of pulsing the output at the correct duty cycle.


Testing starts with a voltage test before plugging in the Microcontroller. Connect a 9v-16v power supply to the V_in and Gnd pins on the PCB and measure the voltage across pins 1 and 8 of the 8 pin socket. It should read approximately 5v.
Next, if you connect the light between V_in and GP2 you can use a small piece of wire to bridge pins 1 and 5. The light should illuminate. This checks the transistor is switching the light on and off.
If both these tests are ok disconnect the power supply before plugging in the PIC microcontroller. Make sure you handle with care as static electricity on the IC pins can damage it. Also make sure you align pin 1 correctly.
Now you can apply power to check if the LED is pulsing on and off. You can adjust the variable resistor to change the speed of the pulsing one and off and the time in between flashes.
See the FAQ below if you face any issues during testing.

Project Summary

The module produces a realistic pulsing light with a good adjustable range. The cost is quite reasonable and by using a microcontroller we can change the program to alter the desired effect.
For example we can make the following changes:
  • We can alter the timing range for longer or shorter pulses
  • We could change the code to produce multiple pulses of light
  • We could add a light dependant resistor to the GP0 Input to only switch on when it is dark


PCB Gerber Files:


C Program and Hex Files:

Frequently Asked Questions (FAQ)

Why does the Light not flash?
If the light does not flash make sure the light is connected the right way round. This is especially important for LED lights. The anode must connect to positive and the cathode (via suitable resistor if required) must connect to the GP2 Output on the PCB.
You should also check the power is connected to the module correctly. Positive must connect to the V_In pin and negative to the 0v pin.
What voltage can be used?
The voltage range supported by the module is 9v to 30v DC Smooth power supply.
Adjustable Lighthouse Simulator

All content I publish is my own work and I own the copyright.
If you enjoy the content provided please consider showing your appreciation by donating using the link below.

RapidWeaver Icon

Made in England