Geoff Bunza geoffb

Because of the interest in this project (Details can be found here: https://forum.mrhmag.com/post/sma12-17-channel-configurable-multifunction-5-dcc-decoder-for-servos-12198051 ) more example decoder variations have been added and some start up timing problems have been fixed. The new libraries and examples can be downloaded from here (Updated November 26, 2016):

http://mrhpub.com/files/users/geoffbfiles/new-dual-multifunction-decoderv5_4.zip

Please see:

SMA20 New Low Cost 17 Channel DCC Decoders & Dual Motor,LED, & Servo Control Updated: 6 Ftns/Pin & New Features
for the latest update information.

Installation is the same as described previously. Delete your previous version, replace it with the new one, and load in onto your decoder. Below is a brief description of how I’ve built my new boards followed by a detailed working example for a 7 servo 10 LED configuration that may help people configure their own versions for their particular modeling needs. Also, now check the fourth comment page for the accessory decoder version.  Have at it!

Decoder.jpg 

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
banax

Finnaly I found time to test the solution.

It almost worked, I had to change +5V on above schema to 12V just after the RECTIFIER BRIDGE (to drain current from dcc line more directly). I had also change 68om to 47om (just because I have no proper resistor, and 47+22 was to much).  Of course first test were with +5V, but without success. I've also used BC547C transistor and it works fine with changes I've made. The first success I had was with my own circuit with L293D and after that an analog locomotive draining 12V from dcc track. However solution without loco is of course better .

Changes to source code (I used AccDec_17LED_6Ftn): 
(Line 26) int numfpins = 16;
(Before setup) source code from Geoff (3 posts above) added with const int DccAckPin = A5;
(In setup end) initialize A5 for output and set it to LOW.
Uncomment line 9: #define DECODER_LOADED before second code upload.

No more changes were needed. Now I have one output pin less (hence one function less), but can normally program the decoder and read all the stored values (in programming mode). At least it works fine with dcc++ command station JMRI.

Thank you once again Geoff for your help,

Wojtek

Reply 0
barlowp

17 servo decoder

I want to compile the 17 servo software and upload it to my Arduino Nano but it will not compile. I have SoftwareServo in my library list marked as installed, but even if I only add    #include < SoftwareServo.h>   to a new script and try to check and compile the file it will not do it and comes up with "error compiling for Arduino Nano". So all I have is the file below and it will not compile.  This is all new to me and I am baffled.

#include < SoftwareServo.h>

 

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

 

 

 

Reply 0
Jim at BSME

Errors & Thread

@barlowp, first I recommend a couple things, try to compile the basic blink sketch to make sure your enviroment is setup correctly. See File -> Examples -> 01.Basics -> Blink. This sketch should compile and upload to the nano and if there is a LED onboard the nano connected to pin 13 it will blink.

If this doesn't work you can get all the error message by clicking the Copy error messages button, should be just above the error window on the right. The error messages are then in the windows clipboard, and you can paste to a file or here directly in a post, if you are running the arduino compiler on the same computer you use to read this forum.

You may also want to review this article and thread: https://forum.mrhmag.com/magazine-feedback-was-ezines-891776, as it sounds like you have an environment setup issue.

Geoff prefers responses to the thread here as this thread is really out of date:

SMA20 New Low Cost 17 Channel DCC Decoders & Dual Motor,LED, & Servo Control Updated: 6 Ftns/Pin & New Features   http://model-railroad-hobbyist.com/node/24316 for the latest up to date information.

- Jim B.
Baltimore Society of Model Engineers, Estd. 1932
O & HO Scale model railroading
Check out BSME on: Facebook, Instagram
Reply 0
barlowp

17 channel DCC decoder compiling solved

Hi Jim,

Thanks for the quick reply. I found the problem. The SoftwareServo library has a line "include < WProgram.h> " within it which worked with older IDE's but not new ones so I edited the SoftwareServo library on my PC and changed that line to the new one which is "include < Arduino.h> " now compiles no problem. My Arduino IDE is 1.8.5 I am not sure which versions require the change. Many thanks.

Reply 0
barlowp

Hi Jim, Thanks for the quick

Hi Jim,

Thanks for the quick reply. I found the problem. The SoftwareServo library has a line "include < WProgram.h> " within it which worked with older IDE's but not new ones so I edited the SoftwareServo library on my PC and changed that line to the new one which is "include < Arduino.h> " now compiles no problem. My Arduino IDE is 1.8.5 I am not sure which versions require the change.

Reply 0
dpondaco

Changing CV values

Hello Geoff hope al is well, Happy New Year!

This post seems to be related to an issue I am having with the decoder.  It appears that from all I have read the CV values can be changed via the Dcc Controller.  If this is incorrect we can stop now my question is moot.  Anyway assuming I am correct and the CV values can be changed via the controller, when I change a CV,  for example CV 33 which should have a value of 140 after loading, to say 150 and I read back the CV value I get 33.  No matter which CV I read all I get back for CV value is the CV number.  Hope this makes sense.s  BTW I am using a MRC Prodigy Wireless throttle/controller.  Everything else works great, I am just trying to adjust the servo intial start and movement positions.

Reply 0
Geoff Bunza geoffb

@dpondaco re:Changing CV Values

Hi dpondaco  (name?).

First, this article/post has been super ceded by: SMA20 Low Cost 17 Channel DCC Decoders Ver 6.01 with Sound,Triggered Sound,Stepper,Dual Motor,LED and Servo Control
https://forum.mrhmag.com/post/sma20-low-cost-17-channel-dcc-decoders-ver-6-01-with-soundtriggered-soundstepperdual-motorled-and-12201920  check for updates and make future comments there, please.

Quote:

It appears that from all I have read the CV values can be changed via the Dcc Controller.

Correct. With 2 conditions: 1. It will only respond to Ops Mode Programming not Service mode programming. and 2. You must follow the directions in the in the sketch (now included in the SMA20 article):

CV's can be changed with Ops Mode Programming with the address specified in the decoder, default in the examples is address 24. Note again that the Accessory decoders have dual addresses, one for the Accessory switches (default 40)and one to set up the CV's (default 24). But remember, that after the first power up of the decoder you need to REMOVE THE "//" as in the decoder lines;

// ******** UNLESS YOU WANT ALL CV'S RESET UPON EVERY POWER UP
// ******** AFTER THE INITIAL DECODER LOAD REMOVE THE "//" IN THE FOLOWING LINE!!
//#define DECODER_LOADED

Now after the reloading and second power-up when you modify the CV's they will stay modified in EEPROM  even after power cycling.  There are some CV's that once reset via Ops Mode will require power cycling to take effect -- like changing a function pin from LED control to servo, because the software in the Pro Mini needs to initialize the libraries correctly. This is a known limitation.

Quote:

No matter which CV I read all I get back for CV value is the CV number.

Sorry, but these decoders, as do most decoders, do not allow reading CV values in Ops Mode Programming mode, and service mode programming is not supported.

'Hope this helps. Have fun! 
Best regards,
Geoff Bunza

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
Reply