.

Welcome to My HO Model Railroad Blog

My AC-9 Kitbash

The AC-9, SP 3805 above is the end product of a Kitbash Project from a Rivarossi Cab Forward.

It is the second of three AC-9 Yellowstones that I rebuilt from AC-10 Cab Forwards. I am a devout 1950s era Southern Pacific HO Model Railroader. I have a fleet of 39 steam locomotives of which 18 are articulated and 34 diesels.

My layout is set in the mid 1950s in the Southern New Mexico/West Texas area. I grew up in El Paso Texas during the end of the Steam Era and lived in Alamogordo, NM during the 1960s & 70s. My wife and I are both retired and now reside in Bakersfield California. We have lived on both ends of the Southern Pacific Cab Forward Southern Route.

This Blog is about my HO Model Railroad Hobby and how I model the Southern Pacific from my memories of the mid 1950s era as a teenager. I wrote a short synopsis of my back ground that can be found by going to my About Me page.


Mel Perry, PMFE  (Professor of Miniature Ferroequinology Engineering)

1.  ferroequinology  Literally "the study of the iron horse." (ferros = iron, equine = horse, -ology = study of)

2. The study of the history of railroads and railroad trains, especially for the purpose of model railroading.

3. What a railfan practices.


This is a simple track layout drawing of my Model Railroad.







You can click on the colored text to follow the links.


I moved the About Me & My Layout articles to their own page because they seldom change.
Updated December 5, 2014

To go to my current Locomotive Inventory click here.
Updated September 14, 2015

To go to my additional pages scroll down to the bottom of my Blog to My Pages Menu and click on the links.



February 15, 2017 Another Project Mod

If you follow my blog you know I'm never really finished with any of my projects.  Ten minutes after I "finish" a project I see where it could be improved or done a different way, maybe more efficient or something I missed.

This post is about mods needed to make my Arduino micro controllers compatible and adapt them to my last project, my Arduino 8 slot card shelf.  The Arduinos need a rear connector to adapt them to the card shelf, a right angle connector will make it easy to connect to the cards.

The Random Lighting Controllers will be the easiest to convert only needing a single row 20 pin 90° right angle male connector.   The UNO 20 pin female connector consists of two connectors, a 16 pin for the structure lighting and a separate 4 pin for Arduino power.  Pins 1 to 14 will be the high current outputs or in this case negative/ground switching, pins 15 & 16 will be for power to the structures.  The remaining pins will be for Arduino power.  Because I operate my 12 volt incandescent structure lighting at 8½ volts, one pin will be used for the isolated high current input a second pin for high current common or ground.  My Random Light Arduino controllers will operate from the 5 volt DC to DC converters connected to the board at the USB 5 volt board connection.  The 5 volts will also power the TTL circuits in the seven channel driver chips.

I simplified the wiring by using two separate female connectors to mate up to the male 20 pin angle connector.  One with 16 pins that will connect directly to the structure and a 4 pin for input power in to the Arduino.  That will eliminate the need for a secondary terminal block.  

The Arduino MEGA mods will be a slightly harder task to adapt to the card shelf.  At this time my Arduino MEGA is using dual expansion shields (boards) and each board will need a 40 pin dual row 90° right angle male connector.  My Arduino signal controller uses 68 pins to control 16 signal blocks plus power,  That will require a rebuild of both expansion boards.  This mod will also allow for any DC voltage up to 50 volts @ 500ma to be switched by the controller by using separate pins for power.  The Arduino MEGA power will be the same as the UNOs operating from the 5 volt source.

After a lot of thought and planning I decided to mount the DC to DC convertors to the top of the card shelf.  I need easy access to adjust the current and voltage adjustments and as I was planning to use a small fan to remove heat from the compartment, this arrangement will work out much better. 

Now I will have easy access to the Arduinos and the DC to DC converters.


The DC to DC  converters will be used to convert 12 volts to 1.4 volts for the 1½ volt micro bulbs used in my vehicles, 5 volts for the Arduinos and other miscellaneous electronic devices and 8½ volts for structure and street lighting.  The DC to DC converters will easily handle 8 amps each, with the help of forced air cooling they can supply up to 12 amps each.  My 12 volt power is a 30 amp switching power supply, very efficient and small, almost no heat from switching power supplies. 

