Recommendations - Model Train Controller
Hi guys and gals,
Just want to pick your brains over a project I'm looking at starting. I want to build a controller for a club layout and thought that I could use a PIC rather than traditional descrete components.
The controler will initially have direct control (ie no simulated coasting and breaking), so I thought of two possible ways the PIC could be used, and wondered if you had any comments.
The first is to use A/D to read the voltage on one pin, and then output a DC voltage to a FET / power transistor to drive the motor from a 12v supply.
The second uses the same A/D to read the voltage on a pin, but the output is PWM (or more exact PPM), which is then used to drive the FET or power transistor in the same way.
The reason I wanted to use a PIC was to add things later such as auto station stops (triggere by a sensor on the track) and simulated inetia, and programming the pick to to that might be better than loads of high value capacitors and the like
1 Attachment(s)
Good Engineering Exercise
Hi, Malc
Here you have THE Thing you look for ...
just to translate from "Old" logical circuits to PIC ...
All functions to program are clearly shown.
Alain
The Bass beat Filter II ???
Huh !!!
The manual clearly tells Pwm outputs garbage ... and needs a RC or more sophisticated filter.
Now just keep in mind PWM is only good to get some "analogic" output from the PIC.
Another STAMP " Not so good a function " survivor.
Now, if you want to keep the PWM function ... just compare a sawtooth to this "analogic" voltage ( once filtered ) and you'll get a neat "real PWM" at the output of the comparators.
a quad LM 339 sould do that job very honestly ...
But we remember DARREL's slow PWM is the shiny solution to what you want to do.
Ah, last point ... and not least ! you'll discover the motors have a low PWM ratio thresold not to make some noise and unwanted heating while not turning. one more thing to add !!!
Alain
The long and winding road ...
YESS
Big Idea !!! just comment the faulty line ... as this location only exist in elephant memory Pics !!!
also ... as stated in one of Darrel's further replies !!!
Alain
find it ... in the beginning of " DT int 14 .bas "
' --- IF any of these three lines cause an error ?? ----------------------------
' Comment them out to fix the problem ----
' -- It depends on which Chip you are using, as to which variables are needed --
wsave1 var byte $A0 SYSTEM ' location for W if in bank1
wsave2 var byte $120 SYSTEM ' location for W if in bank2
wsave3 var byte $1A0 SYSTEM ' location for W if in bank3
' ------------------------------------------------------------------------------
YOU DO NOT HAVE BANK3 in your Pic ... isn't it ???