Different way to do detection....

crusader27529 Mar 10, 2016

  1. Papajohn88

    Papajohn88 TrainBoard Member

    39
    27
    6
    I am new to TrainBoard, and have been reading this tread with a great deal of interest. I am currently building a new layout, we just moved a few months ago so now I get to start all over. I want automated signaling including block occupancy detection and possibly tracking of rolling stock locations using RFID. I have downloaded the files provided in this thread and looked at the code. I would like to find a component list and a source for the PC boards. Are we allowed to use the KICAD files to have boards produced for personal use?

    Thanks,
    John Guenther
    PapaJohn88
     
  2. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    Public domain means you can do anything you wish with the files, as long as you keep the original author as the source for the project software. The rest of the files are for use anyway you deem acceptable.

    As far as a parts list, you'll have to source the parts yourself......I made the PCBs myself in my garage. None or the components are critical, but the IR source must be 940nm, and the detector must be a TSSP4038. The one resistor in the IR LED source path is 4.7K if I remember, and any other LEDs and current limiting resistors are generic with 470 ohm resistors, but those values can be changed to whatever you wish to change LED brightness. The Kicad files are both schematics and board layouts.

    The connectors are standard 0.100" spacing, so anything can be used.....I used screw terminals just for development purposes.

    If you have any questions, please ask.
     
  3. Papajohn88

    Papajohn88 TrainBoard Member

    39
    27
    6
    Thanks for your reply. I have been looking at the KiCad files, nice looking boards. I will be ordering some parts soon and start experimenting with bread boarding a couple of test circuits. When I open the schematic files I get the following error:

    "The following libraries were not found:

    C:\Users\gamcd\mystuff\kicadaddons\Arduino_Shield_Modules_for_KiCad_V3\arduino_shield."

    Where can it get the Arduino shield modules KiCad is looking for?
     
  4. Papajohn88

    Papajohn88 TrainBoard Member

    39
    27
    6
    I found the Arduino_Shield_Modules_for_KiCad_V3 and all is good for now. I still need the tssp4038 which I am sure I will find soon.
    I will most likely make my initial test modules using perf board material and then make the boards needed for my layout. I really like your design, the fact that there are no connections to track power and no modifications to rolling stock such as adding resistor wheel sets makes this the best detection solution I have seen.
     
  5. wvgca

    wvgca TrainBoard Member

    499
    305
    21
    I was following this thread, curiosity mostly...no signalling, remote switches, or other electronics on my layout other than the DCC control system ..
    I was wondering where you were sourcing the tssp4038 .. digikey show no stock, 5 week lead time, and single vendor sourcing, Vishay only , just over a dollar each..
    eBay shows ten packs out of Bulgaria, around a buck each, or US vendor for close to ten dollars each ....
     
  6. Papajohn88

    Papajohn88 TrainBoard Member

    39
    27
    6
    I just bought 10 pcs VISHAY TSSP4038 Infrared Receiver, Light Barrier, 38 kHz, 25m for about $6.29 plus an equal amount of shipping on ebay. They only seemed to have one package of 10, I really need a few more but will keep watching ebay for them. I will be watching ebay and Digikey for them.
     
  7. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    Last time I ordered parts from Digikey, there was plenty of stock...

    The only reason I used that part instead of the more common tsop4038 was that the part would respond to continuous IR signal, where the other part required that the signal had to be encoded and I had run out of i/o pins.

    Since then, I've learned how to use the analog pins as regular i/o, so pin count isn't an issie.

    I could add code to use the tsop4038 but that would also require more hardware. If you have problems, let me know.
     
  8. Papajohn88

    Papajohn88 TrainBoard Member

    39
    27
    6
    Just thinking out loud a little bit. I have areas where I have a double main line, track spacing is on 2 inch centers. I have been thinking about putting the IR led between the tracks with the sensors on each side of the double main line. This would mean one IR led providing the source for two sensors, will that work?
     
  9. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    Not likely, becuase the IR output is quite directional, and not easily aimed. My installations required that the IR leds be covered in opaque black hobby paint, with a slot scratched on the lens to direct the output.

    You could mount 2 IR leds on one PCB pointing in opposite directions......they should be wired in series with a single current limiting resistor for the pair. Obviously, one detector board would supply the drive for both leds. The value for the resistor would have to be something smaller than the 4.7k I used for a single led. The suggested resistor value for full current for a single led was 470 ohms, so you can see how much I reduced the led output with the 4.7k resistor.

    To reiterate why I chose the TSSP4038 detector, the 'normal' detectors are used for communications, and expect pulsed signals(encoded), and if they get a continuous signal, the AGC circuitry treats that as noise, and essentially ignores the signal. So, to use that type of detector, the signal needs to be pulsed at a minumum rate(requiring a transistor to control the output of the led) and some extra hw (a retriggerable one-shot was my choice) to convert the pulses to a continuous signal. While that could be done in code on the detector, with the minimal equipment I had/have for actually implementing an engineering solution made me use the tssp4038 sensor. Also, the extra hw would have increased the size, cost and complexity of the system. With the exception of the IR led and tssp4038 sensor, NO EXTERNAL HW IS REQUIRED FOR THIS SYSTEM. The leds in the design at for convenience only.

    If I had some diagnostic equipment for engineering (analog or digital scope) I probably would have implemented the system with the commonly available parts. The basic architecture is sound, and works well, but I don't have the tools to re-engineer the design at this time. If someone gave me a scope, I'd do it in a heartbeat.....
     
  10. Papajohn88

    Papajohn88 TrainBoard Member

    39
    27
    6
    A couple of days ago I purchased 10 USB CH340G Nano V3.0 16M 5V ATmega328P Micro-Controller Board For Arduino from a supplier in Chino, California. They were about $3.00 each with free shipping. Will your current board layouts plug into these or will I need to make changes to use them with the Nano V3.0 Arduino boards? Sorry for bothering you once again. I have parts coming and will be looking at mounting two IR LED's between the two main lines as discussed above. I will have enough parts soon to begin assembly and testing, most likely on perf board to start. As soon as I receive the parts, check the pin locations on the Nano boards compared to the current board layouts I will try to order some boards I really like the design using IR for detection. The stand alone system seems to be a better choice than using current detection with electrically isolated blocks.
     
  11. Papajohn88

    Papajohn88 TrainBoard Member

    39
    27
    6
    Have you by any chance done a video showing the use of turnouts and the North direction?
     
  12. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    The Nano and the PRO Micro Arduino have different pinouts.....sorry about that. All my new designs will use the Nano because the pinouts on the PRO micro vary to a degree from version to version, specifically with the analog capable pins. Otherwise, it should work the same.
     
  13. Papajohn88

    Papajohn88 TrainBoard Member

    39
    27
    6
    So currently you are using Pro Micro Arduino, and future designs will be for the Nano V3.0 or later. When do you think you might have new designs for the Nano? I will just bread board the detector and counter circuits for testing right now. If there is anything I can do to help with this project I have plenty of time and would be more than happy to help in any way I can.
     
  14. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    I don't have any immediate plans to re-do this board currently......I do have a plan to combine the counter and detector function on one Arduino Nano, but that's not an current project......I'm working on a speedometer car using an Arduino Nano currently.....hopefully, that will be a for-sale item to finance my local train club expansion. The target price (retail) of the car is $79(maybe less), but I'm only about 75% done with the prototype stage. Packaging will come later, along with details about if it will be sold as a complete unit or as a kit.....
     
  15. Papajohn88

    Papajohn88 TrainBoard Member

    39
    27
    6
    Well I received my Pro Mini 328p boards today, strangely enough these were advertised as USB CH340G Nano V3.0 16M 5V ATmega328P Micro-Controller Board For Arduino by the seller, however when I opened up the package I got these instead
    20161122_173317.jpg 20161122_173343.jpg

    I will be checking the pins in hopes of being able to use them with the counter and detector boards.
     
  16. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    They should be OK. The micro is the same as on the NANO.....but they'll need a separate programmer PCB since there'so USB interface built in.....I assume you got headders to solder to the boards, and one should be a right-angle connector for the external programmer.
     
  17. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    The counter PCB has inputs from 3 directions, E & W and what I call North.....that's the turnout. The counter logic doesn't care where a detection comes from, so if the count is non zero, the block is occupied.

    On occupied block shows all RED signals, regardless if a turnout is involved, but when unoccupied, if the turnout is diverging, it forces a RED for the main direction, and obviously if the turnout is set to main, the diverging signal is forced red......look at the code.
     
  18. Papajohn88

    Papajohn88 TrainBoard Member

    39
    27
    6
    I just ordered a programmer for them, I will check the pinouts and if they are compatible with your board designs I plan on ordering some bare boards from one of the board makers. I really like your design compared to the use of current sense transformers and resistor wheel sets. I also like the way the system knows how many things make up a train and thus are in any particular block. The concept of it came into the block so it must leave the block and be counted or the block is not empty.

    Do you have any suggestions for potentially interfacing your system with the DCC++ system? I am thinking about using the DCC++ system instead of investing much more money into my Digitrax system.
     
  19. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    The detection signal is a logic level signal, so anything that is electrically compatible should work fine.

    All the PRO Micro boards have the same pinout except for physically where the extra analog ports are, usually A4-A7. The older boards had them in strange places and not aligned on 100" spacing. The newer boards have them at the opposite end of the board from the serial interface connector. Since I don't use the analog ports on the current design, these boards should work fine. The redesign with both functions on one board will use the analog pins as standard I/O pins.

    Also, the NANO and PRO Micro should be able to run the DCC++ code, instead of needing an UNO.....you just need to connect the appropriate pins to the MD boards that you plan to use. The only reason the UNO or MEGA is specified if so the original MD shield will just plug into it.
     
  20. Papajohn88

    Papajohn88 TrainBoard Member

    39
    27
    6
    Thanks, in that case I think I can use the signal going to the signals to stop an approaching train when the block is still in use by another train. I will have to think about the best way to make that happen.
     

Share This Page