Help please with 20M2 inputs

The bear

Senior Member
@oldbloke,
On the Picaxe 20M2, pin2 is the serial download, this pin normally has a 22k & 10k in series, so, a total of 32k to ground or 0v.
If its a proper pcb, e.g. from Picaxe, these resistors are usually fitted. You can test with your magic meter.
Regards, bear..
 

oldbloke

New Member
@oldbloke,
On the Picaxe 20M2, pin2 is the serial download, this pin normally has a 22k & 10k in series, so, a total of 32k to ground or 0v.
If its a proper pcb, e.g. from Picaxe, these resistors are usually fitted. You can test with your magic meter.
Regards, bear..
Aha. Thanks. I will test. I do have the proper PCB but I will check for a dry joint.
I changed the pics today for a new set. No improvement. It has to be interference from the running locomotives as it works fine if I simulate their movement with unpowered wagons.

I am seriously considering using a deltronics buffer box as this might be a bit more robust (it was made for schools in the days of the BBC micros.)
I will try moving the pic axe board away from sources of interference first.
 

Circuit

Senior Member
It has to be interference from the running locomotives as it works fine if I simulate their movement with unpowered wagons...
This certainly does seem to be the case. There are two options; either clean up the electrical interference from the locomotive or shield/isolate/protect the PICAXE circuit (and the MERG detectors) from the effect.
I would start by soldering a 220nF capacitor across the motor brushes in the loco. Then add two more capacitors; 220nF from each motor brush to the metal casing of the motor (See PICAXE Manual 3 page 12 for an illustration). Your motor probably has open sides, does it? Older model locomotive motors tended to do so. These are particularly ghastly for radiated interference because you can actually see the sparking where the brushes contact the commutator when it is working. While you are there, give the commutator a really good clean with a contact cleaner or, if you don't have any, with lighter fuel. Stick 220nF across the contacts on the connector rail where the power enters the track. This should give you some basic suppression for the motor.
Next, switch off your track cleaner - if only to see if it makes a difference. Track cleaners for old layouts work really well; the problem is that they do this by generating sparks to bridge dirt on the track and this is something that can really kick up interference as I indicated in my previous post.

If you have any ferrite rings it is worth feeding the power leads to the track through a couple of those as well. You really need a choke inductor or two on the actual loco but just try the capacitors first.

One way to get an idea of how much electrical noise your loco is generating is to stick a medium-wave radio into the middle of the track and run the train - any interference? (I am guessing that if you have a really old model railway you may still have an old radio that picks up on medium wave perhaps?)
 

westaust55

Moderator
I concur with Circuit.

For DC controlled locomotives add surge suppression capacitors across the motor (almost standard on all new model locos for RFI purposes). [ such capacitors are not to be used with DCC controlled locos however - that would introduce a whole new set of electrical interference problems].
Most new locos come with 100 nF ceramic type capacitors (usually with the marking "104") though no harm in using 220 nF as Circuit suggests - again ceramic types. use some with at least 25Vdc or even 50 Vdc ratings.

Next, twist the pairs of positive and negative wires for each track section together and twist the track supply wires back to the control panels/power supplies.
Typically 3 or 4 turns per foot/ 300 mm will be good. Keep in mind that even the rails can act as antenna and put RFI (electrical noise) into the air and induce noise into the adjacent sensor and other control wiring.
Keep the sensor wiring at least 150 mm from the track power wiring. Again consider to twist sensor wires pairs for each sensor between the sensor and the controller / PICAXE boards.
Likewise aim to keep your controlling electronics separated from wiring and parts that can generate electrical noise that can/will be induced into adjacent sensitive control/sensor wiring and circuit boards.


Even the electrical pulses from solenoid operated points involve brief but high currents that can induce electrical noise into sensor and other input signal wiring run close to the solenoid wires.
So while it certainly appears to be a case of electrical noise emanating from the operation of the locos is the primary problem, it is worth ensuring all the wiring is done well to help avoid problems occurring at a future time.