A secondary venture in this mod will be to remove the on-board LED indicators, once the Arduino is up and working, the indicators are not needed and can't be seen when the Arduino in in the card shelf.  An external test plug with LEDs can be plugged into the test connector for testing if needed. 

 These are the components for my Random Lighting Controller.  The Arduino connectors come in 40 pin Breakable strips.  The 40 pin male connector needs to be cut with wire cutters to fit the Arduino UNO female connectors.


The Arduino Expansion Shield circuit board comes without connectors so I stock single row 40 pin Male and Female as well as a 90° angle Male connectors.  I also stock the dual row 2x40 pin (80 pins).

Because my structures were built many years ago using 12 volt Grain of Wheat incandescent bulbs my controller will need high current outputs.  The Arduino outputs are limited to 20 ma.  I use TD62304AP seven channel driver chips with 500 ma outputs per channel.  The driver chips have 16 pins so my expansion board will have two 16 pin IC sockets to accommodate the drivers.

I use a male 20 pin 90° angle connector on the rear of the board for power in to the board as well as the outputs to the structure lighting.

The driver chips have switched low outputs with 50 volt capacity.  The 20 pin female connector actually be two connectors, a 4 pin for power in and a 16 pin for the structure power.

The 4 pin connector will use two pins for Arduino power and two pins for structure lighting power. 

The 16 pin connector will use two pins for structure power out, the remaining 14 pins will be used for switched low outputs to the 12 volt bulbs.   

I have installed the Arduino shelf and the DC to DC converters in my control panel frame.


The far left converter is set to 1.45 volts to power the micro bulb headlights in my 80 plus vehicles.

The center converter supplies 5 volts for powering Arduinos and other solid state controllers.  The far right converter is set to 8.5 volts and it will power building/structure lighting and street lights.  The converter are powered by a 12 volt 30 amp switching power supply.

The two Arduino UNOs are programmed as Random Light Controllers, the UNO on the left powers Susie's Mansion and the one on the right powers Doug's "Psycho House".

I've been working on a camera car to be either pushed or pulled by one of my locomotives.  It will be integrated into my control panel in the Arduino portion.  I will be using an Arduino Uno as a wireless Blue Tooth remote servo controller.  The MD91S Camcorder will be mounted on a depressed center flatcar.  The servo will rotate the camera 180° via Blue Tooth.

This is my proposed Arduino panel layout.



I'm planning on using a 7" Tablet as a viewfinder with WiFi between the Tablet and the MD91S Camcorder.  The MD81S will function as a WiFI camera as well as a camcorder with a capacity of 60 minutes of AVI recording.



Drawing Updated April 1, 2017

The drawing above shows my camera car plan.  The camcorder is self contained with a 32Gb Micro SD memory chip and Lithium battery.  I will use track power for the Arduino Nano, Blue Tooth and servo power.  The flatcar has all wheel power pickup.

My new Arduino card shelf is in and working as planned. 
 

February 3, 2017 Arduino MEGA Signal Controller

The Arduino's are fascinating creatures!  This post is about using an Arduino MEGA 2560 as a Signal Controller.  The MEGA has 54 I/O ports and 16 analog input ports.  My Arduino sketch will drive 16 LED 3 color signal heads using 48 outputs.  The 16 analog inputs will handle the outputs from 16 occupancy detectors or block controls.

Its rather easy to drive a signal system by using a simple truth table for each signal head color.

Green = advance block high + signal block high = Green on
              else green off

Yellow = advance block low + signal block high = Yellow on
              else yellow off

Red= signal block low = Red on

The info above is for one direction (CCW), a separate code is required for reverse direction (CW) simply by reversing the order of the block numbers.  For my layout I used CCW (Counter Clock Wise) for West and CW (Clock Wise) for East.


Below is my Arduino MEGA 2560 Sketch for the controller.  The setup definitions are for a total of 16 blocks.  I only listed two CCW blocks for this post, additional blocks can be added with copy and paste and changing to block and signal head numbers for the proper sequence up to 16 blocks.


========================================================================

void setup()

