Japanese Modelling & Japan Rail Enthusiasts Forum
LoginRegister

ForumHelp

JNSwiki
May 24, 2012, 04:59:25 am
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Search  Search for  
Pages: [1]   Go Down
  Print  
Author Topic: Need help debugging Arduino Command Station  (Read 1329 times)
0 Members and 1 Guest are viewing this topic.
CaptOblivious 
Philosopher-Engineer
Administrator
******
*****
Offline Offline


485系「あいづライナー」


WWW
« on: December 11, 2010, 08:40:28 pm »

I wonder if anyone else here has an Arduino and a spare DCC booster and would be willing to help me out a bit? I've got some preliminary code for generating DCC waveforms on my Arduino, but it isn't working and I can't tell why. The waveform itself looks correct, and as near as I can tell, it's transmitting legal packets, but my loco isn't moving and I can't tell why. Could someone have a look and perhaps help me see where I've gone wrong?

http://devices.artificial-science.org/2010/12/10/dcc-waveform-generation-arduino-sketch-v-1/
Logged

A miniature slice of geekdom,
Akihabara Station
inobu 

*
Offline Offline


« Reply #1 on: December 11, 2010, 10:17:55 pm »

Don,

Your best bet is to get a DCC packet sniffer so you can see and interpret the data. 

http://www.opendcc.de/elektronik/dcc_sniffer/sniffer_sw_e.html

NCE has one you can buy.

Trying to translate HEX is going to be a challenge.

Inobu








 
Logged
CaptOblivious 
Philosopher-Engineer
Administrator
******
*****
Offline Offline


485系「あいづライナー」


WWW
« Reply #2 on: December 12, 2010, 12:31:41 am »

Inobu,

Thanks, I'd thought about bgetting one of those, but they're a bit more than I can afford right now. I am getting a 16-channel logic probe for Christmas that would work as well: I'm quite comfortable staring at raw binary or hex (I don't even see the code any more. All I see is: F7 here, DD51 there...). I just didn't want to have to wait that long, esp if the solution is obvious to someone else ;)
Logged

A miniature slice of geekdom,
Akihabara Station
Martijn Meerts 
Administrator
******
*****
Offline Offline

Gender: Male


WWW
« Reply #3 on: December 12, 2010, 11:43:39 am »

I'm so used to Objective-C by now, that the code you've got seems totally weird =)
Logged

Mixed Japanese N-scale: http://www.jr-chiisai.net
Era III German 0-scale: http://blackforest.jr-chiisai.net
CaptOblivious 
Philosopher-Engineer
Administrator
******
*****
Offline Offline


485系「あいづライナー」


WWW
« Reply #4 on: December 13, 2010, 04:23:35 pm »

A fellow on the OpenLCB mailing list found the bug for me; it was a pretty silly mistake, as I expected. Fresh, working code will be posted to my blog later today.
Logged

A miniature slice of geekdom,
Akihabara Station
stevenh 
Tetsudo Staff
*****
Offline Offline

Gender: Male


WWW
« Reply #5 on: December 13, 2010, 10:16:51 pm »

Don't leave us hanging :) What was the reason?

Meanwhile, I've wanted to tinker with DCC and the Arduino for a while (I even have decoders floating around my proto-layout), but I just haven't found the motivation to hack up another locomotive... all my DCC-enabled jobs are back in another part of the country.
Logged

CaptOblivious 
Philosopher-Engineer
Administrator
******
*****
Offline Offline


485系「あいづライナー」


WWW
« Reply #6 on: December 13, 2010, 10:41:26 pm »

The error was this:

Because the two halves of a zero-bit can be of different lengths (to enable "stretched-zero" DC operation), I check to see if, first, the interrupt was called for the /first/ half of the bit, and if the bit is currently a zero; in which case I switch the zero counter. I had only intended to do any other processing during the /second/ half of the bit, but because of the structure of the conditional statement, I was doing all other processing twice over, once at the first half (but only if the current bit is a '1'), and once at the second half. Which meant that every other '1' bit was effectively disappearing into the void, instead of appearing on the rails. D'oh!

Working up a full-fledged command station Arduino library now; I hope to have a preliminary working version up by week's end.
Logged

A miniature slice of geekdom,
Akihabara Station
stevenh 
Tetsudo Staff
*****
Offline Offline

Gender: Male


WWW
« Reply #7 on: December 14, 2010, 12:13:34 am »

Is the Arduino to have a myriad of inputs/buttons/switches/rotary-switches/potentiometers/LCDs/force-feedback/realistic-throttle-handles or will a computer program/RS232 control it?
Logged

CaptOblivious 
Philosopher-Engineer
Administrator
******
*****
Offline Offline


485系「あいづライナー」


WWW
« Reply #8 on: December 14, 2010, 03:05:26 am »

Steven,

None of the above. I might have a pot and a couple of buttons, maybe, just for testing. But the code I'm writing is supposed to only generate the DCC signal from commands received—where those commands come from is immaterial. So you could use this library to build a Zephyr-alike, a computer interface, or whatever. I intend to take it in the direction of working with OpenLCB, as the OpenLCB project doesn't have a command station yet. Or a cab<->CS protocol.
Logged

A miniature slice of geekdom,
Akihabara Station
CaptOblivious 
Philosopher-Engineer
Administrator
******
*****
Offline Offline


485系「あいづライナー」


WWW
« Reply #9 on: December 18, 2010, 04:09:21 pm »

Update, looking for folks interested in contributing to my new software project:

https://github.com/Railstars/CmdrArduino

http://devices.artificial-science.org/2010/12/18/introducing-cmdrarduino-a-library-for-building-dcc-command-stations-with-arduino/
Logged

A miniature slice of geekdom,
Akihabara Station
CaptOblivious 
Philosopher-Engineer
Administrator
******
*****
Offline Offline


485系「あいづライナー」


WWW
« Reply #10 on: December 27, 2010, 09:15:46 pm »

The software is alive! I just drove my EF65 back and forth and worked its headlights using only my Arduino and a booster. I've put up a new page to track progress on the library:

http://devices.artificial-science.org/cmdrarduino/
Logged

A miniature slice of geekdom,
Akihabara Station
KenS 

*
Offline Offline

Gender: Male


WWW
« Reply #11 on: December 28, 2010, 05:39:03 am »

Now that's an accomplishment. Congratulations.
Logged

Sumida Crossing An N-Scale Japanese-Themed Urban Railroad
Pages: [1]   Go Up
  Print  
 
Jump to:  

TinyPortal v.1.0.6 beta 2 © Bloc

Problems? Simply email "help" at "jnsforum" dot "com"!
Click here to lend your support to: JNSForum.com Autumn 2012 Maintenance and make a donation at www.pledgie.com !
Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC
Twitter Mod 1.3 created by 2by2host.com - a web hosting company
Valid XHTML 1.0! Valid CSS!
Page created in 0.185 seconds with 40 queries.