NeO6874 I took a look at that locobuffer / locoio ... at least he supplied the compiled software. Although, the circuits don't look that difficult, I think us less-PIC-savvy types can maybe do it with an arduino (or at least one of the atmel chips.) hmm, new project :)
I took a look at that locobuffer / locoio ... at least he supplied the compiled software.
Although, the circuits don't look that difficult, I think us less-PIC-savvy types can maybe do it with an arduino (or at least one of the atmel chips.) hmm, new project :)
That's the thing, you don't need to know anything about PIC programming to use LocoIO boards. Hans' early LocobufferII boards, which is the one I built (and put together another for another forum member way back when) were able toi program the PIC without any special programmer hardware - just connect the serial port and use a simple utility to dump his firmware on the micro. You could use the Locobuffer to proogram the PIC foor a Locobuffer OR a LocoIO. Then there is a pretty comprehensive setup program for the LocoIO which allows you to set the use of each port - input, output, flash, etc).
There IS an Arduino Loconet library - this is the most difficult part of the whole thing, translating the status of your IO pins to appropriate Loconet messages. Originally I was going to go this route and not worry about the internal details of Loconet, just that it worked and I could set outputs and read inputs via JMRI and the Locobuffer. Along the way I rediscovered CMRI and now I'm going that way for a communications protocol instead of Loconet. CMRI is very simple and straightforward when it comes to converting the states of IO pins on a micro into the proper CMRI message. Doesn't matter what micro you use, really, there are few if any code tricks needed to turn IO bits into messages and messages into IO bit settings.
As cheap as things are now, it almost doesn't make sense to even bother with multiplexing schemes to drive signals. With port extenders giving you 16 extra pins for about $2 (plus power supply bypass caps) why even fiddle with something like a 3 to 8 decoder to drive a 3 over 3 over 2 signal with just 3 IO pins. Distributing the IO units around the layout means no vast rat's nests of wires feeding the signals. Sure, there's 8 wires plus common to drive that signal directly, but it's not like that many wires running under the entire layout because the control device will be close to the controlled point.
The last piece is the detection. for block occupency it's hard to beat current sensing. Unlike diode drop type detectors, the current transformers don't induce a voltage drop, so locos won't suddenly change speed moving from an undetected siding in to a detected block.
It's probably not a good idea to run the stets near to the chip's specifications - there are too many issues that can cause that to drift and there are slight differences from micro to micro, the spec is just a nominal figure. That's why a lot of the circuits add, like Rob Paisley's, the 555 time to act as a Schmitt trigger, no ambiguous "well, there might be something in this block" output, it's either solidly high or solidly low. Maybe you cna get around this with careful component selection, such that even one resistor wheelset sets the output to something well above the high state or well below the minimum for a low - but there's one other problem, sometimes. If there is much humidity variation in the layout room, what one day is a perfect setting may not be correct when it gets moore humid - unoccupied blocks will start showing as occupied and maybe vice-versa is the system is adjusted on a more humid day and later it dries out. The page I linked in another thread when I experimented with those Gikfun trnasformers, that guy built in a self calibration, but I didn;t go so far as to actually connect and program an Arduino - plus he is using an external ADC shield, but that's one way around the adjustment problem, have the system self calibrate on power up. That though then requires a micro for every so many blocks, or a small micro per block. There IS a way to accomplish that cheaply - there are dozens of different little micros that do have at least one ADC port that are 5 cents each or less. Downside is they are one time programmable - so you'll end up throwing a few out until you get the code perfected, but that's actually cheaper than adding transistors, or 555 times, or whatever. Of course the tools aren't even Arduino level, they are more like glorified code generators where you pick the options you want and it created the code for you.
--Randy
Modeling the Reading Railroad in the 1950's
Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.
NeO6874I took a look at that locobuffer / locoio ... at least he supplied the compiled software.
this is not complicated.
the output of the detector is connected to a digital I/O pin configured as an input with a pull-up. The pull-up is important.
if the input reads LOW, the block is occupied, HIGH, it's not occupied. If there's too much jitter, the capacitor value can be increased, or you can added some hysterisis to the code.
The NCE page mentions a valid output as being < 0.7V.
I believe the Atmel/Arduino recognizes > 2.4V as HIGH and < 2.1V as LOW. The higher switching levels make the sensitivity of the circuit less critical.
i think(?) PIC, (i.e 16f628 pg 138) switching threshold as > 2.0 as HIGH and < 0.8 as LOW. A low switching thresholds makes detector sensitivity more important.
greg - Philadelphia & Reading / Reading
-Dan
Builder of Bowser steam! Railimages Site
Coilcraft also has the CS1100L with 100 turns and the CS1050L with 50. They are listed direct at about $3.50 each for single units. The CS1200L I got a free samples, not sure if they still give samples or not - I always make up a company name. I have an insnane number of PIC16F883 (and the bigger memory version) as used in the Locobuffer and Hans DeLooof's LocoIO, from back when I was going to do it all with Loconet. No idea what I'm goign to do with them now, I am not a fan of PIC programming at all.
there are a few on the surplus sales page that have only 100 turns. but the also look more $$
This is true. For testing, that's one thing, but to hand wind a few dozen for the entire layout..I think I'll pass.
BTW my tests were with those GikFun transformers. I think they are some ridiculously high number of turns, which is probably the biggest problem. But I did try with the Coilcraft CS1200L's I havem which are 200 turn.
rrinker I'd tend to think making your own current transformer is a little over the top.
but being able to make one yourself avoids buying samples of different types and waiting for delivery to test with.
Raiding the vintage parts bin? Haven't seen those tabbed 2N2222's in AGES. ANd genuine Motorola ones even.
ANd yes, it seems backwards with regards to nuber of turns - you'd think 1:300 would be a bigger step up than say 10:300 - and it is, except with these transformers we are, as you discovered, sensing current and not voltage, so for the same load on the primary, more turns = more output.
I'd tend to think making your own current transformer is a little over the top. The overall circuit - again, I'm still up in the air. At the prices you can get 100mmx100mm PCBs made ($4 for 10) and how many current detector circuits you could panalize on each 100x100 board.... I'd guess at least 40 (8x5, assuming about a 10x18mm board with room for the v-score) if you mount the transformer to the board, or you could make a board with 4-8 circuits and mount the transformer itself off-board like Dick Bronson's design. Pretty inexepensive compared to even the cheapest commercial ones.
There are some onlien circuit simulators in which I tried to construct some of the known good tranformer detectors but they never quite work out - though I spsuect I am modelign the current transformer incorrectly. I haven't tried on a full-blown SPICE implementation, but the online ones never seem to work properly, sometimes they oscillate a bit, sometimes they detect when a load is placed across the 'rails' but then never go clear when the load is removed. I had the same problem when I tried to breadboard one of Rob's detectors, it just wouldn't work, but at that time my test equipment wa slimited to cheap multimeters, and it did turn out the current transformer I got was NOT an equivalent for the original. I had much better luck more recently trying it out when i could see what was coming off the transformer with my scope, and was able to monitor it with my bench meter as well. I tried a few combos of turns and part values, and considering I was working with a piece of flex track as my 'layout', I found a reasonable minimal threshold that would detect a single 10K. Without a diode clamp though the short circuit votlage, even with less than 2 amps, put my output way above the safe value for most other components. This was DC output - I did have the diode across the current transformer.
gregcWould it make sense to build your own pulse transformer with magnet wire wire looped a few times?
I wrapped ~50 turns of magnetic wire around a ferric core and compared the output voltage to other circuits using the Vitec 1820 w/ 300 turns.
The following table indicates the output voltage across the cap with a 10K resistor connector to a 5V regulated suppy. I tested with a LED in series w/ a 1K resistor.
It lists the # turns, voltage using the homemade ~50T transformer and the voltage using the Vitec. It suggests that with the ~50T transformer, there's little benefit it having more than 4 turns.
Turns ~50T Vitec 1 4.2 5.0 2 2.7 5.0 3 1.0 4.6 4 0.49 3.7 5 0.44 2.2 6 0.43 0.62
while its probably not worth the effort to build your own, i think it does make sense to find use pulse transformers with fewer windings, if you can find them. For me, i'm interested in having a better understanding how these types of block detectors work.
This is the same sort of problem I was having when messing around with little other than just the coils. Make it work on a single 10K resistor, and if there is a short and you get full booster power (or even breaker limited to say 3 amps for the district) the output voltage runs way tooo high. Definitely needs a clamping diode but then you have to compensate for that loss on the low end, which increases the upper end... fun stuff. Depends on how long it takes me to get the rest of the stuff sorted out, I may design my own transformer detector, or just pick one with reasonable operating characteristics and buy them. The expensive part is always the transformer, and surplus types are usualyl cheap, but there is always the danger of the supply drying out before you have as many as you need.
What little experience I have with transformers considered the ratio of the winding and the voltages on the primary and secondary coils. So I had thought that the track wire should go through the pulse transformer just once to maximize the "voltage" sensitivity.
While testing a pulse transformer detector, I was dissipointed when I did this. So I added addition loops and sure enough sensitivity increased -- that is, the voltage across the cap with the block occupied became lower with each additional loop.
So it finally dawned me that its the current ratio and not the voltage ratio of the transformer that matters. This means the more loops of the track wire increase sensitivity as well as a pulse transformer with a smaller number of turns.
The Vitec 57P1820G and 1822 suggested by Rob Paisely are 300 and 350 turns. But I wonder if the PE-51687 with 100 turns would be a better choice (although > $$). Would it make sense to build your own pulse transformer with magnet wire wire looped a few times?
The BD20 claims to be sensitive (0.7V) with 1.5ma drawn on the track with 5 loops. I believe this is approx. 1 car with a 10k resistor. They also suggest limits on the number of turns based on the size of the booster. I'm guessing that there's a need to protect such a circuit if there's a short across the rails when a short can draw 10A from a booster.