I have been ‘head down’ and ‘bum up’ coding in my Arduino driven Signalman’s panel for my future exhibition layout. I’ve jumped head first in and fixed the scrolling of the LCD display on my panel. I made the variables I was using to control the messages to be displayed on the LCD screen global and now I do not have to pass anything to the function that will do the actual scrolling. That fixed my issue. I still get some ghost entries not scrolling off occasionally, but I will identify what causes them and fix them in the future. Given that my LCD screen scrolling seemed to be working as expected, I then started to offload lots of other messages into the LCD panel. I added messages like when a signal is set to hold, or when a shunt move is given a signal approval. Then when the signal goes back to stop, the cancelling of that shunt move signal is also causing a message to be sent to the LCD. I think this will give the Signaller a better understanding of what he is doing, through positive reinforcement. I also fixed a bug from last Sunday where Signal U2 after having its Hold status released, it just sent the signal through yellow and then green, instead of remaining at red if a train had just passed that location and was in the section ahead. That would cause an issue if it continued. I realised that I had not set a particular flag when I re-wrote that section of code used for signal U2. One small change by setting the flag and the signal logic resumed working like a bought one. Occasionally I get signal U1 being orphaned on a red signal after having its HOLD status released. But it is a timing issue. If I then set the signal again back to Hold and then release it again, the signal comes back and the aspect is correctly set. I think I can live with that one little hiccup. It may even be a design feature!
At this point in
time I have two messages that are not being displayed on the LCD panel. I
think I am setting them correctly in the code. So I will look into that a
bit more next week. I jumped in further and moved onto signal D2, and
worked on its code. I then moved to the two of the three signals on the
Dual Gauge line that can be set to Hold. I will install my next slave
Arduino to handle the signals on the branch line and the dual gauge next
week. I will get this working before I start looking at any Dual Gauge IR
Signals. Then I will get the Dual Gauge Up signals working before I do
the DG Down signals.
On Wednesday evening I think I mastered the DOWN held signal at D2. I can now shunt to the UP main. However, I was perplexed why my shunt switch on the panel could not get the D2 shunt signal to light. I traced it back to a solder joint had broken. So I resoldered that jumper wire and it worked. I was very happy. I noticed that one signal DG5 also stopped working. So I jiggled some wires and all in now good. However, signal SS1, the standard gauge shunt signal from the siding to the Dual Gauge did not work. I was thinking that I will have to investigate that further. Also at that stage I have not yet tested a train leaving the standard gauge. I noticed that the SS1 signal went out maybe on Wednesday morning.
So while on my
morning walk on Thursday, the old grey matter was thinking about my Signal SS1.
I realised that on Wednesday when I finally started to get signals DG2
and DG4 to respond to signal aspects. The signal at one end of the board
would light, but the track detection circuit LED at the other end also came
on. It was then that I realised that I needed to swap the addresses of my
Dual Gauge Up and Dual Gauge Down expansion boards. I did this and
thought nothing further as it then brought the track detection LEDs and the
signals back into sync. However, it did not click that the SS1 signal was
extinguished following this move. So while on the walk, my brain was
wandering and it turned to signal SS1. It was at that point, I realised
that the Red and Yellow LED addresses which used to be on the UP Board at ports
12 and 13, where now on the DOWN Board at those same addresses. The code
in my Signal logic, still had them setting LEDs on and off on the UP
Board. So on Thursday afternoon, I changed the code to move the addresses
in the code to the DOWN board and wouldn’t you know it, after compiling the
code and sending it to the Arduino, the SS1 signal now turned back on.
The plan for the rest of Thursday was to write the code for making the
SS1 signal work for a standard gauge train leaving the siding. That was
to be followed by the Branch signals, then DG3 for trains stopping movements
into DG4 when a train is entering or leaving the dual gauge line into the
standard gauge sidings.
So all the code for
the Branch signals was written and tested and apart from one message not
appearing on the LCD screen, I can shunt from the branch to the UP Main, and
exit to the DOWN Main and head north. It is now also working like a
bought one. I took it to the Club on Saturday and showed it off. I
got plenty of questions and lots were interested.
Saturday evening I
started assembling all the wiring for my second slave Arduino for the next lot
of IR detectors to be installed. Then on Sunday after another purchase at
JAYCAR, I found and fixed a few cosmetic errors in my signalling logic.
Some signal aspects were not cancelling when I turned off their activation
switch on the panel. But as I was doing these changes, my memory
utilisation in my Arduino continued creeping up. It got to over 6200
bytes. That caused a warning message to be issued by the IDE compiler,
that the Arduino could become unstable due to lack of free memory. I did
some research and found out how to reduce this usage. Basically every
Serial.print statement e.g. Serial.print(“blah blah”) for debugging and
programming tracking purposes, was changed to a Serial.print(F(”blah blah”))
and my memory usage reduced down to 2373 bytes. I was amazed!
I had a basic test
of the program on Sunday afternoon and of the items implemented about 95% are
working as designed. I know of a couple of small improvements around SPAD
detection. I display this SPAD message every time around the logic loop,
instead of just once while the IR Signal detection LED is lit. I’m just
too lazy to code that change in the first 8 places in the code today. I
also have the RED aspect on DG7 lights intermittently. Its address is pin
9 in the DGBoardDOWN, But I do not know when I activate it in the
code. So I have just referenced the wrong board or wrong address
somewhere, but my brain is so fried I cannot find it. But I will.
Progress is good and satisfying.




















