NP Lester WA T-Trak Z Module Set Project

rray Feb 11, 2020

  1. bostonjim

    bostonjim TrainBoard Member

    846
    1,105
    27
    That is going to be one beautiful module when you finish it. I hope you can crack the code and get the Arduino operable. The margaritas look berry, berry good. Yesterdays lunch, not today's breakfast, I hope. You'll never get anything done. Be well. Jim
     
  2. SJ Z-man

    SJ Z-man TrainBoard Member

    3,015
    1,025
    62
    Can you set ‘I/O’ bits that have individual Shields (I cannot wrap my head about who I would have thought of the Shield acronym). Each Shield or 3rd party, like Ngineering or Sympatico’s lighting modules?
    As for Sound, you’ll need ‘polyphonic’ sound to play simultaneous sounds.
    But changing the I/O bits based on timers could possibly force resets on bits not intentionally turned off (depending how the I/O chip latch works or could be uS fast and the 3rd party parts too slow to detect)
     
  3. rray

    rray Staff Member

    8,305
    9,416
    133
    For sound, I have several seconds worth of arc welding, that can be stopped and restarted at any time. I just need to have soundfile 0001.mp3 playing when the white and blue LED's are flickering, and the very second that the red afterglow LED comes on, starts a 3-5 second delay then soundfiles 0002 through 0004.mp3 play. When the random welding starts back up, sound should immediately jump to .0001.mp3 again.

    The sound files are all one type of sound, 0001 is arc welding, 0002 is slag chipping, 0003 is wire brushing, and 0004 is grinding. The MP3 files need to be in the root folder of the micro SD card and named in this naming convention of 0000.mp3-9999.mp3 so they can be called up and played by an integer from the arduino.

    Once I get this coding down, I'll add a random yellow glow for the grinder sound.

    The arc welding will be triggered by a proximity sensor, that someone got their head over the roundhouse to look at it.

    When nobody is around, I will have the player play track 0005.mp3 which will be a long recording loop of oldtime radio from the 1930's. At the same time as that's happening, I can have a couple guys warming their hands in front of a 55 gallon drum with a fire glow inside.

    These are the kinds of things you can have a $3 Arduino Mini, a $1.5 DFplayer MP3 module, a Micro SD card, a few LED's, resistors, and a small speaker do for you. All in for under $10 you can have a reasonable well animated scene, and not break the bank.
     
    Kez likes this.
  4. Commodore

    Commodore TrainBoard Member

    138
    115
    12
    Robert. You are so creative!

    Don't think there can be any way that AI could take over any process that you've dreamt-up.
     
  5. SJ Z-man

    SJ Z-man TrainBoard Member

    3,015
    1,025
    62
    I read it as you are programming a Delay timer or Loop (with Delay).
    You should have a Clock that could be polled IF (condition):THEN Out. This way, Arduino is just a Time/State controller, practically sleeping.
    Or, there may be a Timer (say 10-25 Seconds) that Resets. Use an IF:THEN with that? I know there are Sound Shields that play themselves with just and En/Disable.

    Focus on the Sound board specs, make sure can play asynchronous MP3's

    Start a new thread on this :)
     
  6. rray

    rray Staff Member

    8,305
    9,416
    133
    Heads up, this post is train related and on topic, "at the bottom of this post", but in order to get there I needed to share how I did it.

    OK, I'm back, And I needed a vacation so bad. Being couped up on Coronavirus lockdown had me a bit twitchy, I could not think straight, and all I wanted was to get outside, go camping, maybe some fishing, campfire, beer, you know, have some fun! So I did.

    Instead of heading up towards Idaho City, we decided to hit an old favorite Elk Camp near Council ID. Guaranteed no crowds, or infected people, with a population under 900 throughout the hills up there:
    1.jpg

    It's mostly cowboys and 4 wheel drives up here, we head past town up in the hills:
    2.jpg

    Once we get through the clouds we are in the Payette National Forest:
    3.jpg

    We head up to the snow line, nobody up there for sure:
    4.jpg

    We arrive at the famous Elk Camp site that family members have been using the past few decades, called "Aloha". Here my Granddaughter Edith is riding a horse for the first time, a week before her 9th birthday, and she is doing good!:
    5.jpg

    Here I am with Edith and my son in law Arlin:
    6.jpg

    After some liquid courage, Arlin gave horse riding a try for the first time in his life, and my daughter Brandie is laughing at him:
    7.jpg

    And later that night Brandie BBQ up some burgers on the Cowboy Wok, the most amazing burgers ever, and everyone else went inside their tents or campers because it was raining and cold. I sat warm and dry, drinking hot coffee and enjoying a burger, under a rain shelter by the fire and enjoyed my evening, as we were heading out the next day:
    8.jpg

    SO, as I promised, back on topic, I got home last night, and much to my surprise, Ben ("thewag" Trainboard Z Scale Member Name), who had messaged me that he had some luck with Arduino code, had sorted through the mess I was trying to do, and managed to get me back on track with his second update to the Arduino code I needed.

    Well, he had sight unseen, fixed the code enough for me to cobble together enough features for my Lester Roundhouse Animation. Attached is the code for those who want to examine it.

    Here is a youtube video of how it operates:
     

    Attached Files:

  7. HemiAdda2d

    HemiAdda2d Staff Member TrainBoard Supporter

    22,049
    27,639
    253
    Looks like you had fun!
     
  8. rray

    rray Staff Member

    8,305
    9,416
    133
    I did! I love to be with family in the outdoors. You know how long winters are in Idaho, so to have this Coronavirus lockdown come just when spring hits made it seem all the longer. We usually have a March rally to Mann's Creek Reservoir to take out the pontoon, and ride sleds up the hills, but we missed that trip due to the "Pandemic Panic" that the TV news spun on us.

    Now I am searching for superbright SMD LED's to use for my welder and grinder.
     
    Kurt Moose and HemiAdda2d like this.
  9. HemiAdda2d

    HemiAdda2d Staff Member TrainBoard Supporter

    22,049
    27,639
    253
    I know all too well about long winters and the onset of this lockdown, being in North Dakota and all...
     
    rray likes this.
  10. shamoo737

    shamoo737 Staff Member TrainBoard Supporter

    4,597
    553
    72
    I love to ride mountain bike trails, and the parks are opening tomorrow. Yoohooo!
     
    rray likes this.
  11. bremner

    bremner Staff Member

    6,291
    6,381
    106
    Just remember, when hospital staff are afraid, you should be too.
     
    Kurt Moose, rray and CNE1899 like this.
  12. shamoo737

    shamoo737 Staff Member TrainBoard Supporter

    4,597
    553
    72
    It’s Florida, and it’s flat. I am not a trill seeker, and only ride the trails I can handle.
     
    rray likes this.
  13. bremner

    bremner Staff Member

    6,291
    6,381
    106
    I broke T3-6 , 4 ribs and 3 fingers (one fall) on a Mountain Bike, be smart and safe
     
  14. shamoo737

    shamoo737 Staff Member TrainBoard Supporter

    4,597
    553
    72
    Got it, thanks.
     
  15. Svein-Martin Holt

    Svein-Martin Holt TrainBoard Member

    346
    376
    26
    Great trip in the wilderness, and great animation on the hobbybench.
    I saw you uploaded the code. Thats fine, I will check it out.
    But, could you also load up the mp3 files of the welding, hammering and grinding, please?
    I have a factory or 2 to include this effect. I guess I will change your sketch to use adresseable RGB led's(I dont have single leds available at the moment).
     
    rray likes this.
  16. rray

    rray Staff Member

    8,305
    9,416
    133
    Yikes! I don't mountain bike trails around here, way too steep. I do the paved greenbelt along the river where it's smooth, wide, and safe.
     
  17. rray

    rray Staff Member

    8,305
    9,416
    133
    I am not sure I can upload the sound files, because of copywrite infringement. I recorded them from YouTube videos using Audacity.

    I got the welding clip, slag chipping clip, and wire brushing clip starting at around the 7 minute mark from this video for files 0001-0003.mp3:


    And I got the grinding clip starting near 5min 30sec from this video for files 0004.mp3:


    And last, I got the old time radio music from this video for file 0005.mp3:


    Alternately, you can use any sound files you want, and the code is easy to modify. The welding and grinding sound will trigger a replay of those sound files if the random timer continues past the MP3 file length, so don't record any silence at the beginning or end of those tracks.
     
  18. Svein-Martin Holt

    Svein-Martin Holt TrainBoard Member

    346
    376
    26
    Great idea to grab it from youtube. Thank you.
    I have changed your sketch to use adresseable LED(-strips) using the FastLED library. You can see it in the video. The brightness should be set lower, but just to see the effect. I did not setup the MP3-player, so I shortened the video.
    The leds I have used: https://www.banggood.com/100Pcs-DC-...t-in-IC-WS2812-p-979463.html?cur_warehouse=CN
    Another source could be Neopixel: https://www.adafruit.com/category/168


     

    Attached Files:

    tjdreams, Joe Lovett and rray like this.
  19. rray

    rray Staff Member

    8,305
    9,416
    133
    Nice job with those RGB LED's Svein-Martin. The effect looks so good, just like real welding going on in your factory!
     
    Svein-Martin Holt likes this.
  20. JoeS

    JoeS TrainBoard Member

    3,209
    1,240
    64
    Robert your work is just fantastic literally the right color light with sounds. Wow...

    But I think I like your getaways as much as your work!
     
    rray likes this.

Share This Page