I recall reading in one of your posts that you have relays as part of the output circuits. Those should all have suppression/"flywheeling" diodes across the relay coils to prevent over-voltages damaging the electronics driving the relays/coils/solenoids. See page 24 in PICAXE manual 3 for the basics: http://www.picaxe.com/docs/picaxe_manual3.pdf



If I may also make a suggestion with respect to your replies.
Rather than just use the "Reply with Quote" button and keeping the entire post (so everything is repeated in your response, either:
(a) cut out the unnecessary test and just keep the sentence you are responding specifically to. See Technical's post above as such an example - he has only included the single sentence he has replied about.
(b) use the "Reply" button and then you can just address the person you are responding to (e.g. @Technical ) and provide your further information without copying/having any of the earlier post included.
 

oldbloke

New Member
This certainly does seem to be the case. There are two options...
A lot of info and help here. Thanks,
1. I have disconnected the track cleaner. This hasn't helped.
2. The capacitors to suppress the motors seems like a good way forward and easy to do. Thank you for the instructions. Does the polarity of the capacitor matter?)
3. To add a complication, the circuit that is controlled by the picaxe isn't the only circuit on the track. There are two other tracks running at the same time, each controlled by stand-alone electronics. (These have been switched off during my attempts to mend the picaxe.)
4. Motors are, as you suspected, open sided.
5. I don't own a radio but I'm sure I can borrow one.

The mystery is that the picaxe has been working on this layout without any faults for about 2 years. The problems all arose after I made a few changes:
a) I beefed up the power supply to the track from old ethernet twisted pairs that connected to the track in one place, to much more hefty cable that connected to the track in several places.
b) I changed the 4.5v battery that powers the picaxe.
I have eliminated the effect of the MERG sensors by disconnecting them and taking them out of the code.
No other changes, even the locomotives are the same. I have tested the three 1.5v cells that form the battery and there's definitely 4.5v across them.

Will moving the picaxe board away from the vicinity help? The powered track is within about 100mm of the board.

Thanks again for your input. I now have another few ideas to explore.
 

oldbloke

New Member
How about one of these, we have a running bet on whether we would ever sell one ever again!
Thanks for this. I had a good look at the documentation and the photograph. I have a deltronics 'Control It Plus' box that looks like the one in the photo. However, it does not have a 25pin cable connector. There's just a 9 pin serial connector and a D to A USB to serial converter cable. This is a pity because it looks like a good way forward.
 

westaust55

Moderator
The capacitors to use across the locomotive motor for RFI (electrical noise) problems should be of the ceramic type.
These are typically yellow in colour and disc shaped with two leads protruding a few mm apart (up to 5 mm).
Ceramic capacitors are not polarity sensitive so then can be installed either way.
I usually install so that they are orientated to give best opportunity to read the markings at a future date.
Since the loco voltage can be up to around 12 Vdc ceramic capacitors should be 35 Vdc rated and even 50 Vdc will do no harm -
in fact better.
Ceramic capacitors operating at close the rated voltage can have a greatly diminished working capacitance value.
 

hippy

Technical Support
Staff member
The mystery is that the picaxe has been working on this layout without any faults for about 2 years. The problems all arose after I made a few changes
Perhaps go back to what you were using, check that still works without issue, then move forward making one change at a time, testing as you go. That should identify what causes the problem to occur.
 

oldbloke

New Member
FIXED IT!
I never would have found the fault without all the problem-solving on this forum.
I moved the picaxe board about 100 yards from everything else and it made no difference however, while rewiring, I checked the output from the power supply that supplies the picaxe and found that whilst the train was running, the output voltage fluctuated considerably. I wired in a (more modern) transformer and the problem went away. It now operates consistently (even with the track cleaner), my wiring is much improved and I learnt lots.
Thanks to everyone who contributed. I think we can now close this thread!
 

lbenson

Senior Member
Congratulations on getting it fixed (easily, if with some delays).

But +1 to always putting in the "sertxd("Starting",cr,lf)" statement before main, which (probably, if I understand the consequence of what you are reporting) would have told you that the picaxe was restarting unexpectedly, which would have pointed you to a power supply problem.
 
Top