Hi Robert I tested your sketch and although IN the diagnosis ( MOnitor serial ) has not submitted the same as the original DCC ++, it worked well with the One. I rewrote the pinout for 3 accelerators (A1, A2, A3) - 3 directions (2,3,4) and 3 stops. (6,7,8) This is a good opportunity for those who are starting now in Dcc and has few locos with decoders installed. You configure the locos addresses with 3, 4 and 5 and can run 3 locos at the same time JB
Of course you store 4 loco addresses in that array, but when I uploaded it, I only had two, now they're three. Still waiting for a shunter!
Hi Robert I think I dont explain very well... I said 3 locos because I am using Arduino Uno and Uno dont have so much pins like Mega
Without trying to find exactly what you modified, just exactly what did you do to reduce the footprint, and to which files? You see that there are others with someminor modifications that need to incorporate various changes but not just take the total of your code so their changes are preserved. BTW, I've gotten the code to compile for an Arduino NANO, but haven't tested it yet....when it's tested as functional, I'll [post the exact changes here, so others can do the same if they wish to.....
LED layout lighting question. I am not sure if this si the right place for it. I stumbled upon this after working on my Father's layout. I wanted to find a better way of controlling his turnouts on an O-scale layout. This look to be perfect. In the meantime, however, I want to get my little Z-scale layout running DCC via DCC++. It seems to be exactly what I want right down to the lighting. Mega, Motor shield and LS150s are on order. I am wondering about the LED lights that were used for the layout. 12 V DC like what you find on ebay? Does that mean I should power the Mega at 12 V to make this work right? Thanks for the help. What an awesome community!!! Doug
The Mega will take 12v, but it's regulated down to 5v on board the Mega. I'm not sure what kind of voltage Z scale takes, but on my HO layout I used 16v to power my track. There is a trace that I had to cut on my motor shield to prevent the 18v from going to the Arduino. I'm sure you could power the Arduino and the LED's from the same 12v power supply if you have enough current. You just have to use a transistor to use the 5v Arduino pin to control the 12v led's.
CURRENT_SAMPLE_MAX Does the constant CURRENT_SAMPLE_MAX have a direct relationship to amps? Does 300 mean 300 Milli amps, 0.3A?
it directly relates to the 10-bit ADC sample number (0 to 1023). there is some math needed to convert to amps, but that depends on exactly how your setup senses current. ~Travis
the VIN pin on the arduino board can take a max of 20Vdc, but the regulator will heat up quite a bit. my recommendation is to get a DC-to-DC step down converter, like this: http://www.ebay.com/itm/DC-12V-24V-...ulator-Module-Voltage-Converter-/331822809979 I use them myself, and they take up to 24Vdc input. the output can power the Arduino to the 5V bus directly. ~Travis
Thank you, now i understand the range of the global CURRENT_SAMPLE_MAX. It is sufficient information I can research, learn about the ADC sampling, and experiment to at least roughly correlate the actual amps to the cut-off max value. Arduino is all new to me. It is tremendous fun to finally learn to make a micro-controller affect the real world.
Can I connect the power supply to the Ardiuno board instead of the motor shield? I can see the power on when I applied the power from the Controller, but I can not seem to move the loco unless I connect the power source the the motor shield. My power supply is 12V 5A Thanks!
the motor shield needs power. your Arduino can get power from the USB connection. unless like me, you are running the DCC++ via a network connection, in which case, the Arduino needs 5V power, like i mentioned in post #1510. ~Travis
That's the way it's supposed to work, but there was a bug in the implementation of the JMRI interface, which has been fixed in the test release 4.5.6. Yes, you can write and read on the programming track.
I tried the "WRITE" with DCC++ 's own Controller with the Programming menu, it also returned error. Or is there a different way to write in DCC++ controller? THanks!
from the DCC++ controller, the error message was: "Writing Second Byte of Long Address Failed". here is the screen capture while trying to change the long address from 5752 to 5753 I have also written a small java program and attempted to write to CV17 and CV18, and also got the error, here is the log trace: 2016-11-15 23:51:18,528 INFO > [dcc] getPort<212> name: /dev/tty.usbmodem1431 2016-11-15 23:51:19,461 DEBUG> [dcc] serialEvent<172> recv response: <iDCC++ BASE STATION FOR ARDUINO MEGA / ARDUINO MOTOR SHIELD: V-1.2.1+ / Nov 13 2016 23:49:39> 2016-11-15 23:51:19,462 DEBUG> [dcc] serialEvent<172> recv response: <N0: SERIAL> 2016-11-15 23:51:19,557 TRACE> [dcc] doCall<193> power on <1> 2016-11-15 23:51:19,563 DEBUG> [dcc] serialEvent<172> recv response: <p1> 2016-11-15 23:51:20,563 TRACE> [dcc] doCall<193> reading CV1 <R1 1 1> 2016-11-15 23:51:21,780 DEBUG> [dcc] serialEvent<172> recv response: <r1|1|1 3> 0x00000003 00000011 2016-11-15 23:51:22,568 TRACE> [dcc] doCall<193> write CV17 with 214 0xD6 <W17 214 17 17> 2016-11-15 23:51:22,868 DEBUG> [dcc] serialEvent<172> recv response: <r17|17|17 214> 0x000000D6 11010110 2016-11-15 23:51:27,573 TRACE> [dcc] doCall<193> write CV18 with 121 0x79 <W18 121 18 18> 2016-11-15 23:51:27,877 DEBUG> [dcc] serialEvent<172> recv response: <r18|18|18 -1>
Sorry, can't help with anything beyond JMRI.......never used the code you're using, and certainly not your custom code. Does it work with plain JMRI??? That'd be a good starting point.