Jump to content
 

Project - Tinkering with DCC++ , finally resulting in a DCC++ Bluetooth connected CommandStation


Recommended Posts

Background to my DCC++ Project

 

Like a lot of modellers, I have been intrigued for some time by the DCC++ Project started by Greg E. Bermann.  He had the idea of creating a DCC Controller based on an Arduino Uno (also Mega) and easily obtainable motor controllers with the aim of providing a cheaper option for modellers with basic electronics skills.

 

Videos explaining the principles of DCC signalling and his Arduino based system are available to view on YouTube providing an excellent tutorial on the fundamentals of DCC and how to achieve DCC control with basic hardware. In my opinion, the four videos are well worth a watch and the first in the series of 4 videos can be found at...

 

 

 

So around 2 years BC (Before Covid) I built my first DCC++ prototype just to see what it was capable of and I was impressed with the result! To be fair, this was my first foray into DCC control, so I had nothing to compare this system with. However, considering the DCC++ project was aimed at inexperienced people like myself, I was very happy with what it offered, it was reliable and I could not see any immediate reason to try commercial offerings at a much higher price.

 

My early builds were fragile pieces of equipment, without a proper enclosure and wires hanging off! (Sadly I have no pictures of my early attempts). 

 

Luckily nothing ever shorted resulting in magic smoke, but I decided that a more durable solution was required but time passed, and the Mk1 DCC 'frankencontroller' was put away for another day awaiting a block of revisiting time.

 

Enter Covid - resulting in a chance to revisit the world of DCC++

 

In the meantime, the project had moved on and a new team had taken up the reins from where Greg E. Bermann left off. According to the official DCC++ Website, a core team of developers decided that they would build on Greg's work but the next iteration of the software would involve major re-writes. For those unfamiliar with the new DCC++ Ex project, details can be found at...

 

https://dcc-ex.com/index.html

 

So, after catching up on the changes and liking where this project was heading, I decided to cannibalise my old DCC 'frankencontroller' and repurpose the parts for a Mega2560 based DCC++ Ex 

 

To be continued in my next post... 


A detailed how-to for this project can be found at https://railsnail.uk/dcc-ex-bluetooth/

Edited by Railsnail
Add a link to project how-to details
  • Like 1
Link to post
Share on other sites

Tinkering With DCC++ Ex

 

Having robbed my older DCC hardware for parts I decided to build my first USB version of the DCC++ Ex project. 

 

In my opinion, the original DCC++ project had suffered from a lack of documentation. Information could be found, but it sometimes took a little finding. In fairness, the four series YouTube videos referred to above gave a very good start on building a system and the original software worked without any issues (for me), but I always thought the project needed something better in the way of documentation,

 

The new DCC++ Ex project appeared to be the answer to that, so within a short time, with the help of the build guides on their website, I had a new bare-bones system running the new code-base. All seemed well. I could control my DCC locos just as I did with the original code/hardware.

 

This still left the main issue though of making my system look more than a heap of electronic modules and wires, also I wanted to try making a WiFi connected version of this project. So I had two immediate items on my to-do list. The first was easy. Just buy a suitable box to house the electronics.

 

The second; build a WiFi variant, would require additional or different hardware as the Arduino Mega2560 does not support WiFi. It has a USB port for communication.

 

The DCC++ website recommends a variant of the Mega2560 microcontroller with an additional onboard ESP8266 microcontroller that supports WiFi. See https://dcc-ex.com/advanced-setup/supported-microcontrollers/wifi-mega.html

 

This combined Arduino + ESP8266 board would still allow the easy attachment of a motor board (to drive the tracks) and would effectively give WiFi access to the Arduino.

 

The DCC++ Documentation discusses using two power supplies for their system. One for the DCC Power/Control and the other lower voltage power supply for the logic boards.

 

I did not want to go down the route of two power supplies, so decided on using one higher voltage DC supply that could provide power to the tracks (locos) and it would also provide power for the logic boards via, a Buck Converter (basically a DC voltage step down device).

 

Three DC power plug/sockets. One for the DC input (from the power supply) and two outputs for the Program and Main track circuits plus some coloured LEDs produced this...555549234_DCCWiFiPrototype.jpg.55b606e46335154f7174cb079b5b6c05.jpg

 

