Successful but stumbling

HannahH Mar 2, 2017

  1. HannahH

    HannahH TrainBoard Member

    15
    11
    2
    Ok gentlemen. Please don't be brutal if I'm in the wrong thread.
    As you may know, I have taken over the finishing off late husband's layout for my grandson.
    The trains are controlled with DCC but he wants SEPERATE buttons for the handful of points.
    This means I have, amongst other things, has to get to grips with arduinos to control the point servos. I have done a mock-up of one and there are enough in/outs on the arduino to do the same with the others (see video). However, the eagle eyed may spot a two colour red/green led on the board. Here is my problem..... I think that in order to power the led it will be easier to put 2 micro switches activated by the servo position rather than use 2 more outputs to each led. A yes or no would be brilliant as it would save me a week of searching and watching you tube videos only to find micro switches would have been easier!
    Yes......I have caught the bug!!!
    Thank you
    Hx
     
  2. RBrodzinsky

    RBrodzinsky Staff Member TrainBoard Supporter

    5,366
    2,061
    84
    Hannah - Yes, it is six-of-one, half-dozen-of-other on whether to use the Arduino output, or use switches. More importantly are how you will power the frogs, and if the number of outputs available.
     
  3. HannahH

    HannahH TrainBoard Member

    15
    11
    2
    As it happens I have just found an arduino mega with "loads of holes" so I think that will solve it. The servos will be powered from an external power supply along with the LEDs and all the points are insulfrog so I don't have to try and get my head around those (I may if I do my own about). I can't believe I have a whole new vocabulary in a week! Driving my friends mad with it already. AND I ALREADY HAVE SOLDER BURNS!
    Hx
     
  4. Atani

    Atani TrainBoard Member

    1,220
    768
    24
    For a bi-color LED you have a lot of options. I am working on a similar setup for an accessory decoder, using an Arduino Pro Mini. For my setup I have a common cathode 3 leg bi-color LED. I am planning on using ONE pin per LED to light it as red/green based on high/low signal by using an NPN and PNP wired to the anodes and to the single Arduino pin. Another approach is to use a 74HCT04 NOT gate and have it handle the inversion.
     
  5. HannahH

    HannahH TrainBoard Member

    15
    11
    2
    Right, dumb blonde here remember! :)
    Npn pnp I think are transistors and I know he used one or the other on a water level sensor he made for the boat to light an led when the water tank was full to save lifting the floor and looking. 74HCT04 NOT gate.........Hmmmmmm, gates are what I open to let the horse's in from the paddock so will not be going down that route yet! :) I think I could probably get to grips with using the pnp npn's and I think I can imagine the code being a slight variation of the code that moves the servo by setting hi/low... I may have to ask a code question if I get stuck but I should probably do that on the arduino forum.
    Oh crikey...... You have high expectations of us women!!!!!
    Hx
    .
     
  6. RBrodzinsky

    RBrodzinsky Staff Member TrainBoard Supporter

    5,366
    2,061
    84
    You are doing better than a lot of experienced folks!
     
  7. Atani

    Atani TrainBoard Member

    1,220
    768
    24
    Yes, PNP and NPN are both types of transistors. You would wire the BASE from each to the pin from the arduino. For the NPN wire the EMITER to the LED and COLLECTOR to +VDC. For the PNP you would wire the EMITER to +VDC and COLLECTOR to the LED. Be sure to use a resistor to bring the voltage down to a suitable level for the LED, if you are using 5VDC you can likely use a 150ohm resistor.

    Many would likely not mind helping here (it is related to trains, even if indirectly). There are also a lot of tutorials online for similar setups, you can look at this one: https://learn.sparkfun.com/tutorials/transistors/applications-i-switches as a sample of how the PNP/NPN can be used.
     
  8. HannahH

    HannahH TrainBoard Member

    15
    11
    2
    Thank you everybody for both the kind words and helpful suggestions. I'm wishing I had got into this earlier but I didn't have the need (and the was a man about doing things). So much more fun than learning to knit and I'm sure some of the things I'm learning will be more useful. I'm going to tidy things up and will definitely get some pictures posted.
    Thanks again
    Hx
    PS I replaced a wonky piece of flexitrac today as well :)
     
  9. HannahH

    HannahH TrainBoard Member

    15
    11
    2
    01:04 UK time and just getting my head around npn and PNP transistors and getting the lines of code right. I think it's sorted in my head, tomorrow, time to breadboard and see if what I think is right!
    Hx
     
    Atani likes this.
  10. Atani

    Atani TrainBoard Member

    1,220
    768
    24
    Yes, think of the NPN or PNP as a light switch of sorts. The toggle between on / off based on a HIGH / LOW signal sent from the Arduino. NPN reacts to HIGH and PNP reacts to LOW. I am also going to be breadboarding my circuit before soldering the components together for my decoder and wiring it into the system.

    Please share your results and photos if you like :)
     
  11. HannahH

    HannahH TrainBoard Member

    15
    11
    2
    Yes, I seem to be getting somewhere and will share a video of what looks to be a "heath-robinson" affair as soon as it's done. Although it looks a mess on a piece of board I'm sure it will look tidier hidden behind a panel! :)
    Hx
     
  12. MarkInLA

    MarkInLA Permanently dispatched

    1,976
    76
    29
    Hannah, you are not stumbling alone. You are going through the same learning curve we all go through in this most complex of hobbies. We have to wear many many different hats to build and run a model railroad; near the same as separate employees in the 1:1 scale. It certainly ain't stamp collecting. We do something on the MRR and hope it comes out right. It don't and we go back to the drawing board, replan and try it again. This means from benchwork to installing a wye, loop track, or TT (turntable) and knowing how to wire them; weathering an F7 (and what is an F7 as opposed to an N&W y6b), to soldering technique, to making trees, structures, fixing/replacing couplers, which engine to buy, scenery, RR nomenclature, on and on and on...............
    I, and I'm sure the rest of us think it's great that you are continuing where your loved one left off. And whatever you come up with and decide on is no different than what
    the 1:1 scalers had/have to do. They too used trial and error until they found the best route to take to solve the problem, same as you and I.
    All the best, Mark
     
    Last edited: Mar 11, 2017
    Atani likes this.
  13. papahnash

    papahnash TrainBoard Member

    323
    35
    13
    Hannah, there is an excellent article in this months Model Railroad Hobbyist online magazine. Geoff Bunza covers many applications for the Arduino along with circuitry and code. MRH is free online, just register.
    The article can be found here:
    http://mrhpub.com/2017-03-mar/online/html5/
    You are defiantly on the right track but this may give you more insight to the Arduino.

    Harold
     
  14. HannahH

    HannahH TrainBoard Member

    15
    11
    2
    Thanks again everybody. It's been horses horses horses, geese ducks and sheep for the last 10 days and YouTube tutorials for my bedtime entertainment!
    Hopefully now i can get back to some more assembly.
    Will definitely be reading that.
    Thank you
    Hx
     
  15. MartyAT&SF

    MartyAT&SF TrainBoard Member

    22
    3
    2
    Hannah, you are not a dumb blonde. Forget the stereotype. you are wading into something that you have not done before and doing a better job of it than many on this list. Keep up the good work and let us know how you progress and ask any questions you have. Remember that the only dumb question is the one that isn't asked.
     
  16. WRustyLane

    WRustyLane TrainBoard Member

    16
    6
    2
    I was wondering if there is a rule about using larger text in messages. My eyes are not what they used to be and using reading glasses to view my monitor gives me a headache. I squint most of the time to read all these posts. If such a rule exists, then please educate me. I have to use text size 5 to even see what I´m typing onscreen.
    Hannah, please join the club. I have been doodling with electronics all my life and learning about ¨how to¨ do stuff is quite an experience. I found, in the post above, that NPN and PNP transistors to be quite interesting. My dad taught me about transistors in that NPN means ¨not pointing in¨, the arrow in the schematic of the NPN transistor. I had to learn about the emiter, base and collector and you don´t know how many LED´s I went through before I learned about current limiting resistors. That was a real Duh moment for me. :)
    Oh yeah, and I do my typing on a blue tooth keyboard that sometimes sticks and I get a lot of duplicate llllllllletters like that. Of course I use my Raspberry Pi 3 as my desktop computer. My wife´s Dell laptop crapped out about a month or so ago so I salvaged the screen (15.6 inches) to use on my RPi 3. I had to order a driver board from China (which came in on a slow boat) for $17.99 and I had saved the bezel and hinges to reuse. The old computer screen had a couple of studs where it mounted into the case so I drilled two holes in a 16 inch two by four and used the holes to put in a screw into each end. All the electronics are mounted to the board and are exposed in back of the monitor. I did wrap the high voltage driver in a piece of plastic and secured it to the back of the board. My wife said it looks like a mad scientist got a hold of my little computer. :) The control board for the screen is mounted upside down onto the front of the board, but it all works quite spiffy. I can even close the screen down onto my little keyboard to keep out the dust. I learned to do this by watching a video on You Tube. That´s usually my entertainment for an evening also. So, as they say in the land across the pond, crack on, mate! :)
     
  17. Greg Elmassian

    Greg Elmassian TrainBoard Member

    322
    51
    14
    most browsers let you use control-plus to zoom the characters in size... a bonus is that all text will be larger, not just yours.

    Greg
     

Share This Page