Well done Joe! I hadn't realised you were stuck like that. The video I posted above (#4) shows my railbus running automatically, using serial command codes sent to the basestation arduino rather like your code does. But as well as having delays, it waits until hall effect sensors at various places detect where the railbus is along the track, so it can speed up or slow down and stop etc.
Hi Folks, Just a short video of the project: Thanks, Everyone, for the support!!! Take care, Joe. Code: void setup() { Serial.begin(115200); } void loop() { Serial.print("<1>"); // turns track power on delay(10000); //delays 10 seconds Serial.print("<t 1 03 126 1>"); // loco #3, 126 speed fastest (0-126 possible) the last "1" is for forward delay(10000); Serial.print("<t 1 03 16 1>"); // speed 16 slow delay(10000); Serial.print("<t 1 03 70 1>"); // speed 70 medium delay(10000); Serial.print("<t 1 03 0 1>"); // speed zero delay(1000); // delays 1 second Serial.print("<t 1 03 70 0>"); // the last "0" for reverse delay(10000); // delays 10 seconds Serial.print("<t 1 03 0 1>"); // speed zero delay(1000); Serial.print("<t 1 03 70 1>"); // back to forward delay(10000); Serial.print("<t 1 03 0 1>"); // speed zero Serial.print("<0>"); // track power off delay(10000); // delays 10 seconds }
Ok I admit I wasn't getting it, but seeing your code and video now I totally do. You basically now dont need an interface or computer/jmri. You are using it for control (issueing the serial commands) and automation rather than creating DCC packets (which the DCC++ basestation does) Totally get it rather than learning scripts in python/jmri this could indeed be much simpler on a smaller layout for sure.
Have you guys seen these position sensors from Geoff Bunza? Ultra small and cheap. Someone is making these assembled, but ordering the boards and parts in quantities of 3 (minimum circuit board order) is a great option if you want to solder. https://model-railroad-hobbyist.com/node/26133
One of the attractions of writing my own DCC software is that I can do away with using expensive DCC controllers to manage points etc. Spending that much money when all I want to do is control a level crossing is ludicrous. There are far cheaper, non-DCC, Arduino based solutions that I can use.
This YouTube video was listed in an earlier post. Has anybody got it to work as there appears to be errors in the code? When I get it to work I will post my Arduino sketch.
Hi Folks, So I have used this free Android remote control app https://www.roboremo.com and I just discovered that I can just use the DCC++ commands like "<t 1 03 70 1>" from any of the 5 free buttons with the HC-06 Bluetooth module. However, you have to change the baud rate to 115200 on the HC-06 since DCC++ uses 115200. After that, just connect power and Bluetooth TX to RX on the base station. So, all you need is the app, base station, and the Bluetooth module. There is a paid version of that app, but I've never done that it. So not like a full throttle, but a start. Changing the baud rate on the HC-06 took me a while to troubleshoot. I followed this: Hope this can help someone. Take care, Joe.
I downloaded DCC++ to my Arduino Uno and would like to test it running a train. I only have one Arduino and no Pi's, unable to buy extras because of the shutdown. I need to control the train directly from the IDE serial monitor, can you let me know what commands I enter on the serial monitor? Is it the same as what Joe gave a couple of days ago but entered manually? Does not work for me. Serial.print("<1>"); // turns track power on Serial.print("<t 1 03 126 1>"); // loco #3, 126 speed fastest (0-126 possible) the last "1" is for forward Serial.print("<t 1 03 16 1>"); // speed 16 slow
Hi Robert, Do you have the baud rate of the serial monitor set to 115200? What motor shield are you using? Hope this helps! Take care, Joe. (edit) P.S. Yes, the commands are the same, just remove the quotation marks. J.
yes and in my opinon an even better option linked below as you can control setting and sensitivity through software rather than hardware pieces. http://trainelectronics.com/Crossing_Signal_sensor/DifferentialDetector/ Arduino on bottom of page. I have done this on a ATTiny85 as well once I tested it on an UNO. TIny program so can go on any version (UNo, nan, micro, attiny, etc)
Thanks Joey. Bit late for me to think about this tonight, I probably left the quotation marks in. I am using an Arduino motor shield, and the baud rate is set to 115200. Let you know in the morning.
Robert, here is the best link for the codes from FlightRisk: https://github.com/DccPlusPlus/BaseStation/wiki/Commands-for-DCCpp-BaseStation
Hi Keith, I know BASIC Plus, never learned Python, getting better with Arduino code. I am most fond of the Picaxe since it's like the old Timex/Sinclair 1000's BASIC code. I used to use an I/O board with the T/S1000. Loved it. Take care, Joe.
The commands seem to work just looking at the lights on the Arduino, the train does not move though. The DCC decoder in my train I am not sure if it is working, I have not run it before. With the shops shut there is not much I can do. I have a spare DCC decoder that will not fit into my train that I will test on my bench when I get time. How is your setup going?