The Arduino Mega2560/ESP8266 module is under the L298 Motor Shield. The LM2596 Buck converter can be seen alongside the motor shield/Mega2560. A USB cable can be seen temporarily attached to the Mega, allowing me to program it from my laptop. Hot glue keeps everything nicely stuck down and in its place!

 

Holes were drilled for 3 sockets and 3 LEDs. One socket for power from a 15V DC/3A power supply, the other two sockets are outputs to the Programming Track and Main Track. 

 

LEDs indicate DC power on and Main/Programming track power.

 

 

To be continued... (WiFi - change hardware)

 

 

 

Edited by Railsnail
Re-attach image
  • Like 2
Link to post
Share on other sites

WiFi - Combined Mega/ESP8266 or discrete Modules?

 

As already mentioned, the choice of the combined Mega2560/ESP8266 controller module seemed like the logical choice for a WiFi version of this project, however, in practice this module has two drawbacks both relating to2116028609_Mega2560__Wi-Fi.jpg.90b580c8936083a73b970b5bf812e56d.jpg switch type and their positions.

 

In order to program the Mega and ESP8266 and link their serial data pins, two switches are provided. One slider switch and the other, a dual-in-line package switch with tiny sliders (circled in red in the picture). In use, the DIL slider switches are fiddly and quite fragile. I guess they are supposed to be set a few times during programming, then left alone. They are also located roughly in the centre of the module, meaning that they are impossible to access with the Arduino motor shield attached to the top of  it.

 

 

For those reasons, I decided to proceed with discrete Mega2560 and ESP8266 modules (the ESP-01 to be precise) and to ditch the combined board shown.ESP8266plusAdapter.png.992840250b6a34d2248831ca9cc719e1.png

 

The decision to proceed with discrete modules had a slight issue in that the ESP-01 module has 3.3V compatible TX/RX data pins whereas the Mega's TX/RX UART pins are 5V compatible.

 

This raised a problem with the 8266's RX Data input requiring some sort of voltage divider requiring further hardware. 

 

This could be solved fairly easily though with the use of a 'level converter' addatper (sic) designed for ESP-01 modules (circled red in picture).

 

Power (Red/Blue) and Data (Yellow/Green) 'flying leads were soldered to the adaptor's connecter so that they could be plugged into the Mega's Power/Data connector later

 

 

 

To be continued... 

 

 

Edited by Railsnail
Re-attach images
  • Like 1
Link to post
Share on other sites

3D Printed Enclosure

 

As mentioned, I wanted this project to have a half decent enclosure rather than use an off-the-shelf box.   This was when my newly acquired 3D printer came in really useful.

 

I rather optimistically thought that this would be the easiest and quickest stage of the whole project. But I hadn't thought through the CAD part of designing what is just a box with holes and a lid! The actual printing stage is quite easy, albeit slow, with the printer doing all of the work.

 

Anyhow, after much watching of CAD tutorials and even more trial and error, not to mention failed prototypes, I finally arrived at my finished enclosure.

 

It was printed in 3 stages. The main enclosure, the lid and finally a small 'guide' tube that links the lid to the RESET button on the Arduino Motor Shield. This would allow the controller to be reset without having to pull the power by simply inserting a longish thin reset device cocktail stick into the reset hole on the top of the controller 😉

 

Box.png.ed76a9160394c200cc5843859c804c3b.pngtube.png.37961e6dbd9d0969d3e122ff9333a02f.png           lid.png.7fd2ea233ce559164e83500be853a9da.png

 

This is what the CAD looked like...

 

 

Next - Wire it all together and provide sockets/LEDs

 

 

Edited by Railsnail
Re-attach images
  • Like 1
Link to post
Share on other sites

Wiring, sockets and LED's

 

I made the decision fairly early on in the project to connect the various modules together with small plugs and sockets. 

 

JST-PH 2.0 to be exact.

 

I could have just permanently wired the modules together, but my preference was to be able to build/solder all of the parts with cables and plugs, then connect everything together during final assembly. The cost of plugs/sockets was fairly insignificant in the overall scheme of things.

 

Of course some thought had to given to connecting the wrong plugs to the wrong sockets, but a careful choice of cabling has hopefully minimised this although the final socket combination is not fool proof.

 

Also, two different sizes of DC sockets were used. DC Power in being 5.5mm x 2.1mm

and PROG Track/MAIN Track output sockets being 5.5mm x  2.5mm

 

That choice of socket size should prevent connecting the DC PSU to either of the track outputs resulting in magic smoke!

 

 

