new-logo-text.png

The Folding Board Project Back to the BMRC Home Page

Brief

Based on the Winter Wonderland board, construct a new board the folds for easy transport and has a PIC controlled system incorporating a game for children.

A PDF of this build log can be downloaded here.

Components

Item

#

Description

00 Gauge Track

AR

Enough to make two loops on the board including a siding loop

00 Gauge Points, Left Hand

1

A single 00 Gauge point, left hand

00 Gauge Points, Right Hand

1

A single 00 Gauge point, right hand

Hornby Point Motors

2

R8014 - Point Motor and R8015 - Point Motor Housing (Adaptor Base)

9-way D-Type Plug

2

Command connector for the Board and extension cable

9-way D-Type Socket

2

Command connector for the control box and extension cable

6-way DIN Plug

1

Power connector wired to the Dual Power Controller

6-way DIN Socket

1

Power connector mounted to the Board

Black ABS Box 2x3x2

1

Box to contain the four control switches

Red Push-to-Make Switches

2

Two red control switches for Start-Stop and Loop Isolate

Black Push-to-Make Switches

2

Two black control switches for Siding-Park and Siding-Release

9-way D-Type Hood

2

Hood for each end of the extension cable

25-way D-Type Plug

1

Underside board connector to transfer power and points over the fold

25-way D-Type Socket

1

Underside board connector to transfer power and points over the fold

25-way D-Type Hood

2

Hood for each of the underside connectors

CDU

1

http://www.heathcote-electronics.co.uk/CDUpage.htm

PIC IO Dev Board

1

http://www.coolcomponents.co.uk/catalog/product_info.php?cPath=23_28&products_id=65

Power Jack (2.1mm)

1

http://www.maplin.co.uk/dc-power-plugs-43084 Order Code: HH60Q

PIC16F628A

2

http://www.coolcomponents.co.uk/catalog/product_info.php?cPath=30_22&products_id=54

Red Wire

10m

http://www.maplin.co.uk/equipment-wire-16-0.2-6197 Order Code: FA33L

Blue Wire

10m

http://www.maplin.co.uk/equipment-wire-16-0.2-6197 Order Code: FA27E

Black Wire

10m

http://www.maplin.co.uk/equipment-wire-16-0.2-6197 Order Code: FA26D

12VDC Regulator Board

1

Item

Quantity

Maplin Part #

TS7812CZ Regulator

1

Order Code: QL32K

100nF Polyester Capacitor

1

Order Code: N43CJ

100uF Electrolytic Capacitor

1

Order Code: KQ70M

4700uF Electrolytic Capacitor

1

Order Code: AT24B

1N4001S Diode

1

Order Code: QL73Q

1K0 1/8W Resistor

1

Order Code: M1K

5mm Red LED

1

Order Code: WL27E

Two terminal PCB mount block

6

Order Code: RH80B

Train controller

1

Hornby R8012 HM 2000 Dual Power Controller

Table 1: Bill of materials

Part One - Hardware

Building the board

The most complicated part of the construction is making the folding base board. The board must be light and flexible to be hinged, but sufficiently sturdy to mount the track and control electronics. The decision was made to design the board to make it easy to fold, transport and erect with the electronics being fitted later.

Laying the track

Lay the track onto the board so that the following layout is created.

Fitting the Electronics

The electronics can now be fitted to the board in the following order
1: Control Board and sockets
2: Point Motors
3: Power Transfer connector
4: Control Connectors
5: Wiring runs

Control Board and sockets

The PIC-IO-Board, CDU and point switches (Darlington Pair open collector) were all wired to a piece of hardboard sheeting and tested in isolation. This was done to aid construction and to ensure that testing was made easier. The figure below shows the components mounted. Once tested the Control Board is then inserted into the Folding board. It was decided to place the Control Board in one corner of the board to simplify wiring. The figure below shows the Control Board mounted.

Point Motors

The holes for the points were made and then wired to the board. The figure below shows one of the points. The other point is mounted in a similar manner.

Power Transfer connector

The power Transfer connector was then wired and connected to the board using block connectors so as to not tension the wires. The two figures below shows how the Transfer connector is wired.

Control connectors

The connectors to bring power and allow the control box to be connected are then fitted to the board. The figure below shows how the power (6-way DIN) and command (9-way D-Type) is mounted. The Velcro to the right of the D-Type is used to hold the control box when not used.

Wiring runs

The points, track power, Transfer connectors and control board are then wired together. The two figures below show the complete wiring looms.

Part Two - Software

Development

The control software has been written in Microchip C using the MPLAB IDE (http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en019469&part=SW007002) and is modularised into components:-
main.c: This file contains the main track control algorithms.
track.c: This file contains the routines to control the board.
usart.c: This file contains the routines to communicate via the RS232 port.
track.h: This file contains the function headers and constant defines for track.c.
usart.h: This file contains the function headers and constant defines for usart.c.

The compile source code from the above five files is included in Appendix A as hex code ready for programming into a PIC16F628A using an appropriate programmer. The software was programmed to the PIC16F628A using the Microchip PIC Start Plus (http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en010020) as this is what the Author already had.

This is however a legacy product and Microchip recommend using the PICkit 2 Starter Kit (http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en023805&part=DV164120) instead.

Testing

The software has been tested using a PIC16 Simulator (http://www.oshonsoft.com/pic.html) prior to being installed in the test track.

The majority of the testing has been done on the Test Track board with the RS232 debug output connected to a laptop via an RS232 to USB converter running HyperTerminal under Windows XP Home SP3.


This document was last modified: .