Skip to main content

Posts

Showing posts from November, 2020

Electronics 2

 On Sunday Davy Dick ran an online version of his Electronics 2 course. Normally he runs them at his home with around six or seven attendees which gives plenty time for questions and the opportunity to see and touch the circuits The course was divided into three sections covering Numbering systems - decimal, binary, hex - how do we use them in our projects Digital signals • How do we store numbers (e.g. inside a DCC decoder or inside the Servo4 module) • How do we pass numbers (e.g. from a command station to a loco, CBUS, etc.) Serial / parallel connections How transistors work  Using transistors as switches and operating high power devices. Integrated Circuits Examples of ICs, PICs Demonstrations of popular ICs. • Driving a 7-segment display • LED chasers • Route selection • Power drivers, including motors • Comparators (DCC TOTI) 555 timers - and how they are used in Pocket Money Kits How this very popular (and cheap) IC works and its three operating modes: • Bistable – as in the shu

Project Updates

My apologies for the shortage of posts this month due to shortage of writing time while I've been  focusing on other projects. Speaking of projects, at the last Cumbria Group meeting we were updated on two very interesting developments. Firstly Mark Bradley has made great progress on his operator messaging project which was featured in September 12 A timetable of train movements has been created initially on a card system so that operators were aware of which trains to expect or prepare for the next sequence. The movements are now recorded on  a memory card and each record is sent by the Arduino Mega via it's I2C bus to the relevant display or displays. Different display types have been tested and the records can be advanced or reversed in single steps or in tens. The code is available from Mark for those interested. A second project this time from Tony Hoath, featured a complex scissor crossing with route switching using Arduino controlled relays to ensure the relevant polarit

Mimic Points in Visual Basic

For this project, I wanted to create a moving graphic to mimic a set of points moving from one position to the other.  This Blog shows all that is needed. The first Picture shows the 6 lines needed.                                 This Picture shows the Line Properties.    The tracks are shown with 5 lines, though only the middle ones in red are involved.  The other line shown below the others is the one that actually "moves".  It is shown below the other lines for clarity only.  At the start of the Program running, it is positioned over the lower red line. In VB, each Line has properties and these are shown above.  To get a line to appear to move, all that needs to be done is to gradually change the X2 and Y2 co-ordinates of the line. This is the code for the program. The first 6 lines create a pause Function in the program, by using the Computers internal Clock. Each of the other Procedures move the X2 and Y2 co-ordinates. For j - 1 to 20                          Starts a l

Shuttle Plus or Super Shuttle?

 A really interesting project was discussed at tonight's JALSIG Zoom meeting. The Basic shuttle kit PMP4 was designed in February 2013 and remains one of the most popular Pocket Money Kits. It uses a 555 circuit as a basic timer  and changes the state of a relay to reverse the polarity of the track. Davy Dick has revisited this circuit but this time used a 14 Pin PIC (16F676) to replicate the circuit and  add a few enhancements to take advantage of the additional pins available. It is hoped that this will eventually appear as a Pocket Money Kit with PCB sometime in the New Year. Potential features include adjustable cycle times, controlling semaphore or lights using a delay or detectors set by an option jumper and incorporation of PMP4a  for shuttles with branches.   Two additional pins might be used to control crossing gates or trigger sound effects or anything else your imagination fancies. Using around 12 components and some simple coding techniques, this could become a really f

Sound file editing

 At today's West of Scotland meeting with thirty three attendees, Chris Cosgrove showed us how he uses Audacity ( a free Open Source software) to record and edit sound recordings. The Basic toolbar contains icons for Pause, Play, Stop, Goto Beginning, Goto End and Record. Chris showed how you can select a piece of a recording, remove it and replace with a fixed period of silence.  The ability to add silence is very useful for joining two tracks together with a fade out of the first merging with the fade in of a second. Copy and Paste commands make sampling from different sound files fairly straightforward and Chris mixed bird sounds, sheep and a couple of train recordings including a reversed section to simulate the train disappearing. The Audacity help manual is very well written and covers all aspects of using the program. There are many good sources of audio files including YouTube and the following links. https://freesound.org http://bbcsfx.acropolis.org.uk Chris McCarthy then

Arduino controlled shuttle

 Thirteen members joined us on today's Cumbria Zoom meeting where Tony Hoath demonstrated and explained his Arduino based shuttle layout which he uses for bedding in new OO scale locos. The basic Pocket Money  shuttle Kit suffers from the sudden stop when the track break is detected and the sudden start when the relay is reversed. The affect can be minimised if slow speed is selected. Tony uses a simple Light Dependent Resistor to detect the presence of a loco and then gradually decelerates and finally stops on reaching a second sensor. The circuit is shown below. As the relay is only switched when no power is being supplied to the track, a much smaller relay can be used to change direction. As the locomotive returns it ramps up to a set speed so the rather unrealistic stop / start is avoided. Tony's sketch is available below. //00 test track //1 loco to run back and forth //2 LDR,s to determine train postion. //2 push buttons. Green starts and stops operation. The stop is r

Use Visual Basic to enhance the Display

 The reason that I like VB as a Programming Environment is the ease with which you can make it look nicer or Enhance the Display if you want to sound fancier about it. If we take the Red LED - Green LED Program, we can another couple of features which show the beginnings of what might appear in a mimic panel.  So the first thing we would do is to add a couple of Shapes (another type of VB Object). We put a shape beside the Red Control buttons then set the properties to :- Shape = circle Fillcolor = Red Bordercolor = red Name = Red_Circle Do the same for the second, green, shape. Then we edit the VB code Private Sub Red_Off_Click()   MSComm1.Output = "r"                   '   Sends r Switch off Red   Red_Circle.FillColor = vbWhite       '   Changes the fillcolor to white End Sub Private Sub Red_On_Click()   MSComm1.Output = "R"        '   Sends R Switch on Red   Red_Circle.FillColor = vbRed End Sub Running the Program now gives an improved display.      T

Introduction to linking Visual Basic to an Arduino

 Visual Basic is an "Object Oriented" language and is a programming environment which I'm comfortable in, so I'm going to look at the steps involved in setting up a Program on a Laptop to control a simple model train layout. Using an Arduino Uno, connect via a USB Cable, the first thing is to establish communication from Laptop to the Arduino. This needs the Comms Component to be added.  This link shows how to do that.     http://www.thaiio.com/prog-cgi/0002_serial.htm This picture shows the main (functional) sections of code, along with the Program display (Bottom left) when it's running. The Visual Basic bit (top left) In VB, you add "Objects" to a form and then attach some code to each Object. Some of the Objects you get in VB are Command Buttons, Labels, Text Boxes, List Boxes.  There are many others. This example has "Command Buttons" named "Red On", "Green Off" and all that happens is when, for example you click on the