The Buck Converter

 

In order to power the logic circuitry from a single 15V DC supply, a Buck converter is used to reduce +15V to around +7.5V to power the Arduino Mega. (The Mega2560 has its own regulators for +5V and 3.3V). The Buck converter is secured to the lid with double sided sticky pads and glue on the 3D printed standoffs. The unit was designed so that there is enough clearance so that the Buck Converter could not short out on the Motor Driver module.1135646470_lidbuckresettube.png.e7d9f99e070a529be4aee7637633381f.png

 

The Buck converter's DC output voltage was set to around +7.5V BEFORE connecting up the Arduino Module as I found that the Buck Converters I had purchased all came with the output trimmer potentiometer set to maximum voltage out!  :o

 

The picture shows the Buck Converter mounted on the enclosure lid. The red LED indicates that the unit is powered. The blue component is the Buck voltage output trimmer.

 

 

 

 

Next... final assembly

Edited by Railsnail
  • Like 1
Link to post
Share on other sites

Final Assembly...

ComponentParts.png.d4d5edadfd91e401b06e75d59d2a6001.png

Now that cables had been cut to length, soldered onto the modules. Sockets/LED's wired and sleeved and all documented of course 😉

 

It was now time to put all of the pieces together. 

 

(The picture (right) shows my early prototype Bluetooth controller ready to be assembled. The Buck converter had already been adjusted to +7.5V output).

 

 

 

 

 

Assembled.jpg.a90618036440d16bba974d4190b2af04.jpgAn assembled Wifi Version Controller. 

 

 

To complete the unit, I decided to make some short 'pigtail' PROGRAM and TRACK cables that plugged into the 5.5mm x 2.5mm DC sockets and terminated in 'click' type connectors. This would allow the output of the controller to connect to the wiring from the MAIN and PROGRAM tracks.

 

And this was the final system...

 

CompletedSystem.png.f471c55685ecb917ed4ca3c15fe5a6bd.png

 

 

 

Next... Bluetooth variant

Edited by Railsnail
  • Like 1
  • Craftsmanship/clever 3
Link to post
Share on other sites

Bluetooth Interface Option

 

So, having explored a USB and WiFi connected controller, I next considered Bluetooth.

 

Some years ago, I had experimented with Bluetooth modules available in their droves on eBay for an industrial robot application. They were readily available and advertised as HC-05 and HC-06 modules. They looked similar, but the HC-05 could be used as a master or slave device, while the HC-06 was slave only. Both would offer the functionality I was looking for, but I decided to experiment with the HC-05 as it was a very similar price to the HC-06, but offered both master and slave functions.

 

I soon discovered after breadboarding a few of these, that although they were all sold as HC-05's, they often differed in the way they are programmed.

 

These modules require some sort of setup to set their broadcast Bluetooth ID and pairing PIN. Also, their data communications speed requires setting, usually just the once for most applications. This is achieved by putting them into 'AT' programming mode, but more of that later,

 

Setting these in 'AT' mode is where many of the HC-05's varied due to Chinese manufacturers using slightly different firmware. There are many websites that have delved into the various variants of these modules, but the best in my opinion is Martyn Currey's website where he discusses the different variants at http://www.martyncurrey.com/category/bluetooth/

 

Anyhow,  back to the project. BluetoothLevelConverter.png.34270f171d82cce019c4202e079f7063.png

 

Given what I had  discovered a few years ago and having caught up on Martyn's discussions on his site, I decided to go with the HC-05. The 'Older' variant as some eBay sellers describe these to be exact. It's worth noting that there is also a cheaper Bluetooth module known as the JDY-31 variant. Do not try these if you are thinking of building one of these controllers! 

 

The HC-05 can be powered from +5V DC, so it could be easily hooked up to the Arduino Mega +5V rail with flying leads. The HC-05 data pins however are 3.3V compatible NOT 5V, so the Receive Data (RXD) input of the HC-05 cannot tolerate the Transmit Data (TXD) output from the Mega2560. 

 

Some sources on the Internet say this may be ignored, and that they have got away with driving the RXD pin directly from the TXD of the Mega2560. I say good for them, but the proper way to drive the RXD on the HC-05 is to convert the high level output voltage from the Mega2560 to a level that can be tolerated by the HC-05. The simplest solution for this is a simple potential divider comprising two resistors.

 

