Search The Site...

Things To Do...

Print this article

Share this article

Add this article to your Favourites

Read this topic's Message Board

A Cliff Lift
By Gilbert Ghyselbrecht
Return to the Homepage

Control your Meccano models (or anything else) from your Windows PC!
Take a look at my new MECControl project at

An Overview of the Model

To be quite honest, there is no model!  To me, the electronics are more important than the building of a full scale model. The circuit described can be used in, for instance, a cliff lift, but for the gathering in Mechelen (Belgium) I made a very simple crane (shown below).  Later on, the electronics was used in my cliff lift model which is described at the end of this article.

Click to enlarge

The model crane
| Enlarge to 640x480 | Enlarge to 1280x960 |

An elevator, shown here with three Lego figures, goes up 50cm, comes back down again, and stops 1mm above the table.  The design is my own.

The electronics are used here to compensate for the shortcomings of the mechanics.  When the movement has to stop exactly, it is not sufficient to switch off the motor, because it continues to rotate for a while and the stop position depends on the mechanical resistance and inertia of the model. In my design the motor turns - at the end of the mechanism’s travel - at a very low speed so that the motor can be stopped immediately by short-circuiting the motor winding.

The speed and direction of the motor is controlled by a microcontroller which obtains positional information about the motor from four slotted opto switches fitted to the model.  A block diagram of the system is shown in figure 1.

Figure 1: Block diagram of the system


A gear wheel (no 27c) with 95 teeth is connected to the winding drum of the lift, via a set of gears, so that it makes half a turn every time the lift goes up or down. Four slotted opto switches are mounted with 1” angle brackets around the gear as shown in figure 2.  A fishplate is mounted on the gear with a long bolt and washers such that it can pass through the centre of each slotted opto switch.

Figure 2: The slotted opto switches arranged around the gear

Click to enlarge

The motor, gearing, and slotted opto switches
| Enlarge to 640x480 | Enlarge to 1280x960 |

Slotted Opto Switches

The slotted opto switches I have used in the model consist of two separate sections as shown in figure 3.  The first section is an infrared light emitting diode (LED) acting as a transmitter. The receiver, in the second section, is a phototransistor. Between the two sections there is a small gap so that an object may cut the infrared beam of light that passes between the two sections.

Figure 3: A slotted opto switch

The circuit that makes the switch useful is shown in figure 4.  The phototransistor is wired as shown so that when an object cuts the infrared beam of light, the output of the switch becomes 5V instead of the usual 0V when there is no object obstructing the beam.

Figure 4: Using a slotted opto switch

In order to mount the slotted opto switches in a Meccano model I have developed a printed circuit board (PCB) that is the same size as perforated strip part no 6a (1” x 1/2”).

Click to enlarge

An slotted opto switch mounted on a printed circuit board
| Enlarge to 446x462 |

Using a Microcontroller

I have used the PIC16C84 microcontroller from Microchip before and so have discovered the advantages of a software design:

  • The electrical diagram is very simple.  The sensors are directly connected to the inputs of the microcontroller, and the outputs of the microcontroller generate the right impulses for the control of the motor.
  • The circuit is built into the model, the sensors and motors are connected and you don’t have to change any of the hardware connections.
  • The design of the program is done on a PC using a programming language. The compiled program is then transferred to the microcontroller by reprogramming its EEPROM program memory (on-board programming).  If the program does not work correctly, you just adjust the program until the system works perfectly.
  • Without changing the PCB layout, the circuit can be used for a totally different model.

The block diagram of the system in figure 1 shows the four inputs from the slotted opto switches connected to a port of the microcontroller and the two Speed and Direction outputs from another port which are fed into another IC, the L6219.

The L6219 Motor Driver from SGS-Thomson

The L6219 is a bipolar monolithic integrated circuit intended either to control and drive the windings of a bipolar stepper motor, or to bi-directionally control up to two DC motors.  The power stage is a dual full bridge capable of sustaining 46V and including four diodes for current recirculation.  Internal pulse width modulation (PWM) can control an output current of up to 750mA with a maximum start-up current of 1A.  More information about this IC can be obtained from the SGS Thompson website at

