{"id":444,"date":"2019-07-14T01:23:16","date_gmt":"2019-07-14T01:23:16","guid":{"rendered":"https:\/\/www.nleby.com\/longform\/?p=444"},"modified":"2021-08-14T17:30:50","modified_gmt":"2021-08-14T17:30:50","slug":"arduino","status":"publish","type":"post","link":"https:\/\/www.nleby.com\/longform\/2019\/07\/14\/arduino\/","title":{"rendered":"Model train crossing\/bridge controller using an Arduino Mega using C\/C++"},"content":{"rendered":"\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-nicholas-l-eby wp-block-embed-nicholas-l-eby\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"pCNPSZFrnh\"><a href=\"https:\/\/www.nleby.com\/longform\/2018\/11\/06\/command-for-mac-update\/\">Command: a macOS app that interfaces with the NCE usb module via RS-232<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Command: a macOS app that interfaces with the NCE usb module via RS-232&#8221; &#8212; Nicholas L. Eby\" src=\"https:\/\/www.nleby.com\/longform\/2018\/11\/06\/command-for-mac-update\/embed\/#?secret=pCNPSZFrnh\" data-secret=\"pCNPSZFrnh\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">One of my favorite things about the model train hobby is getting to experiment with my love for hardware and code. One day I was playing with a crossing system I bought from a big retailer and quickly became frustrated with its shortcomings, I literally had an &#8220;ah hah&#8221; moment when I realized I could create my own, pretty easily.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The video below describes in detail why I decided to build my own, and how I went about doing it. I go over different &#8220;activation methods&#8221; and why I chose to go with sonar over voltage or light. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One additional thing I did was add a BLE chip so I could control the whole system with my smart phone (luckily I know a good iOS developer to build the app).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Grossing Gates, Turnout, and Signal Bridge<\/h2>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"(Narration) Arduino Grade Crossing with BLMA Signal Bridge, Circuitron Slow Motion Turnout Control\" width=\"800\" height=\"450\" src=\"https:\/\/www.youtube.com\/embed\/ivs4Yj5QjNU?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Components used:<\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li>Arduino Mega<\/li><li>Sonic sensors (HC-SR04)<\/li><li>NJI Crossing Gates (NJI 1164) &amp; NJI dwarf<\/li><li>Adafruit Bluefruit LE UART Friend &#8211; Bluetooth Low Energy (BLE)<\/li><li>Innovative Train Technology Products HQ-300 (Sound module)<\/li><li>Tolako 5v Relay Module for Arduino (Works with Official Arduino Boards)<\/li><li>SMAKN\u00ae 5V Active Low 2 Channel Relay Shield Module for Arduino UNO 2560 1280 ARM PIC AVR STM32 Raspberry Pi<\/li><li>BLMA 3 track modern signal bridge<\/li><li>Circuitron 6000 Tortoise Switch Machine<\/li><li>Misc. servos (crossing gate and car stopping mechanism)<\/li><li>Rare earth magnets (interrupts the reed switch in Faller car)<\/li><li>Faller &#8211; Car System Start-Set MB Sprinter<\/li><li>Adafruit Speaker &#8211; 3&#8243; Diameter &#8211; 8 Ohm 1 Watt [ADA1313]<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Faller car system<\/h2>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"(Faller Car System) Arduino Grade Crossing with BLMA Signal Bridge, Circuitron\" width=\"800\" height=\"450\" src=\"https:\/\/www.youtube.com\/embed\/opxFzCUaL9o?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>One of my favorite things about the model train hobby is getting to experiment with my love for hardware and code. One day I was playing with a crossing system&hellip;<\/p>\n<p> <a class=\"more-link\" href=\"https:\/\/www.nleby.com\/longform\/2019\/07\/14\/arduino\/\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":940,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[65,57,66,59,68,67,58,33],"class_list":["post-444","post","type-post","status-publish","format-standard","has-post-thumbnail","category-personal","tag-arduino","tag-c-c","tag-mega","tag-microcontroller","tag-model-railroad","tag-model-trains","tag-uno","tag-website"],"_links":{"self":[{"href":"https:\/\/www.nleby.com\/longform\/wp-json\/wp\/v2\/posts\/444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nleby.com\/longform\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nleby.com\/longform\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nleby.com\/longform\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nleby.com\/longform\/wp-json\/wp\/v2\/comments?post=444"}],"version-history":[{"count":9,"href":"https:\/\/www.nleby.com\/longform\/wp-json\/wp\/v2\/posts\/444\/revisions"}],"predecessor-version":[{"id":941,"href":"https:\/\/www.nleby.com\/longform\/wp-json\/wp\/v2\/posts\/444\/revisions\/941"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.nleby.com\/longform\/wp-json\/wp\/v2\/media\/940"}],"wp:attachment":[{"href":"https:\/\/www.nleby.com\/longform\/wp-json\/wp\/v2\/media?parent=444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nleby.com\/longform\/wp-json\/wp\/v2\/categories?post=444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nleby.com\/longform\/wp-json\/wp\/v2\/tags?post=444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}