LightKit: Pic Spoon Feed Model Railroad Lighting with Pic 12F683 16F690 and Pickit2 Part 3-4

Поділитися
Вставка

КОМЕНТАРІ • 20

  • @TimothyBratcher
    @TimothyBratcher 9 років тому +2

    Thought I might toss this out: I took something you said in the video (about LEDs coming on a bit slower to more accurately imitate an incandescent light), and I ran with it. I looked at microchip's website and found the 12F1501, an 8-pin DIP that has four outputs that can be set to be PWM (pulse width modulated) outputs. After a considerable amount of tinkering (learning about PICs and C), I have managed to come up with the structure of a program that lets me turn LEDs on / off with a fade in and fade out effect. I've used an "on" variable and an "off" variable which control the speed of the fade in / out. Set at small numbers, it sure does imitate the look of an incandescent bulb coming on or going off.
    So far, I've used that program structure to create a two light flashing circuit (imitating crossing signals), a welder (using two LEDs, with "seemingly" random periods for when the "welding" occurs and how long that welding lasts in each instance), and even a "candle" (where the brightness very slowly drifts up and down and occasionally flickers). None of these are earth-shattering, but with the softer ons and offs, they look a lot more realistic than the instantaneous on and off of a ordinary LED.
    But the main application is controlling four "room lights" for a structure (e.g., a porchlight, a bedroom, a kitchen, and a living room). I've discovered that there is no such thing as "random" when it comes to PICs, but I have developed a very short subroutine that generates a "seemingly random" set of numbers. I use that (with some delays of my own design) to cause these "room" lights to turn on and off at "seemingly" random intervals (measured in minutes). The effect is pretty nice, and changing one number in the program for each structure will yield sufficient randomness across different structures.
    Anyway, that's a long winded way of asking if you've ever used the 12F1501 or PWM outputs . . . the 12F1501 has far less memory than the 12F683, but I've not run up against the limit so far. Would love to share the files with anyone . . . not really sure how to do that!

    • @ModelerManMike
      @ModelerManMike  9 років тому

      Hey Tim, it looks like you have completely gone through everything I have done in the video's I have on my channel. I have removed some of them as I have gone to a new type of format using a master controller. However, yes, much of this I have done so far! BUT would be very interested in seeing your programs that you have created and see if you have any routines I could use. You can find all of my C Programs for the 683 and 690 on my website located here www.digoxy.com/modelermanmike/ If you like, you could send your programs to my email address modelermanmike01@gmail.com
      Look forward to collaborating on some of this if you are interested.

  • @ModelerManMike
    @ModelerManMike  11 років тому

    I have some vid's put together that I still need to upload, I will see if I can get them up in the next couple of weeks ok!

  • @ModelerManMike
    @ModelerManMike  11 років тому

    Hey, CK, just checkin in, did you put this together yet? Would be curious to know how it went.

  • @ModelerManMike
    @ModelerManMike  11 років тому

    Please feel free to ask anything here, I will do my best to reply :)

  • @ckyready
    @ckyready 11 років тому

    watching your videos made me want to incorporate these type of circuits into my layout......... my wife says to tell you "thanks Tex" for finding a way for my husband to spend more money on his trains........... i've ordered all the stuff you recommend so that I can follow your videos.............. the programming scares me a bit but I know if you make a programming video I can do it.............. thanks in advance for the ideas

  • @TimothyBratcher
    @TimothyBratcher 9 років тому +1

    Mike,
    Just wanted to take a moment to say thank you. This video (and all of your others, too) are just awesome. I've always been interested in electronics and HO model trains, and, over Christmas, I stumbled across this video and it lit a fire in me. I have since purchased a PICkit, breadboard, etc., and I'm truly enjoying my time spent learning about PICs. You're a great guy, and I look forward to more videos. Thank you for the inspiration!
    All my best,
    Tim

    • @ModelerManMike
      @ModelerManMike  9 років тому

      Hello Tim, Thanks so much for the compliments and the comments posted here. Glad to hear these video's inspire. Let me know how your adventures go with the PIC, I like these, they are cheap! so many are using Arduino now but I hang with the pic's myself. My interest in model railroading over all is structures and lighting, so I would be interested in hearing about your set ups you come up with. Were you able to download the programs from my website?

    • @TimothyBratcher
      @TimothyBratcher 9 років тому

      ModelerManMike Well, at the risk of boring you to tears . . . I live in Atlanta these days, and when I went home to Louisville for Christmas, my mom and dad had all of my boxes full of HO locos and rolling stock out, wondering if I actually wanted to keep it all! So, after 48 years, my ma and pa were finally "kicking me out of the house." Seeing those beautiful pieces (I never had a layout, so I just bought good pieces here and there) made me look at youtube, and that's how I stumbled across your vids. Like you, I really enjoy the scenery, building, lighting, as much as I do the trains, and I am looking forward to building a layout.
      As for the PICs, I've just started--I got the 20-pin demo board to flash some LEDs and the like, but that's a big step, at least for me. I have a knack for programming (www.timbratcher.com and follow the links to my family history pages--I programmed the online database in asp.net, coupled with a self-made VBA / Access database on my desktop). My dad and I also rebuilt an L&N steam locomotive (search Kentucky Railway Museum locomotive 152--my dad was the master mechanic of steam as a volunteer since 1971 until just a couple of years ago). That loco was as much a part of my family growing up as my brothers were!
      Back to PICs--I love how small the circuits can be. Arduino is cool, but mastering the programming of the chip and having it in a standalone and small circuit (for hiding in an HO building or a vehicle or the like) is what I'm after. I will keep you updated on my progress and, like you have said, when I finally figure it all out, I might do a video of my own "to give back to the community."
      Are you in the service? Stationed overseas? I did 7.5 years in the Army--three and a half on active duty (Ft. Ord) and four in the reserves (Ft. Knox).
      Anyway, you seem like a great guy and I'm glad to know there's folks out there like you, brother!
      Best,
      Tim

    • @ModelerManMike
      @ModelerManMike  9 років тому

      Tim Bratcher Hey Tim, it sounds like you have traveled much of the same road I have in this adventure of model railroading. My father however was never into trains at all. I just had the inspiration since I was a young kid to do a model. The trains for me are more of just the model I guess. I look forward to catching some video's if you decide to put some up! Are you a member of the UA-cam Model Railroad Google+ Community? We share a lot of stuff through there, hangouts, a live show and emag, check this out if you can. plus.google.com/u/0/b/107934973242857840131/communities/104964959974656005095

  • @TimothyBratcher
    @TimothyBratcher 9 років тому

    Do you mind if I ask a question? You have the MCLR switch leading to Pin 4 (GP3 / MCLR), but you also have the input (the orange jumper) connected to Pin 4 (GP3), using Pin 4 (GP3) as the input. You then connect the orange jumper to ground, which pulls the pin low. It seems that that would reset the chip (pulling GP3 low), but I suspect it doesn't because you've got GP3 set as an input. If that's the case, then why do you need the switch? I could have summarized all this by asking, "Why the switch"? :) If it's complicated, feel free to skip the question. Just curious. I'm about to build this circuit, and I'm studying all aspects before burning up a chip or two!

    • @ModelerManMike
      @ModelerManMike  9 років тому

      not complicated at all. To program, send the data to the chip from the pickit, it has to be toggled off.

  • @Digitalsnapp
    @Digitalsnapp 10 років тому

    Hi, I have never done anything with electronics. I have just started my N gauge layout and want to use lights to enhance the mood so I find your videos very interesting. I have followed everything up to where you start placing the Yellow White and Green wires from the Pic? to the connector(4:41) on the video. I can't see how I should know which wire goes to which. Is there a book I should read please?

    • @ModelerManMike
      @ModelerManMike  10 років тому

      Hello Roy, sorry for the delay in getting back to you. are you talking about where the wires connect to the header pin on the bread board? I think you might be talking about this. If so, this is where the pickit 2 will plug into the board and the video shows the colored wires leading to each of the leads on this header pin.

    • @ModelerManMike
      @ModelerManMike  10 років тому

      Ok, so I read this and watch the video to try and understand this question a bit better, and yes, I guess the answer is that the pic lines to this header pin are specific for the Pickit 2, each of these three lines go to the data lines on the pickit 2 so the pic can be programed. Roy, if this still does not answer your question, please let me know, feel free to send a private message if you need to, I can help you get through this part if needed ok!

    • @Digitalsnapp
      @Digitalsnapp 10 років тому

      digoxy Him Thanks for getting back, I understood why all the wires were put in the places they were until you started placing the yellow, white and green wires, I don't understand why they are in the holes you placed them in. Or for the purpose of the example should I just do it like you did. Thanks again.

    • @ModelerManMike
      @ModelerManMike  10 років тому

      Roy Palmer Those three wires are for the programming of the pic from the Pickit2. When the Pickit2 is plugged into this board, these lines connect directly to the pic on the board so it can be programmed.

    • @Digitalsnapp
      @Digitalsnapp 10 років тому

      Thank you, I do appreciate your help.