Recommendations - Model Train Controller


Closed Thread
Results 1 to 40 of 102

Hybrid View

  1. #1
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Typically these loco's draw around 300mA - 600mA ( a quick test showed mine drawing 380mA with no coaches at full throttle )

    The schematic as it stands is attchaed
    Attached Images Attached Images  

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Saw the video.

    I've seen snails move faster than that, when it's raining.

    Cool.

    Hope someone can figure out the Growl.
    DT

  3. #3
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Saw the video.

    I've seen snails move faster than that, when it's raining.

    Cool.

    Hope someone can figure out the Growl.
    LOL - thanks !

    I'm not too bothered about the noise the PWM makes, but as this will be used on a club lauout, other members might complain...

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink Simplify, simplify !!!

    Quote Originally Posted by malc-c View Post
    Typically these loco's draw around 300mA - 600mA ( a quick test showed mine drawing 380mA with no coaches at full throttle )

    The schematic as it stands is attchaed
    Hi, Malc,

    R3 is no use at all here ... short it !!!

    ... but a 1N 540x cathode at the + 12v, anode on the V+ output could be rather useful ...

    Alain

    PS ... for Growling, may be you could try to " unsharpen" the PWM to somewhat with increased rise and fall time ... by inserting a filtering coil in series in the output line ( a LITTLE smoothing capacitor too ??? )
    Last edited by Acetronics2; - 16th February 2007 at 09:56.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Don't have that Diode suggested, have plenty of 1N4148's or 1N4001 to hand, would they do ?

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    The 4001 will be a bit too weak ... for serious use.

    try to find a 3A rated model ... or use a PNP Darlington with diode Built in !!! like BD678/680

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  7. #7
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default More problems :(

    OK I thought, lets move this on and use a PIC capable of providing all 4 seperate PWM outputs. So after consultation via a few PMs with Steve and Darrel I've opted for a 16F676.

    I've used a 20Mhz xtal, with 22pf caps between pins 2 and 3, wiper from 10K pot goes to pin 13 and PWM output on pin 8.

    I've modified the code used for the 12F675, and compiled - no errors or warning, and loaded it into the PIC.
    Code:
    @ __CONFIG _HS_OSC & _WDT_ON & _PWRTE_ON & _MCLRE_OFF 
    
    ANSEL=%00110001
    CMCON=7
    TRISA=%11111111        'set PORTA as all input 
    TRISC=%00000001        'set PORTC as all output apart from RC0
    
    
    DEFINE OSC 20
    CLEAR
    
    DEFINE ADC_BITS 8	' Set number of bits in result
    DEFINE ADC_CLOCK 3	' Set clock source (rc = 3)
    DEFINE ADC_SAMPLEUS 50	' Set sampling time in microseconds
    
    INCLUDE "DT_INTS-14.bas"            ; Base Interrupt System
    INCLUDE "SPWM_INT.bas"              ; Software PWM module
    
    DEFINE SPWM_FREQ  100                ; SPWM Frequency
    DEFINE SPWM_RES   255               ; SPWM Resolution
    
    DutyVars   VAR BYTE[3]              ; DutyCycle Variables
      DutyVar1 VAR DutyVars[0]          ; group them in an array for easy access
      DutyVar2 VAR DutyVars[1]          ; with FOR loops etc.
      DutyVar3 VAR DutyVars[2]
      DutyVar4 VAR DutyVars[3]
    
    ASM
    SPWM_LIST  macro                    ; Define Pin's to use for SPWM
        SPWM_PIN  PORTC, 2, _DutyVar1   ; and the associated DutyCycle variables
        SPWM_PIN  PORTC, 3, _DutyVar2   ; Notice the underscore before variables
        SPWM_PIN  PORTC, 4, _DutyVar3
        SPWM_PIN  PORTC, 5, _DutyVar4
      endm
      SPWM_INIT  SPWM_LIST              ; Initialize the Pins
    ENDASM
    
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler   TMR1_INT,  SPWMhandler,  ASM,  yes
        endm
        INT_CREATE                      ; Creates the interrupt processor
    ENDASM
    
    @ INT_ENABLE  TMR1_INT              ; enable Timer 1 interrupts
    
    ;_____________________________________________________________________________
    
    Main:                               
     ADCIN 0, DUTYVAR1
     ADCIN 1, DUTYVAR2
     ADCIN 2, DUTYVAR3
     ADCIN 3, DUTYVAR4
     GOTO Main
    I then tested the code / hardware and I don't get the same performance as I did with the 12F. There is no responce from the loco until the pot is at mid point, at this stage the armature sings with a high pitch noise. Advancing the pot increases the speed, but I don't get anywhere like the slow crawl speeds I got with the 12F. I can also assume that the armature is warming as it smelt a little (carbon smell) after a short run.

    I think its probably down to my poor understanding of Ansel etc.. so an constructive comments would be welcome.

    Oh and I've not changed the driver stage yet as Alain suggested.

    EDIT:: EDIT::
    Changed the Xtal for a 4Mhz and the frequency of the noise has dropped.. but its still there and not the low growl that was produced by the 12F.. so it it a timing issue ??
    Last edited by malc-c; - 16th February 2007 at 13:06.

  8. #8
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    I've also tried the other channels, and get the same performance and noise from each one. (I've also reduced the frequency down to 100 to make sure I get 4 channels) - and I'm using the int osc to compare it against the 12F

    I've noticed that the growling from the armature has a second resonating sound that I can only describe as the sound you get with a multi-engine prop plane when the engine is slightly out of sync. I can only assume this is due to the PIC having to work hard outputing to 4 channels rather than the 1 on the 12F.

    If all else fails, I'll use a 12F675's to drive each of the 4 controllers... overkill I know, but the performance I was getting with the 12F was just what I was after.

    I'm hoping the issue with the 16F676 is due to a conflict of configuring the ports to the correct analogue / a2d / digital combination, and with your help, will work as good as the 12F !

  9. #9
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    There's something bad in the schematic indeed. R3 have it's use... but not at the good place. Should be in serie with the transistor base. If you short it, you'll burn the transistor...

    I'm curious.. i'll try to find some 12V motor (1A or more) 'round here today, and test the whole thing. Sure it's possible.

    I'll dig in the transistor datasheet... sure there's something bad in their HFe mathe here....

    Anyways, i'll be back!
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Microstepper controller
    By aratti in forum Schematics
    Replies: 14
    Last Post: - 3rd January 2015, 16:52
  2. problem with the GSM controller
    By Dariolo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th May 2009, 20:33
  3. Replies: 2
    Last Post: - 14th July 2008, 22:11
  4. Model Train controller - revisited
    By malc-c in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 8th May 2007, 09:40
  5. Dedicated LCD Controller question
    By chuckles in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th February 2006, 14:44

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts