tag:blogger.com,1999:blog-7763117497297224225.post4437698266838497873..comments2022-02-02T11:00:59.084-08:00Comments on Harnessing the Electron: DCC Firmware for ArduinoMartyhttp://www.blogger.com/profile/09291544028617899870noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-7763117497297224225.post-55964543136480729022013-09-22T14:00:50.836-07:002013-09-22T14:00:50.836-07:00Thanks for the quick reply Marty. I wasn't qu...Thanks for the quick reply Marty. I wasn't quite sure if pin10 was doing something to the driver chip that I wasn't aware of. But thanks for clearing that up. My mind is now at ease and I feel very comfortable buying a new dcc controlled locomotive to test things out ... then I'll upgrade all the old stock to dcc. Until then, I'll be using the Arduino to drive the dc bugs around so the kids can enjoy them ... yeah the kids ...Anonymoushttps://www.blogger.com/profile/14812489905588241325noreply@blogger.comtag:blogger.com,1999:blog-7763117497297224225.post-30258509452519067302013-09-21T10:17:56.588-07:002013-09-21T10:17:56.588-07:00@Max - That's a weird one! I don't underst...@Max - That's a weird one! I don't understand what's going on there tbh. Thanks for posting the info, it could come in very handy for someone else.<br /><br />@Bryan - The TRIG_ stuff isn't important to the operation of the controller, it was a debug feature I added. It's just a small pulse that I put on pin 10 at the start of a data packet transmission so I can trigger my oscilloscope, and tell where the data starts if I'm looking at it.<br />Martyhttps://www.blogger.com/profile/09291544028617899870noreply@blogger.comtag:blogger.com,1999:blog-7763117497297224225.post-70306839883679208232013-09-21T09:40:33.575-07:002013-09-21T09:40:33.575-07:00Hey Marty. This is a great writeup. I have lots ...Hey Marty. This is a great writeup. I have lots of model trains from long ago that have been collecting dust. I would like to get the kids interested while satisfying my inner geek. <br /><br />I'm marginally familiar with the Arduino Mega 2560, having used it for various purposes around the house. After downloading and studying your code, I have one question that I just can't answer myself: You reference pin10 and have TRIG_ON and TRIG_OFF macros defined for throwing a bit on port B. These are put to work in the ISR, could you tell me how they tie into putting info to the rails? I'd really appreciate it.<br />BryanAnonymoushttps://www.blogger.com/profile/14812489905588241325noreply@blogger.comtag:blogger.com,1999:blog-7763117497297224225.post-6025714333790858882013-09-14T11:51:34.520-07:002013-09-14T11:51:34.520-07:00Hi Marty.
With your code and a little customizati...Hi Marty.<br /><br />With your code and a little customization, i can drive my dcc-onboard loco now. Thanks.<br /><br />But when I swap the wire or turn around the loco, it can't work. Then I modify the code <b>if( bit_ ) {DRIVE_1();} else {DRIVE_0();}</b> to <b>if( bit_ ) {DRIVE_0();} else {DRIVE_1();}</b>, it works again. So i guess the problem is the polarity of the start of signal. If the start is a +12v it works, but if the start is a -12v it ain't.<br /><br />Any idea on this?Anonymoushttps://www.blogger.com/profile/11383407859438501693noreply@blogger.comtag:blogger.com,1999:blog-7763117497297224225.post-55544668466068914322013-05-16T14:44:56.749-07:002013-05-16T14:44:56.749-07:00@Sergei - glad you got it working, but sad about y...@Sergei - glad you got it working, but sad about your breadboard :(<br /><br />Creating that circuit permanently on stripboard or something is definitely a good idea. Those pins you mentioned are usually soldered to big pads of metal to draw the heat away from the chip.<br /><br />I'll update the blog post with a warning about this. My original cct was on stripboard, not a breadboard so I didn't see that problem. Thanks for pointing it out.Martyhttps://www.blogger.com/profile/09291544028617899870noreply@blogger.comtag:blogger.com,1999:blog-7763117497297224225.post-84454225392110962552013-05-14T19:32:53.739-07:002013-05-14T19:32:53.739-07:00Hi,
I tried this solution on a different microcon...Hi,<br /><br />I tried this solution on a different microcontroller (Teensy) and it started to work after some minor modifications. However, the moment I found proper train address it worked for several seconds and then I smelled burned plastic - breadboard started to heat at legs 4/5/12/13 on L293D. I wonder if making connections permanent will be better? L293D also was very hot. <br />Anonymoushttps://www.blogger.com/profile/06882561863210132359noreply@blogger.comtag:blogger.com,1999:blog-7763117497297224225.post-56077957268253297652012-08-26T03:26:35.066-07:002012-08-26T03:26:35.066-07:00@GFletch: Did you make any progress on your setup?...@GFletch: Did you make any progress on your setup?<br /><br />It's a bit difficult to debug things from a distance, so I'm not sure that I'll be much help. Have you a multimeter? Have you done a few spot-checks of voltages in the circuit?Martyhttps://www.blogger.com/profile/09291544028617899870noreply@blogger.comtag:blogger.com,1999:blog-7763117497297224225.post-38858637795718351462012-08-07T09:46:07.697-07:002012-08-07T09:46:07.697-07:00Marty,
Very cool stuff. I'm just learning abo...Marty,<br />Very cool stuff. I'm just learning about the great realm of Arduinos and everything about. (it is amazing how excited one get when they learn how to change the way an LED flashes, I'm an architect by trade so I have no EEE or programming experience) <br /><br />What I'm hoping to learn is how to use an Arduino as the brains to a turnout control panel. IE press a button on the panel and have the arduino then send out DCC commands over my LocoNet bus to change multiple turnout decoder position for Routing.<br /><br />What you have here is very interesting, still way above my head but cool all the same.<br /><br />JasonJason Rhttps://www.blogger.com/profile/18302688666253738613noreply@blogger.comtag:blogger.com,1999:blog-7763117497297224225.post-11754211529490457162012-06-09T07:03:47.586-07:002012-06-09T07:03:47.586-07:00Hi Marty
thanks for coming back to me, I've c...Hi Marty<br /><br />thanks for coming back to me, I've come back to look at this project again and I just cant get it working :(<br /><br />I'm sure its something stupid I'm doing wrong.<br /><br />I made a quick video of what I am trying.<br /><br />I am running the system off of 5v at the moment and have hooked up a DCC decoder that shows me the binary packet data sent over the rails, this is what I am using to test.<br /><br />When I remove the lines of code around // messing I get more info back from the command line, I guess this is a test? That said I can only send 2 commands and then it doesnt print any results back.<br /><br />Perhaps you can give me some pointers?<br /><br />Here's my set up...<br /><br />http://youtu.be/getXvaPLrO0<br /><br />Thanks<br /><br />GaryGFletchhttps://www.blogger.com/profile/17992839586930146060noreply@blogger.comtag:blogger.com,1999:blog-7763117497297224225.post-18534719733439453062012-04-20T19:16:22.689-07:002012-04-20T19:16:22.689-07:00@GFletch
I'm sorry to hear things are not tot...@GFletch<br />I'm sorry to hear things are not totally working out for ye! Sounds like you're nearly there though.<br /><br />I'd guess that since a DC train is moving, you're not getting a DCC voltage pattern on the rails.<br /><br />Do you have a multimeter? There are a few things you could check. First thing would be to check out your driver cct.<br /><br />Unplug pins 11 & 12, and instead put one wire in 5V and the other in 0V (gnd) on the arduino. We're forcing the bridge to drive one way so measure the voltage between the rails. You should see half of your high supply voltage. In my case it would be +6V.<br /><br />Now swap over the wires, the one that was in 5V goes to 0V, and the one that was in 0V goes to 5V. If you measure the voltage across the rails, you should see negative half your high supply voltage. <br /><br />Or, if you seen -6V (say) first, you should see +6V when you swap the wires.<br /><br />If you are seeing these voltages, we can probably rule out your cct, If not, post high-res pictures of the top and bottom sides of your board so I can have a look.<br /><br />Which arduino board are you using?Martyhttps://www.blogger.com/profile/09291544028617899870noreply@blogger.comtag:blogger.com,1999:blog-7763117497297224225.post-85090174332578230492012-04-20T10:55:25.687-07:002012-04-20T10:55:25.687-07:00Hi
I'm not having much luck, the project look...Hi<br /><br />I'm not having much luck, the project looked so great I went out and bought all the kit. I soldered the components together, loaded the firmware, started python all this seems to work but I cannot get my dcc train to move?<br /><br />I know that the DCC train is on address 3, I send the command and I can see the signal go to the ardunio from the on board LED.<br /><br />If I put a normal DC train on the track it moves...<br /><br />If I unplug pin 11 & 12 the DC train stops...<br /><br /><br />Any ideas what the issue could be?GFletchhttps://www.blogger.com/profile/17992839586930146060noreply@blogger.com