{
int greenledPin1 = 1;    // Signal Head 1 Green
int yellowledPin2 = 2;   // Signal Head 1 Yellow
int redledPin3 = 3;      // Signal Head 1 Red
int greenledPin4 = 4;    // Signal Head 2 Green
int yellowledPin5 = 5;   // Signal Head 2 Yellow
int redledPin6 = 6;      // Signal Head 2 Red
int greenledPin7 = 7;    // Signal Head 3 Green
int yellowledPin8 = 8;   // Signal Head 3 Yellow
int redledPin9 = 9;      // Signal Head 3 Red
int greenledPin10 = 10;  // Signal Head 4 Green
int yellowledPin11 = 11; // Signal Head 4 Yellow
int redledPin12 = 12;    // Signal Head 4 Red
int greenledPin13 = 13;  // Signal Head 5 Green
int yellowledPin14 = 14; // Signal Head 5 Yellow
int redledPin15 = 15;    // Signal Head 5 Red
int greenledPin16 = 16;  // Signal Head 6 Green
int yellowledPin17 = 17; // Signal Head 6 Yellow
int redledPin18 = 18;    // Signal Head 6 Red
int greenledPin19 = 19;  // Signal Head 7 Green
int yellowledPin20 = 20; // Signal Head 7 Yellow
int redledPin21 = 21;    // Signal Head 7 Red
int greenledPin22 = 22;  // Signal Head 8 Green
int yellowledPin23 = 23; // Signal Head 8 Yellow
int redledPin24 = 24;    // Signal Head 8 Red
int greenledPin25 = 25;  // Signal Head 9 Green
int yellowledPin26 = 26; // Signal Head 9 Yellow
int redledPin27 = 27;    // Signal Head 9 Red
int greenledPin28 = 28;  // Signal Head 10 Green
int yellowledPin29 = 29; // Signal Head 10 Yellow
int redledPin30 = 30;    // Signal Head 10 Red
int greenledPin31 = 31;  // Signal Head 11 Green
int yellowledPin32 = 32; // Signal Head 11 Yellow
int redledPin33 = 33;    // Signal Head 11 Red
int greenledPin34 = 34;  // Signal Head 12 Green
int yellowledPin35 = 35; // Signal Head 12 Yellow
int redledPin36 = 36;    // Signal Head 12 Red
int greenledPin37 = 37;  // Signal Head 13 Green
int yellowledPin38 = 38; // Signal Head 13 Yellow
int redledPin39 = 39;    // Signal Head 13 Red
int greenledPin40 = 40;  // Signal Head 14 Green
int yellowledPin41 = 41; // Signal Head 14 Yellow
int redledPin42 = 42;    // Signal Head 14 Red

int blockdetector1Pin = A1;    // Block 1 Occupancy Detector
int blockdetector2Pin = A2;    // Block 2 Occupancy Detector
int blockdetector3Pin = A3;    // Block 3 Occupancy Detector
int blockdetector4Pin = A4;    // Block 4 Occupancy Detector
int blockdetector5Pin = A5;    // Block 5 Occupancy Detector
int blockdetector6Pin = A6;    // Block 6 Occupancy Detector
int blockdetector7Pin = A7;    // Block 7 Occupancy Detector
int blockdetector8Pin = A8;    // Block 8 Occupancy Detector
int blockdetector9Pin = A9;    // Block 9 Occupancy Detector
int blockdetector10Pin = A10;  // Block 10 Occupancy Detector
int blockdetector11Pin = A11;  // Block 11 Occupancy Detector
int blockdetector12Pin = A12;  // Block 12 Occupancy Detector
int blockdetector13Pin = A13;  // Block 13 Occupancy Detector
int blockdetector14Pin = A14;  // Block 14 Occupancy Detector




  pinMode(greenledPin1, OUTPUT);
  pinMode(yellowledPin2, OUTPUT);
  pinMode(redledPin3, OUTPUT);
  pinMode(greenledPin4, OUTPUT); 
  pinMode(yellowledPin5, OUTPUT);
  pinMode(redledPin6, OUTPUT); 
  pinMode(greenledPin7, OUTPUT);
  pinMode(yellowledPin8, OUTPUT);
  pinMode(redledPin9, OUTPUT);
  pinMode(greenledPin10, OUTPUT); 
  pinMode(yellowledPin11, OUTPUT);
  pinMode(redledPin12, OUTPUT);   
  pinMode(greenledPin13, OUTPUT);
  pinMode(yellowledPin14, OUTPUT);
  pinMode(redledPin15, OUTPUT);
  pinMode(greenledPin16, OUTPUT); 
  pinMode(yellowledPin17, OUTPUT);
  pinMode(redledPin18, OUTPUT); 
  pinMode(greenledPin19, OUTPUT);
  pinMode(yellowledPin20, OUTPUT);
  pinMode(redledPin21, OUTPUT);
  pinMode(greenledPin22, OUTPUT); 
  pinMode(yellowledPin23, OUTPUT);
  pinMode(redledPin24, OUTPUT); 
  pinMode(greenledPin25, OUTPUT);
  pinMode(yellowledPin26, OUTPUT);
  pinMode(redledPin27, OUTPUT);
  pinMode(greenledPin28, OUTPUT); 
  pinMode(yellowledPin29, OUTPUT);
  pinMode(redledPin30, OUTPUT); 
  pinMode(greenledPin31, OUTPUT);
  pinMode(yellowledPin32, OUTPUT);
  pinMode(redledPin33, OUTPUT);
  pinMode(greenledPin34, OUTPUT); 
  pinMode(yellowledPin35, OUTPUT);
  pinMode(redledPin36, OUTPUT); 
  pinMode(greenledPin37, OUTPUT);
  pinMode(yellowledPin38, OUTPUT);
  pinMode(redledPin39, OUTPUT);
  pinMode(greenledPin40, OUTPUT); 
  pinMode(yellowledPin41, OUTPUT);
  pinMode(redledPin42, OUTPUT); 
 
  pinMode(blockdetector1Pin,  INPUT_PULLUP);
  pinMode(blockdetector2Pin,  INPUT_PULLUP);
  pinMode(blockdetector3Pin,  INPUT_PULLUP);
  pinMode(blockdetector4Pin,  INPUT_PULLUP);
  pinMode(blockdetector5Pin,  INPUT_PULLUP);
  pinMode(blockdetector6Pin,  INPUT_PULLUP);
  pinMode(blockdetector7Pin,  INPUT_PULLUP);
  pinMode(blockdetector8Pin,  INPUT_PULLUP);
  pinMode(blockdetector9Pin,  INPUT_PULLUP);
  pinMode(blockdetector10Pin, INPUT_PULLUP);
  pinMode(blockdetector11Pin, INPUT_PULLUP);
  pinMode(blockdetector12Pin, INPUT_PULLUP);
  pinMode(blockdetector13Pin, INPUT_PULLUP);
  pinMode(blockdetector14Pin, INPUT_PULLUP);
}

