Discussion in 'Other Electronic Interfaces' started by paul_l, Nov 19, 2016.
Done!!Sorry about the multiple replies but don't use FFox.Will try and do better next time.
Elegant solution Col
Thanks mate and it works
Have you done anything with DCC shuttles?
Not yet, but after replacing the seep point motors with servo's, each fitted with 2 microswitches, one for V polarity the other for position detection, I want to use the position detection and block detection for automatic running of the DMU's from the traverser to platforms 1 and 2.
Allowing manual driving of loco hauled trains into platform 3, the station pilot would coaches from the train and shunt them into platform 4.
Then the loco could either go light engine to the traverser, or back on to the coaches for the trains return.
While the shunting is taking place the auto matics would be shuttling the DMU's back and forth. Initially I would base it on 3 DMU's and 2 traverser roads, eventually moving to 5 DMU's and 4 traverser roads. Then when the loco hauled train was ready to enter / depart, a button would be pressed, and the cycle would stop at the end and not re-start the loop, points, traverser and signals set correctly for the driver to make his / her move, once the move had completed, the shuttle would re-start - or at least that is the plan, as I have never done any thing like this before it may take a while and probably frequent pressing of the BIG RED button
It's all a bit scary ain't it. I've stuck a motor shield on an arduino and have programmed it,, no smoke so far, will hook it up tomorrow I hope. As soon as I get chance I'll wire up a couple of bits of track and download the controller file. Fingers crossed for that one. I used the Merg block det kits but it was the ones with the diodes not the induction coils, they seem to work really well. Heading to Dollar in the deep south on Monday so may not get to it until Thursday.
I've been trying to follow this thread and make my own decoder. However I can't get the arduino to receive any packets. Does anyone know what I could be doing wrong from the photos below?
Any help is much appreciated
I'm sure our resident expert on all things black magic will be along with an explanation or two shortly ........ witchcraft I say.
welcome aboard and nice to see you jumping in.
If you want I will email you the arduino sketch and fritzing diagram for you to check your code and circuit against - or just upload it to your arduino and see if it works.
I can also send you a sketch that works as simple accy decoder (upto 18 outputs on a Nano, but I would suggest keeping it down to 8 or 10 to start with so you dont overload the outputs). LED's will work fine.
Here is the circuit diagram for the opto-isolator circuit that outputs the data to pin 2 on the arduino
I've followed the circuit diagram above and checked it about 5 times and can't see anything wrong with it, So I'm thinking it's something wrong with my code, the Arduino or controller. I'm using a Hornby e-link for the controller so not sure if that's the problem and I've followed this tutorial 'http://www.mynabay.com/dcc_monitor/' to try and see if I can get the arduino to receive dcc packets first before I go onto getting the servos working. I brought a pack of 3 elegoo nano boards from amazon and I'm thinking that's the problem at the moment as in the tutorial it says, '**** There have been several users reporting that this doesn’t work on Chinese made Arduinos ****'. What is the make of the arduino nano you used?
I've also cleaned my circuit up a bit:
Thanks for quick response and help
I have several different Arduino's one Official Uno, an Uno clone, several Nano clones - they don't even put their own name on them
I must admit most projects, I start off with the Uno (it's easier to wire up to the breadboard).
I have had a couple of duff Nano's, but that may have just as easily been me with a stray connection
I have emailed you two sketches, 1 a DCC accy decoder - if you connect an LED (+1K resistor) to output D4, then turn On decoder address 600 the LED should come on, turn Off accy 600 and the LED should turn Off. If your DCC system can't use accy addresses as high as 600 then change the accy address valur - see below (I used this value as it's well away from my normal addresses, so when I program up another device it shouldn't effect anything on the layout if I forget to change the values).
There are a max of 18 sets of values (0 to 17)- for a Nano - reduce this to 14 for an UNO
accessory.address = 600; // DCC address - change this to a more suitable address if needed
accessory.mode = 1; // Continuous: HIGH until DCC switches the address off again
accessory.outputPin = 4; // Arduino pin to which this accessory is connected
Give it a try
Hi Will You mention using the Chinese version of the Arduino I use these versions the one thing that my versions needed was to use the old boot programme in the Arduino IDE. You find it under tools, processor,
Paul I have a funny feeling that the elite can only go up to 252 as far as dcc codes.
so maybe change the sketch to send 200.
be seeing you
Hi Will, just getting back into the swing of things and came across your problem with the decoder.
Looking at the pic the connections appear to be ok but (and I'm not sure about this and forgive me if I'm wrong) the
pins do not appear to be soldered into the arduino nano. I know that the holes are through hole plated and the pins may seem to be a
friction fit but they may not be reliable due to tolerances in pin sizes/holes etc. This can cause electronic noise and intermittent connections
on the circuit, it's better if you solder them. I haven't tried the arduino sketch that you are using but have used Ruud Boer's software to great effect.
You will see a link 'Arduino DCC,S88 and more Download link' to https://www.dropbox.com/s/qkhrc147m38llb9/Arduino_DCC_S88.zip?dl=0
and can download the zip file containing several sketches which will work with the nano.
Personally I have had no problems with the Chinese Nano's or any other of their circuits although their switches aren't great.
Try loading the basic blink Sketch, if it works and the on board led flashes on and off for a second then try changing the value for the 'on' time to 5000 and see if you get a five second 'on' instead of one second.
if you do then the nano is ok (normally).
And of course re-reading I see Paul has already sent you one of the sketches
Also Bobs right too, although I haven't come across them there are companies that send out the boards without the boot-loader installed.
I think I'll go get a beer.
Welcome back Col
Good to see you flexing the grey matter again in the railway direction.
As for the addresses, 600 etc, just change the ones you need to use to a value below 252 for the elite. I have the sketch defaulting to 600 as none of my accessories are in that range, so if I forget to change the value, it will have no effect.
And for the curious, just like you can have loco's with the same address, you can have accessories with the same address, for example, having a point with address 1, and a signal with address 1, changing the value of accy 1 will change the point and signal.
Or in the case of the servo controller, you could set several outputs to accy address 1 and move all of the servos at the same time.
I have just borrowed a friends Hornby Select(he does not have an Elite) And I cannot get it to show any packet counts
I get the same as Will gets. If I change my input to my Digitrax Zepher I get the correct signals
so maybe you cannot use the Hornby system with this type of packet viewer
your comments would be appreciated .
be seeing you
I just stuck the scope onto both Select and Zephyr.
here are the traces. the yellow is the Zephyr and the blue is the Select.
be seeing you
There seems to be an awful lot of noise with the select - may be worth trying adding a snubber (RC filter) accross the track bus and see if that helps clean up the signal.
Snubber or RC Filter
A complete parts list of the parts (there are only two parts required) is found here: RC FILTER parts List
It consists of a 100 Ohm 1/2W resistor and a 0.1uF ceramic or film Capacitor that can support 25V or more for N/OO/HO. A 1 Watt version of the same resistor is needed for larger scales.
Looks like 'Ringing' to me one of the causes can indeed be resistive / capacitive /or inductance. Definitely worth trying the snubber.
Can't remember much about it now but I think it may cause heating hence the 1/2 - 1 watt resistor for dissipation. Not a great output
though, looking at the size of the spikes it may just be screwing up any timing the arduino is looking for by causing the led in the opto isolater
to flash on and off, no steady pulse and that's critical or EMI interference . Just had a quick root around Google, it's a nasty.
Like the scope Bob