These can be seen soldered to a small piece of prototype board, then attached to the HC-05 Bluetooth module in the picture. The 4 wires are Power (Red/Blue) and Data signals (Green/Yellow). These are the two flying leads that connect to the Mega2560 module.

 

 

Programming the HC-05

 

This now left programming the HC-05 in 'AT' programming mode so that the module had the correct communication Baud rate (115200) and a sensible Bluetooth name.

 

I decided that one way of programming the Bluetooth module was by creating a simple Arduino sketch that would allow the module to be set up. An alternative would have been to connect the module to a cheap USB to UART module , but why bother when I had the Mega2560 and had built the Bluetooth 'level converter' board allowing me to connect the HC-05 directly to one of the Mega's UARTs using the flying leads.

 

After all, the HC-05 setup was after all a one-off process, after which the HC-05 would be left connected to the Mega2560 TX0/RX0 data ports.

 

(The sketch referred to above and the programming process can be found in greater detail on my site at https://railsnail.uk/dcc-ex-bluetooth/ )

 

So, after setting up the HC-05 Bluetooth parameters the module with its level converter was secured into the enclosure and then tested to ensure that a host (PC/Tablet/Phone) could connect and control the DCC++ CommandStation.

 

Testing was carried out by setting up a Bluetooth COM port on my Bluetooth enable laptop and testing using JMRI software. I also tested using an Android App named DCCpp CAB available from the Google Play Store.

 

Bluetooth range is perfectly adequate given that I want to be in the the same room as my layout, not at the end of my garden!

 

 

Conclusion

 

In conclusion I am very happy with my suite of DCC++ controllers.  I wish I had taken pictures of the original DCC++ bare module and wires 'lash-up' from a few years back now. It would be funny to see the original next to my latest offering in its 3D enclosure.

 

I would strongly recommend anyone with some basic soldering and mechanical skills to have a go at this. A 3D printed enclosure is not essential as earlier pictures of my DCC++ Ex controller in a commercially available box shows. However, I really enjoyed designing my enclosure. I learned a lot about basic CAD and I'm very pleased with the result. 

 

The bottom line is that it is possible to build a fully functional standards compliant controller for a lot less than the price of a sound decoder! 

 

 

 

 

 

 

 

Edited by Railsnail
  • Like 1
Link to post
Share on other sites

Interesting thread, thanks for posting it.   There are a few things where your experiments have given answers to questions I had in my head - notably the buck-converter for single power supply. 

 

I doubt I'll go down the WiFi or Bluetooth options - USB seems fine to a computer, and that computer could be a RaspberryPI, so its small and could fit inside the main box.  

 

 

- Nigel  (used to live in Suffolk, so Mid-Suffolk Light Railway was known.  But now hundreds of miles away )

Link to post
Share on other sites

1 hour ago, Nigelcliffe said:

Interesting thread, thanks for posting it.   There are a few things where your experiments have given answers to questions I had in my head - notably the buck-converter for single power supply. 

 

I doubt I'll go down the WiFi or Bluetooth options - USB seems fine to a computer, and that computer could be a RaspberryPI, so its small and could fit inside the main box.  

 

 

- Nigel  (used to live in Suffolk, so Mid-Suffolk Light Railway was known.  But now hundreds of miles away )

 

Thanks Nigel for the feedback. I really enjoyed working on this project and learned a lot as it progressed.

 

I take your point regarding going down the USB route. A RaspberryPi (maybe running JMRI) would go well with this. Plus it would give remote access (to the Pi) via WiFi and remote terminal like VNC.

 

I have experimented with just that solution and it works well, however I didn't want to dedicate a RPi to that one task.

 

The buck-converter works well for making a single PSU system. The module barely gets warm, but any heat is catered for by the ventilation slots in the enclosure lid. My earlier system in the fully enclosed larger enclosure never suffered with overheating despite the lack of ventilation.

  • Like 1
Link to post
Share on other sites

Attach Controller to Underside of Baseboards etc

 

I have received feedback from a friend testing the controller asking if it would be possible to modify the enclosure so that it could be screwed underneath a baseboard or on a vertical surface for that matter.

 

I didn't want to alter the enclosure so I have 3D printed a bracket that attaches to the vents on the underside of the enclosure. (Like those mobile phone holders that attach to the air vents in cars).

 

So this is what it looks like - and with the bracket attached...

 

The bracket along with the original sticky feet allows air to circulate under the unit .

WithBracket.png.3740e64f35fd09bdc3bb1c7202988169.pngWithBracketBase.png.7277ed165e82cdf4529c79339487e237.png

 

 

Edited by Railsnail
  • Like 1
Link to post
Share on other sites

On 08/10/2021 at 15:43, Railsnail said:

I have experimented with just that solution and it works well, however I didn't want to dedicate a RPi to that one task.

One possibility in that direction is to use a Raspberry Pi Zero, or Pi Zero W. The Pi Zero is only £4.80 and the Pi Zero W is £9.30. These are only 65mm x 30mm.

 

Pi Zero has USB connectivity only, while Pi Zero W adds WiFi & Bluetooth.

 

e.g. https://thepihut.com/products/raspberry-pi-zero-w

 

At this price and size, dedicating the Pi to a single task is no issue, IMO.

 

One other thought is driving a Motor HAT directly from the Pi without an Arduino...

 

Yours,  Mike.

Link to post
Share on other sites

1 hour ago, KingEdwardII said:

One possibility in that direction is to use a Raspberry Pi Zero, or Pi Zero W. The Pi Zero is only £4.80 and the Pi Zero W is £9.30. These are only 65mm x 30mm.

Yes, I have used the Pi Zero W on a standalone Zigbee heating controller project of mine and they are great devices at the right price. I see that availability of the W variant has improved  following general shortages of silicon worldwide.

 

As far as driving a motor HAT direct from a Pi -  I have seen some progress on some code for this. I guess it's early days and will take a while before it matures to the level of the current DCC++ Ex project.

Link to post
Share on other sites

  • 3 weeks later...
  • RMweb Gold

Interesting thread and to an extent mirrors my own recent experiments building a DCC++ EX Command Station with WiFi interface although I've made do with a neat installation in a commercial box for the command station.     3D printing is a project for another day (or more likely, another year). 

 

As my control requirements are very specific I've been looking at an own design Arduino based hand controller (see my thread, which I really must update, if interested) but have had a huge issue getting the ESP 01 modules to work reliably and continuously.  

 

In the end I've resorted to ditching the AT based interface and writing new code for flashing into the ESP01 via the Arduino IDE which seemed quite scary concept before I'd done it but was, in the event, remarkably simple.    The interface is now much more reliable.

 

Alan

Link to post
Share on other sites

2 hours ago, PupCam said:

... I've been looking at an own design Arduino based hand controller (see my thread, which I really must update, if interested) but have had a huge issue getting the ESP 01 modules to work reliably and continuously.  

 

In the end I've resorted to ditching the AT based interface and writing new code for flashing into the ESP01 via the Arduino IDE which seemed quite scary concept before I'd done it but was, in the event, remarkably simple.    The interface is now much more reliable.

 

Alan

 

Hi Alan,

 

I'll check out your hand controller thread. That's something that interests me as I am not really a fan of GUI 'sliders'.

 

Ditching AT and brewing your own code sounds like it was a good move! The ESP8266 has certainly been a game changer with its price point and WiFi capability. 

 

Thanks for your comments.

 

Chris

 

Link to post
Share on other sites

excelent work Railsnail. im just getting into this and starting off the Model railway scene with my kids and love tinkering with 3dprinters, RPi and Arduinos. came accross your project and like what you have done. are you sharing your enclore STL files at all or are they already out there some where as id like to replicate what you have done for our N Scale project we are doing.

Link to post
Share on other sites

WRT Enclosures - I guess there are designs already out there for something similar, but I wanted to make my own so that I could learn a CAD package and get to grips with 3D printing.  It sounds like you are fairly experienced, so a DCC++ project should be a great way of introducing your kids to basic controllers/CAD and modelling. Good luck!

 

PS. Also, you may wish to use a lower voltage power supply for your N Gauge project rather than the 15V used in this project. Maybe a 12V PSU would be better due to their smaller motors. 

Link to post
Share on other sites

Hello, I hope someone can help me sort out a wiring problem I have with connecting an LDT RS 8 to a Lenz 100 controlled block detected layout.

the sample shown in the LDT documentation appears straight forward BUT does not clarify wether normal dropper wires need to be added in addition to the J&K shown on the diagram.

I hope I am not overthinking this but can’t work it out from the info I can see.

 

Link to post
Share on other sites

On 01/11/2021 at 20:48, maidstone said:

problem I have with connecting an LDT RS 8 to a Lenz 100

You would be well advised to make your posting under a new thread with an appropriate title. The topic on this thread is "DCC++" and folk knowledgeable about LDT RS 8 may have no reason to even look at this thread. I am not able to help you - I have zero experience with LDT RS 8.

 

Yours,  Mike.

Link to post
Share on other sites

  • 1 month later...

Project Update

 

It's like 1967 all over again! *

 

Yes, it's the introduction of colour to the DCC++ Ex CommandStation project.

 

   279810240_DCCColoursSmall.png.901fde9be81d19ac65d1da671faa267d.png  

 

I finally bought some different coloured 3D printer filament and printed different coloured lids and bases. I even decided to move away from the 3D printer 'engraved' DCC++ Ex' on the enclosure's lid, as I wasn't totally happy with it, and moved to a printed embossed version complete with its own sprue, enabling me to locate and glue the letters.

 

DCCLetters.png.58be287a0c2660dd5f737efa8e0ce2f6.png

 

After the glue set, the sprue was cut with a craft knife.

 

Update 2

 

Moving on...  Question: When is a clone not a clone?

Answer: When it's a Mega2560 Arduino clone fitted with a CH340 serial interface chip. 🤔 

 

I found this out when I purchased a different Mega2560 clone module. It looked identical until I tried to insert it into the case. 

 

I found that the Mega2560 USB socket did not line up with the opening in the base of the enclosure! (The DC power input socket wouldn't have fitted either, but that wasn't an issue here as I remove it from the board).

 

It transpires that there are at least two different form factors for these modules. The overall board dimensions appear to be the same and the mounting holes are identical. However the USB and DC Power sockets are positioned slightly differently. The difference being only 2mm, however the so-called clones are definitely not true clones.  

 

I think the other way to tell which is which is to check the serial USB to 5V serial chip. The clones, (usually made in China WITH a CH340 USB serial interface chip), have different socket placement compared to the true Arduino (or true Arduino clones) fitted with the Atmel ATmega16U2 serial interface chip.

 

So the rule is: if the Mega2560 is a clone WITH the CH340 chip fitted, then the socket placement will be different to a genuine Mega2560 with the Atmel chip or a 'genuine Mega2560' clone with the Atmel chip.  Simple, eh? 

 

 

 

 

* I guess most readers will have guessed the 1967 reference... but for those young folk who were not around at the time, 1967 was the year when the first BBC Colour TV broadcast took place in the UK using the PAL system with a full colour service starting in 1969 . Some experimental colour transmissions took place long before 1967, but that's another story and nothing to do with DCC++ 😀

 

 

 

 

 

 

 

 

 

 

Edited by Railsnail
Link to post
Share on other sites

  • 1 month later...

Programming the Arduino via Bluetooth - the HC-05 Add-on that allows uploading new software via Bluetooth. Bye bye USB

 

One of the bugbears of the Bluetooth CommandStation has been updating the software. It would be nice to be able to operate AND program the Arduino via Bluetooth. To date I have either disconnected the Bluetooth data lines and uploaded new software via USB (from the Arduino IDE) OR used a method whereby a quick press of the Arduino reset button just as the upload (in the IDE) starts hopefully putting the Arduino into bootloader mode. The 'jab the reset' method is very hit and miss. Well mostly miss!

 

Some background - Arduino processors have a small piece of software programmed into them called a bootloader that allows new programs to be uploaded (via USB).

 

In brief, when uploading code (maybe from the Arduino IDE) a signal is asserted by the USB serial chip (on the Arduino board) that resets the processor, thus running the bootloader. That in turn takes serial data and programmes the Mega2560.

 

In this CommandStation design, the HC-05 data signals are effectively in parallel with the USB data lines, so we have access to the Mega2560 chip's data, but cannot put the processor into bootloader mode without some sort of kludge. (We are not using the USB port).

 

Fortunately the HC-05 has an output pin (named STATE) that may be programmed to go logic low when a BT device connects to it. By de-coupling that signal via a small capacitor, it is possible to apply a short reset signal to the Mega2560, thus invoking the bootloader.

720421390_HC-05BTInterfaceTo2560.png.fcdedc38e17a7fb8952560b9f96e964e.png

Therefore with the application of a small piece of prototype board, a six pin connector, a capacitor (0.1uF) and a 15k resistor it is possible to make a little add-on board that resets the Mega2560 when a BT connection is made allowing code to be uploaded to the Mega.

 

The board is simple to make, can be covered with heat shrink tubing and connected to the Reset, 5V and GND connector of the Arduino Mega2560. The data pins RXD/TXD are wired to a separate flying lead that connects to Arduino RXD0/TXD0. (See picture below)

 

BT-Reset-Addon.jpg.a7bb43ef690ff81e76d6238603dd0c79.jpg

 

 

Now, the Bluetooth CommandStation may be programmed AND operated entirely from Bluetooth.

 

 

Next on the Agenda - To Incorporate a Raspberry Pi Zero 2W running JMRI into the Bluetooth CommandStation

 

My next dabbling involves the connection of the newish Raspberry Pi Zero 2W board (via Bluetooth) and running JMRI, to this system. In brief, the RPi can be housed in the CommandStation enclosure (with some modifications). It connects to the HC-05 and is powered by spare capacity from the Arduino Mega 5V rail.

 

Spoiler Alert! - In testing, this works, however the RPi Zero 2W does not have sufficient memory (512MB) to run the comprehensive programming function in DecoderPro when working with the Loksound 5 decoder! Other JMRI functions work well (eg WiThrottle), but playing with CVs on the Loksound 5 brings the Pi to its knees!

 

I may write the findings up in a different thread if time permits.

Edited by Railsnail
Link to post
Share on other sites

6 hours ago, Railsnail said:

RPi Zero 2W does not have sufficient memory (512MB) to run the comprehensive programming function in DecoderPro when working with the Loksound 5 decoder!

Other folk have previously noted on the JMRI users group that DecoderPro working with Loksound 5 decoders seems to use very large amounts of memory and that even a Pi with 1Gb RAM struggles. So the Pi Zero 2W with 512Mb ain't going to work for this combination. There are other Pi systems with 4Gb and 8Gb, but these are larger and more expensive than the Pi Zero - I have a Pi400 with 8Gb running JMRI and a load of other stuff and it works beautifully.

 

Yours, Mike.

Link to post
Share on other sites

12 hours ago, KingEdwardII said:

Other folk have previously noted on the JMRI users group that DecoderPro working with Loksound 5 decoders seems to use very large amounts of memory and that even a Pi with 1Gb RAM struggles. So the Pi Zero 2W with 512Mb ain't going to work for this combination. There are other Pi systems with 4Gb and 8Gb, but these are larger and more expensive than the Pi Zero - I have a Pi400 with 8Gb running JMRI and a load of other stuff and it works beautifully.

 

Yours, Mike.

Agreed. My findings too. I have seen a 1GB pi3 struggle with Loksound 5 decoders but gets there in the end. The Pi Zero runs out of memory, consumes its 100MB default swap space, then hangs.

 

Even though I suspected that may be the case, I wanted to see it with my own eyes. It's a shame really, as the Pi Zero is tiny and requires much less power than the Pi4's and 400's. (It runs quite happily off the 5V output from the Arduino Mega2560!) It's also cheap. If you can find any!

 

I am now trying to decide whether to run with a larger (memory) Pi or just stick with running JMRI on my laptop and connecting it to the CommandStation with Bluetooth. The latter just works fine as you might guess.

 

Thanks for your input...

 

Chris

 

 

 

 

Edited by Railsnail
Link to post
Share on other sites

  • 5 weeks later...

A spring connector prototype

 

After some tweaks to the 3D CAD for the enclosure and reworking the internal wiring to the program/main track sockets/LEDs, I decided to build a prototype version, with spring connectors for both prog and main outputs to track wiring, thus replacing the DC power 'pigtail connector leads' previously used.DCCpp-EX-Mk2-Iso.png.765e154fa5abdce67187c2d8d20c86e7.png

 

Two small spring wire connectors were chosen, slightly recessed into the end of the enclosure then superglued in place .  The fixing holes for the connectors have been re-purposed to accommodate  the LED power on LEDs.

DCCpp-Ex-Mk2.png.73e55b8ee94edf9e8f51208ab19b7f1f.png

 

 

The internal wiring had to be altered slightly as I no longer had the 2.5mm DC sockets to solder to. However all aspects of the controller remains the same as the earlier USB, Bluetooth or WiFi versions

Edited by Railsnail
Re-attach images
  • Like 1
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...