void loop()
{
int greenledPin1 = 1;    // Signal Head 1 Green
int yellowledPin2 = 2;   // Signal Head 1 Yellow
int redledPin3 = 3;      // Signal Head 1 Red
int greenledPin4 = 4;    // Signal Head 2 Green
int yellowledPin5 = 5;   // Signal Head 2 Yellow
int redledPin6 = 6;      // Signal Head 2 Red
int greenledPin7 = 7;    // Signal Head 3 Green
int yellowledPin8 = 8;   // Signal Head 3 Yellow
int redledPin9 = 9;      // Signal Head 3 Red
int greenledPin10 = 10;  // Signal Head 4 Green
int yellowledPin11 = 11; // Signal Head 4 Yellow
int redledPin12 = 12;    // Signal Head 4 Red
int greenledPin13 = 13;  // Signal Head 5 Green
int yellowledPin14 = 14; // Signal Head 5 Yellow
int redledPin15 = 15;    // Signal Head 5 Red
int greenledPin16 = 16;  // Signal Head 6 Green
int yellowledPin17 = 17; // Signal Head 6 Yellow
int redledPin18 = 18;    // Signal Head 6 Red
int greenledPin19 = 19;  // Signal Head 7 Green
int yellowledPin20 = 20; // Signal Head 7 Yellow
int redledPin21 = 21;    // Signal Head 7 Red
int greenledPin22 = 22;  // Signal Head 8 Green
int yellowledPin23 = 23; // Signal Head 8 Yellow
int redledPin24 = 24;    // Signal Head 8 Red
int greenledPin25 = 25;  // Signal Head 9 Green
int yellowledPin26 = 26; // Signal Head 9 Yellow
int redledPin27 = 27;    // Signal Head 9 Red
int greenledPin28 = 28;  // Signal Head 10 Green
int yellowledPin29 = 29; // Signal Head 10 Yellow
int redledPin30 = 30;    // Signal Head 10 Red
int greenledPin31 = 31;  // Signal Head 11 Green
int yellowledPin32 = 32; // Signal Head 11 Yellow
int redledPin33 = 33;    // Signal Head 11 Red
int greenledPin34 = 34;  // Signal Head 12 Green
int yellowledPin35 = 35; // Signal Head 12 Yellow
int redledPin36 = 36;    // Signal Head 12 Red
int greenledPin37 = 37;  // Signal Head 13 Green
int yellowledPin38 = 38; // Signal Head 13 Yellow
int redledPin39 = 39;    // Signal Head 13 Red
int greenledPin40 = 40;  // Signal Head 14 Green
int yellowledPin41 = 41; // Signal Head 14 Yellow
int redledPin42 = 42;    // Signal Head 14 Red

int blockdetector1Pin = A1;    // Block 1 Occupancy Detector
int blockdetector2Pin = A2;    // Block 2 Occupancy Detector
int blockdetector3Pin = A3;    // Block 3 Occupancy Detector
int blockdetector4Pin = A4;    // Block 4 Occupancy Detector
int blockdetector5Pin = A5;    // Block 5 Occupancy Detector
int blockdetector6Pin = A6;    // Block 6 Occupancy Detector
int blockdetector7Pin = A7;    // Block 7 Occupancy Detector
int blockdetector8Pin = A8;    // Block 8 Occupancy Detector
int blockdetector9Pin = A9;    // Block 9 Occupancy Detector
int blockdetector10Pin = A10;  // Block 10 Occupancy Detector
int blockdetector11Pin = A11;  // Block 11 Occupancy Detector
int blockdetector12Pin = A12;  // Block 12 Occupancy Detector
int blockdetector13Pin = A13;  // Block 13 Occupancy Detector
int blockdetector14Pin = A14;  // Block 14 Occupancy Detector



{
  // CCW Block 1 Green
 
  // read from the button pin
      digitalRead(blockdetector1Pin);
      digitalRead(blockdetector2Pin);
          
 
  if (digitalRead(blockdetector1Pin) == HIGH  &&  digitalRead(blockdetector2Pin) == HIGH) // read two switches
  
      digitalWrite(greenledPin1,LOW);
  else
  {
      digitalWrite(greenledPin1, HIGH);
   }

  //CCW Block 1 Yellow
  // read from the button pin
     
      digitalRead(blockdetector1Pin);
      digitalRead(blockdetector2Pin);

  if (digitalRead(blockdetector1Pin) == HIGH  &&  digitalRead(blockdetector2Pin) == LOW)

      digitalWrite(yellowledPin2,LOW);

  else
  {
      digitalWrite(yellowledPin2, HIGH);
   }

    //CCW Block 1 Red
  // read from the button pin
      digitalRead(blockdetector1Pin);
    

  if (digitalRead(blockdetector1Pin) == LOW)

      digitalWrite(redledPin3,LOW);

  else
  {
      digitalWrite(redledPin3, HIGH);
       
 
   }

  // ==============================================================
  
   {
  // CCW Block 2 Green
 
  // read from the button pin
      digitalRead(blockdetector2Pin);
      digitalRead(blockdetector3Pin);
       
 
  if (digitalRead(blockdetector3Pin) == HIGH  &&  digitalRead(blockdetector3Pin) == HIGH) // read two switches
  
      digitalWrite(greenledPin4,LOW);
  else
  {
      digitalWrite(greenledPin4, HIGH);
   }

  //CCW Block 2 Yellow
  // read from the button pin
     
      digitalRead(blockdetector2Pin);
      digitalRead(blockdetector3Pin);

  if (digitalRead(blockdetector2Pin) == HIGH  &&  digitalRead(blockdetector3Pin) == LOW) //read two switches

      digitalWrite(yellowledPin5,LOW);

  else
  {
      digitalWrite(yellowledPin5, HIGH);
   }

    //CCW Block 2 Red
  // read from the button pin
      digitalRead(blockdetector2Pin);
    

  if (digitalRead(blockdetector2Pin) == LOW)

      digitalWrite(redledPin6,LOW);

  else
  {
      digitalWrite(redledPin6, HIGH);
       
  }

  
  
   }

  // ==================================================================



January 4, 2017 Arduinos for My Model Railroad

Final Update: Feb 10, 2017

This will be an ongoing project, I expect it to take several weeks to complete.  A fellow on the Model Railroad Forum got me interested in the programmable Arduino micro computer controllers.  I have been wanting to upgrade my existing signal controller and the Arduino MEGA will easily handle a 16 block control system.  The MEGA has 54 digital I/O ports and 16 analog Inputs, I'm currently only using 8 blocks.

The Southern Pacific used three color single head signal heads in their signaling system.  I'm currently using 3mm bi-color three lead common cathode LEDs in my signal heads so this project will drive those same LEDs.

The Arduino outputs have a maximum current of 20ma per port so I will include 500ma driver chips on an expansion board (the Arduino world calls an expansion board a "Shield") for my MEGA.  I plan on adding 5mm LEDs paralleling the Arduino outputs on my control panel.

To my surprise there aren't any Arduino card shelves available and because I plan on using multiple Arduinos on my layout this project will include building a card shelf capable of holding 8 Arduinos with the ability to expand.

I have three Arduino UNOs with expansion Shields set up as 14 port random lighting controllers.  They also have 500ma driver chips and and randomly turn on and off 12 volt 40 to 100 ma incandescent bulbs in my rural houses.  The 7 channel 500ma driver chips have a max voltage input of 50 volts so they are very versatile.  I operate my 12 volt bulbs at 8½ volts for a more realistic lighting effect and longer bulb life.  I can easily change the brightness of the bulbs by increasing or decreasing  the voltage to the driver chips.

This is an Arduino UNO programmed as a 14 port light driver using high current 7 channel driver chips on an Expansion Shield.



This is a MEGA with its high current driver chips on an Expansion Shield.  Both the UNO and MEGA output connectors will need to be changed to fit the card shelf.  A single dual row Arduino connector (40 pins) will handle all connection to the UNO and MEGA.

I have all the material to begin making my Arduino card shelves.  This is a CAD drawing of my proposed card shelf project.



I was able to purchase a 24" x 36" piece of 16 gauge Aluminum at a local metal shop for $15 so I'm ready to start on my project.  Earlier I found some 16 gauge Aluminum angle at Lowe's.

The sheet of Aluminum is large enough to build a couple of 4 card Arduino shelves as well as a new control panel for my layout.  As they say, "two birds with one stone".  That turned out to be the best price for sheet Aluminum I've seen in several years.  

February 10th Update:

I finished a single Arduino UNO card shelf and it came out very nice as shown below.

   
After finishing the 4 slot shelf and experimenting a bit I decided to build single shelf that would hold three Arduino MEGAs and five UNOs.  I have given a lot of thought towards micro controllers for my layout needs.  I ended up with a total of eight for my layout.  Six Arduinos should be sufficient for current and future needs so a single shelf with 8 slots should fill my need very well.

This is my 8 slot Arduino Card Shelf shown with a Arduino MEGA.


The 8 slot card shelf fits snug in the left side compartment in my control panel.  When I built my control panel frame 28 years ago I left room for future expansion.  


My multiple Arduino mounting project has worked out very nice.
 

November 12, 2016 Arduino UNO Random Lighting Project, Arduino Sketch

February 10, 2017 update:

I did a redesign of my random light controller sketch and expansion board from 12 to 14 outputs.  This is the 14 output sketch:

================


#define numleds  14                                                      
byte ledpins [ ] =  { 0,1,2,3,4,5,6,7,8,9,10,11,12,13 } ;
void setup( )  {                  
    for ( int  i=1; i <= numleds;  i++ )  {     
    pinMode ( ledpins [ i ], OUTPUT) ;
    digitalWrite ( ledpins [ i ] , HIGH) ;
   }
  
}
void loop ( )  {  
                digitalWrite ( ledpins [ random ( 0, numleds+1 ) ], lightsw ( ) ) ;
                delay ( 4000 ) ;                  
}
boolean lightsw ( )  {

 if  ( random (0,100) > 60 ) return LOW ;
   else return HIGH ;
}







 
================

Sketch uses 2,130 bytes (0%) of program storage space.  Maximum is 253,952 bytes.
Global variables use 27 bytes (0%) of dynamic memory, leaving 8,165 buyes for local variables.  Maximum is 8,192 bytes.


 =================



The only difference to the expansion board is wiring up the 7th output of each chip, all 14 outputs of the driver chips are used.
 
    -------------------------------------------------------------------------------- 

I decided to make a random lighting controller for my structures.  The Arduino UNO micro processor is perfect for my project.  The cost is very low due to the Arduino being "Open Architecture".   The Arduino can drive 12 output ports, each port can deliver 20ma at 5 volts.  That is the max current available and posts on the Internet say 'to be on the safe side keep the current below 15ma per port".

I rarely operate me LEDs over 10ma so I'm in the "Safe Zone".  I also have many structures with 12 volt incandescent bulbs for lighting.  The 12 volt incandescent bulbs can draw anywhere from 40 to 100ma at 12 volts, I operate my 12 volt bulbs in the vicinity of 9 volts for longer life but mainly for realism.  A small incandescent bulb operating near max voltage doesn't look very realistic, toy like to me.

To obtain a higher current output from the UNO I came up with a simple 500ma per channel driver chip.   It is rather a simple project again because of the Arduino open architecture.  The UNO will direct drive the TD62304AP seven channel driver chip.  The UNO 5 volt regulator will provide the power to the logic side of the driver chip and the driver outputs will switch the ground side of the lighting with an input from 1 to 50 volts at up to 500ma per channel.

Each channel of the driver chip requires .320ma from the UNO, as there is such little current needed from the UNO if you would like to monitor the outputs LEDs can also be used directly from the UNO outputs.  My design allows for monitoring.

To get started on this project here is what you need.


The Arduino UNO is available on eBay for under $5 including a USB programming/power cable.  

The UNO Expansion Boards come in several versions, most come with the Arduino connectors.  This particular board has paired links that make building this driver circuit easier.  This board has a part number of 64502SP13-10.  I haven't been able to find it with that number, only with "paired links".  Anywhere between 2 for $5 and 4 for $8.

The TD62304AP Driver chips are also available on eBay under $2.  The 16 pin DIP sockets are available at any electronic store (Radio Shack).

I normally buy almost all of my electronic parts in bulk off eBay.

I buy the single row 40 pin .1"/.254mm breakable sockets off eBay.  The sockets can be used for either male or female connectors.  For a better male fit to the socket I buy the male header strips, the pins are a bit larger in diameter and fit tighter into the sockets.

I worked up a CAD drawing of the UNO expansion board.



I have posted the full size and actual size downloadable drawings in PDF on my Google Drive.   

When wiring the expansion board the output terminals are not in order, Pin 0 is output #1 then it skips #1 & #2.  Pins #3 through Pin 13 are outputs #2 through #12.

This is my finished controller.



The 13 pin micro strip connector at the bottom is the UNO processor switched ground outputs 1 through 12, Pin 13 is +5 volts (Max 20ma).  This connector can drive LEDs directly.

The 13 pin strip above the chips is the high current switched ground (500MA).  Pins 1 through 12 are the high current lamp drivers, pin 13 goes to the red terminal block screw, any DC voltage from 1 to 50 volts.

This is my Random Lighting Arduino Sketch.


#define numleds  12                                                      
byte ledpins [ ] =  { 0,3,4,5,6,7,8,9,10,11,12,13 } ;
void setup( )  {                  
    for ( int  i=1; i <= numleds;  i++ )  {     
    pinMode ( ledpins [ i ], OUTPUT) ;
    digitalWrite ( ledpins [ i ] , HIGH) ;
   }
   pinMode (2,INPUT);      // Pin 2 will be the control pin for this lighting group
   digitalWrite (2,HIGH);    //This turns the Pull up ON
}
void loop ( )  {  
                digitalWrite ( ledpins [ random ( 0, numleds+1 ) ], lightsw ( ) ) ;
                delay ( 4000 ) ;   //4000 is 4 seconds               
}
boolean lightsw ( )  {
 if (digitalRead(2)  == LOW) return LOW;  //If the group control pin is LOW ALL lights
                                                             // will eventually turn OFF
 if  ( random (0,100) > 60 ) return LOW ;
   else return HIGH ;
}






You can do a copy and paste to your Arduino UNO and you're in business.

By changing the number in red you can change the delay portion of the sketch.  I like my on off duration long.  It will run for about 8 hours before the process stops leaving all lights on.  Pushing the red reset button on the UNO does a reboot.

All in all this project is one of my very best, I have two random light controllers in operation and two more in the works.