In order to short-circuit the motor winding when the motor is required to stop dead as mentioned previously, it is connected to the L6219 driver via the Normally Open (N.O.) contacts of a relay.  The PWM pulses produced by the L6219 continually trigger a 555 time delay (monostable) circuit, the output of which keeps the relay switched on. 40ms after the PWM pulses cease, the monostable time period ends and the relay is switched off, and the motor stops rotating immediately because its winding is short-circuited.

Click to enlarge

The printed circuit board
| Enlarge to 640x480 | Enlarge to 1280x960 |


To write the PIC16C84 program I used the JAL (Just Another Language) compiler which was developed by Wouter van Ooijen (Holland). It is a combination of the C & BASIC languages, specially developed for the Microchip PIC16x84 microcontrollers. The compiler and libraries can be downloaded from his website,  For information about the PIC series of microcontrollers, visit the Microchip website at

The program model I used is a ‘finite state’ machine.  The state of the program can be followed on a 7-segment display mounted on the main PCB:

State Number State Description
0 INIT The motor turns slowly to the left and waits until the Left End Sensor is interrupted.  We now move to State 1.  If the Right End Sensor gets interrupted there is a fault in the circuit - the motor turns the wrong way and there is an error.
1 HALT We wait for the Start button to be pushed before moving to State 2.
2 START UP The motor accelerates to maximum speed and we move to State 3.
3 RUN The motor runs at full speed until the Right (or Left) Sensor opens, then we move to State 4.
4 SLOW DOWN The motor slows down to minimum speed and we move to State 5.
5 RUN OUT We wait until the opening of the Right (or Left) End Sensor, then we move to State 6.
6 STOP When the Auto Run flag is set, we move to State 2, otherwise we move to State 1.
7 WAIT We wait 15 seconds and then move to State 2.
The Auto Run Mode

As a demonstration model, it can be run fully automatically by pushing the Reset button while the Start button is already pushed in so the Auto Run mode starts. The lift then goes up and down automatically every 15 seconds.

The Cliff Lift

Below are some pictures of my cliff lift model.  It works with the PIC16C84 board as described above. The four slotted opto switches are now fixed in the model.  At the bottom of picture 1 are the end switches.  In the middle of the track, picture 4, are the left and right switches used to slow down the motor speed.

Click to enlarge

Picture 1: The Cliff Lift model
| Enlarge to 384x512 | Enlarge to 768x1024 |

Click to enlarge

Picture 2: A close-up of one car
| Enlarge to 384x512 | Enlarge to 768x1024 |

Click to enlarge

Picture 3: At the top of the cliff
| Enlarge to 512x384 | Enlarge to 1024x768 |

Click to enlarge

Picture 4: The cars passing
| Enlarge to 512x384 | Enlarge to 1024x768 |

 Shopping List

The resistors given below are those used in Figure 4.

10kΩ 0.25W Metal Film Resistor   1   62-3474   £1.40
(per pack of 100)
180Ω 0.25W Metal Film Resistor   1   62-3431   £1.40
(per pack of 100)
Slotted Optoswitch   1   58-0303   £1.70   £1.70
Grand Total   £4.50

Full printer-friendly parts list

Order the above items from Rapid Electronics via our Circuits Shop and help support the Electronics in Meccano website, without affecting the price you pay! Just click on an item for information about it and/or to add it to your Rapid order.

Orders can also be placed by telephoning Rapid on 01206 751 166 or visiting their website at Prices quoted include VAT at 20%.

 Print This Article

 Bookmark or Share This Article   


Post your questions and comments about this article to the Model Studies Message Board.
We also have many other message boards for your comments, advice and suggestions.

 Free Email Updates!

Join yourEiM and receive email when your favourite articles and topics are updated.  Click here to sign up now!

Article Information
Topic: Model Studies | Created: 13/01/2002 | Last modified: 08/02/2007 | First published in EiM: Issue 10 (January 2001)

Top of Page | Homepage | About | Search | Topics | Features | Circuits Shop | yourEiM

Hosted on a Memset Dedicated Server | © 1998 - 2018 Tim Surtell