Replacing (hardware) Serial with Software serial. I am looking to drive the Base station (on an arduino uno) from an arduino mega - using software serial to send commands to the BaseStation. Can the base station cope? Or will the software serial compromise (the timing) of the Base station's basic DCC operation? Thank-you
An interesting arrangement, but why? Mega has 4 sets of hardware UARTS. An Uno Base Station can be sent commands either on the USB TTL interface, or direct to pins 0 and 1. What whizz bang idea do you have that would need to involve the addition of Software Serial?
OK thank-you for your question, here goes. I am using the Mega as a autonomous interrupt driven DCC command generator, (driving a DCC++ controlled shunting yard with automatic coupling (TCCS)) using hall effect sensors (activated as required) to signal the completion of a DCC command. Just one active loco running at a time. The Mega also hosts an adafruit capacitive touch screen to set up the parameters for a run, and to act a simple 'handheld' controller, to recover from 'crashes'. The mega uses the hardware serial to display information (mainly for debug) on the Mac (running the Arduino IDE), and to echo the returned messages from the DCC++ base station. Could I connect the Uno Base station to a second PC, and run hardware serial connections (uno to PC, mega to Mac, uno to mega)? The DCC++ load is minimal, so I don't think I will have a problem - but then never make assumptions! Hope that makes sense! Thank-you
Hello Steve, Yes indeed - BUT pins 14,15,16 are all blocked by the shield I use to mount the TouchScreen, and I have to use 2,3,18 and 19 for Interrupts The touch screen uses 20,21. So software serial looked to be the only answer - unless I design a software controlled piece of hardware to switch interrupt lines - which is out of my competence, I am already having to use the Uno (Base Station) to catch one (emergency stop) interrupt line - I just cant lose two more interrupt lines. Thank-you
So 14 and 15 are just blocked access, by the shield that is above them? In other words you can't get a standard jumper lead into the header? Could you get that access with some ordinary single core wire perhaps? Could the shield be modified in any way to gain better access? Failing all that, Software Serial is an easy library to set up and use. You should be able to cover all bases for data display from the Mega, a 'serial data exchange' is easy enough to write into your Mega source code. Many variations on this simple theme, example would run in loop()... Code: while (SoftSerial.available()) { Serial.write(SoftSerial.read()) ; } Edit: Just a thought, but maybe you could use polling to catch your pin state changes. Then there are no restrictions on which pins you use. And you can use a lot more
Yes using software serial is not a problem - my question was about the software serial overhead (using change level interrupts) impacting the DCC output from the Uno. Thank-you
Must have missed something, are Uno pins 0 and 1 not accessible? Providing you don't want to use the USB interface on Uno at the same time, where would Software Serial fit in on the Uno side? It does not need to be both sides of the connection to work.
Now I am confused! The uno (running dcc++ base station) is to be connected to the mega - and all serial I/O will be to the mega. So the uno will not be using hardware serial, and I plan to edit the dcc software to use software serial instead of hardware serial using whatever uno pins are appropriate. The issue is that I do not have access to the pins required to support hardware serial on the mega - the problem on the uno is not the pins but the potential overhead from using software serial
No problem then, Uno stays as is and uses hardware serial pins 0 and 1, connected to Mega's Software Serial pins of your choice
Brilliant, I had not realised that I can use Hardware serial to connect to a software serial. Thank-you for your help, much appreciated
Yes indeed, it had started to dawn on me, that that was the bit you didn't get Make sure all baud rates are matching, and the service is called at setup, you should be connected in no time. Have fun, will you be showcasing sometime on here? Regards Steve.
Gregg, is there a provision to send switch commands through DCC++? I am running a DCC Monitor on the DCC out, I am seeing nothing when sending switch commands through JMRI. I have 3 DCC++ CS's running fine. Getting the ability to throw solenoid switches would be nice. I do have 2 separate solutions on my table. The first goes up to 16 switches, the other will do up to 256 switches. Thanks!! Jay
Hi All, Let's say I want to use an Arduino Mega with a Pololu MC33926 motor shield and I want both outputs to be Mains - no Programming tracks required - also I don't want this to be a software solution. How would I need to arrange the jumpers to achieve this result? Thanks! David
An easy solution is to stack another motor driver board on top. I've hears of this being done on the DCC++ Facebook forum.
Yes, but to stack another without jumper mods would provide two mains and two progs. Thanks for the reply. David
Gregg, New to DCC++. Question, how do you design your own layout to use on DCC++. Do you use Processing or is there another way Craig
Not exactly sure I understand the question. Fundamentally DCC++ is just another system (like a NCE, MRC, Digitrax, etc) to power the track with a DCC signal. So really no specific concerns with DCC++ than with any DCC system. You will need some type of computer to run JRMI (or do some research around creating your own controller) but fundamentally nothing special about it that you need to take into account on the layout.
Gregg, I have an ESU DCC controller. My question wasn't very clear, I'm sorry. I was thinking of using DCC++ to control switches etc. but not loco's, so a separate DCC system for trackwork etc. using DCC++. I have set up the Arduino, no problems, and have installed "Processing" and run your controller software, that works fine as well. I now need to replace your track layout with my own and was wondering if there was any instructions/videos on how to do this. The DCC++ videos on youtube suggest there is another set of videos to show how to do this. I cannot find them or should I learn Processing (another language to learn). Any advice? Craig