Anyone tried dcc coding decoding with picaxe?

john2051

New Member
Hi,
Has anyone succeeded in getting a picaxe to encode and decode dcc model train data?
The specs are:
A 1 is represented by a 58uS for a half cycle, and a 0 at least 100uS for a half cycle.
This may turn out to be too difficult, but hopefully someone might have done it.
Thanks & regards
john
 

edmunds

Senior Member
Like Beaniebots, no personal experience to date.

...

One day, when time permits, I will look to trying something myself.
Same here. The research I have done clearly shows it is possible. It is just a matter of writing pretty complex code for my current level compared to using simplified commands like for I2C, SPI, SONY IR and the like :).


Edmunds
 

john2051

New Member
Hi, thanks all for replying! I think westaust55 must be psychic, as the project I was hoping to have a go
at was a turntable, as dedicated units are silly money (to me).
I had dreaded that it would be too complicated, but thanks to you not only is it possible, but some
have done it.
I really appreciate your answers, thank you.
btw. I did a search initially for dcc, and it came up with nothing..
regards john
 

edmunds

Senior Member
btw. I did a search initially for dcc, and it came up with nothing..
regards john
I have the same problem with search. I never seem to find what I'm looking for with a built in search. I thought it was my broken hands or something. What a relief :). One day, I should try Google search on picaxeforum.co.uk domain for something.

Edmunds
 

Circuit

Senior Member
btw. I did a search initially for dcc, and it came up with nothing..
regards john
The search engine would have replied; "Sorry - no matches. Please try some different terms. For 3 letter words add * (e.g. i2c* )".
A 3 letter word such as DCC is not searchable. If you search, as it indicates, for DCC* then you would get a result. Motto; always read what it says on the can!
 

john2051

New Member
I think I actually searched for dcc control initially, and then just dcc.
Never mind though, at least there is a chance of decoding dcc signals.
Some of these 'professional' decoders are quite expensive.
Thanks
regards john
 

Circuit

Senior Member
Never mind though, at least there is a chance of decoding dcc signals.
Some of these 'professional' decoders are quite expensive.
Thanks
regards john
John, have you had a look at the Model Electronics Railway Group? (www.merg.org.uk). The group has several rather neat "pseudo-open source" DCC devices (pseudo-open in that it is members only access but free of charge thereon). The schematic is published to members and, for example, a DCC Accessory decoder kit is available for around £10. I wish that I could post up the schematic, but clearly this cannot be done for copyright reasons outside MERG membership. The basis of the DCC Accessory decoder is a 16F628 PIC which needs only two opto-couplers and a diode bridge (4 x 1N4148) to connect up to the DCC signal. If you want to make one up yourself the free firmware can be downloaded by members. The output is eight lines digital which the kit feeds into a ULN2803 to give power outputs, but the eight lines could equally be connected directly from the 16F628 to a PICAXE. I think that should give you quite some possibilities for DCC and PICAXE. I have been playing around with this and I think it is probably the cheapest and easiest way to connect PICAXE to DCC. A 16F628 PIC costs only £1.80. If you do not have the kit to load firmware into a PIC then it is available from MERG preprogrammed with the DCC firmware for £3.00. If you have a PICKIT3 or equivalent and can handle programming the firmware into the PIC then you are looking at being able to interface any PICAXE chip to DCC for less than £2.
 

westaust55

Moderator
Some further MERG DCC specific project information is provided on these pages:
I understand that for MERG members that newer projects are available than those available on the public pages. I cannot comment on what other members only DCC projects are available.


Having myself looked at the DCC projects accessible publicly at MERG and various other websites, they tend to use a PIC chip and are using code derived from one or two authors with various tweaks/adjustments. The code is carefully coded to loop in a tightly timed manner to detect the duration of each high and low period for the digital waveform.
For accessory decoders, most of these PIC based projects are based around pairs of outputs (make one high and the other automatically goes low) as needed for point/turnout control.


I have idea’s to try an use some TTL chips as a “front end” and see if a PICAXE can interface in that manner. Such a scheme may allow a PICAXE to detect an address and action accordingly but may lose a few subsequent broadcasts but as (I believe) the DCC system repeats the details for any previously addressed devices regularly this may not be a problem. I believe the PICAXE will need to operate at 64 MHz to have any chance of detecting DCC signals.
Unfortunately, I have a lot of extra paying work occupying my time so both PICAXE and model railway projects are all currently on very slow progress for anything up to another year (Oct 2015 ?).
 

Circuit

Senior Member
For accessory decoders, most of these PIC based projects are based around pairs of outputs (make one high and the other automatically goes low) as needed for point/turnout control.
From the relevant MERG Members Technical Bulletin:
"A later development of the on-board micro controller firmware (now ACC5) presented the possibility of transforming the decoder from a 4 channel push-pull device into an 8 channel on/off device and this Technical Bulletin assumes that this option has been configured."

Therefore, as I indicated, eight digital lines are available.
 

westaust55

Moderator
From part way down the page on first link I provided it seems the ACC5 software version provides 8 independant outputs when used with the LENZ DCC control system.

Same comment about for LENZ systems at the bottom of the second link I provided.

So yes may get you 8 independant channels if you have the appropriate controller system.

EDIT1:
The JMRI file for the MERG Accessory Decoder with version ACC5 software available here:
C:\Users\kag0248\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5\S6XTH6SF\MERG_ACC5.xml
Also indicates there is a special “Lenz Toggle Mode”
Now I highlight that I do not use the JMRI software so there may be aspects I am missing.


EDIT2:
From this MERG ACC5 description: seems there are ways to set up for 8 discrete outputs.
http://www.merg.org.uk/merg_resources/dcc/download/Acc5txt.pdf

Seems if you build a MERG DCC command station (encoder) all accessory decoder vcersions can provide 8 discrete outputs but many commercial command stations could not. ACC5 software does allow this with commercial command stations subject to being able to program a particular CV bit.
ACC5 can work in either single or dual mode dependent on the setting of bit 7 (the MSB) of
CV545 (CV33). As this cannot be set using ‘register’ mode programming, it requires a
programmer capable of accessing CV545 or CV33
.

However, at the end of the day the original question is what has been done for DCC decoding with PICAXE.
There has, as per post 3, been some success but not as a normal decoder.
I believe that with some “help” from a few extra TTL chips as a front end that something more akin to a conventional DCC decoder may be possible but only measuring the duration for one half of each data bit. Lack of available spare time is preventing me progressing this with any expediency.
 
Last edited:
Top