Easy Arduino Current Sensing for Occupancy Detection

Поділитися
Вставка
  • Опубліковано 7 вер 2024
  • Today we are completely changing the game in terms of my Arduino Sketches. Today we are tackling current sensing. This is a great way to easily modify your railroad so that you can do occupancy detection without tearing up your track!
    Check out our sponsor!
    www.trainworld.com
    Prizes Video
    • 10,000 Subscriber Give...
    Check out my Etsy Store!
    www.etsy.com/s...
    NCE BD20
    www.trainworld...
    Arduino Starter Kit
    amzn.to/2OERZAf
    Arduino UNO
    amzn.to/2WBEsOo
    Samaritan’s Purse
    www.samaritans...
    Camera Used
    amzn.to/2X87yWR
    Support the channel with some Merchandise!
    teespring.com/...
    You can contact me at diyanddigitalrr@gmail.com

КОМЕНТАРІ • 64

  • @RonsTrainsNThings
    @RonsTrainsNThings 4 роки тому +7

    I'm glad you made thos video before I started buying ir sensors for arduino block detection. This is definitely the preferred method.

  • @panamrailfan4377
    @panamrailfan4377 4 роки тому +1

    Jimmy, I’m pretty sure you can simplify your main loop into 4 lines of code, I’ll investigate today! Of course, your purpose is to teach people Arduino and the Arduino has tons of headroom in this case. This was perfect! Great work and great tip for the railroad!

  • @nesr8786
    @nesr8786 4 роки тому +1

    Thanks Jimmy that was a lot simpler to the previous block detection you done a while ago .much appreciated, Take care for now .Mac

  • @SaintLouisFriscoLines
    @SaintLouisFriscoLines 2 роки тому

    Jimmy, this is exactly the information I've been looking for with respect to interfacing block detection with the Arduino. I already have multiple Arduino's networked to JMRI using the Chubb Computer/Model Railroad Interface (C/MRI), but none are being used for current sensing. Thank you so much for this timely tutorial. Count me in as a new subscriber!

  • @johnnyrobertson5971
    @johnnyrobertson5971 4 роки тому +1

    Hello Jimmy, thank you always for any Arduino projects and love how you teach the world of Arduino’s. Enjoy your videos and appreciate how you give this to us so freely. Be safe up there and happy railroading!!

  • @TheTrainFreak
    @TheTrainFreak 4 роки тому

    I love using the BD20's and have been using those for a while. I haven't jumped into using Arduino yet but I do have a NCE AIU-01 card that allows me to connect 14 BD20s on it with my system being connected to JMRI. You are correct as needing at least 1 axel with a resistor on rolling stock but I prefer two axels (the inner axel on each truck) to have the best reading without it looking too disruptive. Of course rolling stock with lighting and/or sound won't need the resisted axel. This was a main issue I had when getting into block detection years ago. Great video Jimmy as always and congrats again on your 10K subs!

  • @kenneybennett9359
    @kenneybennett9359 11 місяців тому +1

    Hi, I just started watching your videos, wonderful content along with great innovation. I have been playing with arduino systems, learning coding and such. I have about 100 locomotives I have been collecting over the years and I was wondering how you control large consists of say 5 locks at a time. I would appreciate any ideas or suggestions you might have. Thank you, Kenney

  • @Core-vu6mc
    @Core-vu6mc 6 місяців тому

    There is an easier way. Just get one of those small blue coils, a 50 ohm burden resistor and a pair of leads. Connect the burden resister across the terminals of the coil. Connect the leads to the terminals as well. One lead then goes to the ground on the Arduino. The other goes to an analog pin like A0. Wrap your track wire two or three times through the coil. The Arduino sketch can read the value from A0. You will have a small floor value even with no train on the track. Just set your code to turn on the led above that value. It will also detect stopped trains for the same reason as the more complex and expensive circuit shown. No need to provide power to the coil. It works via induction.

  • @Drsef50
    @Drsef50 4 роки тому

    What a terrific video. I'm going to order a couple of BD-20's and start designing a couple of track projects that I've kept on the back burner awaiting a simple and reliable triggering mechanism. Thanks, Dave

  • @TechBuild
    @TechBuild 4 роки тому

    This is a great addition for model railroad automation projects!

  • @hansfehlow9657
    @hansfehlow9657 4 роки тому

    Wow nice and simple Jimmy. Thank you for making this video and explaining the process. Happy Modelling and stay safe. Hans ...

  • @darylroe9929
    @darylroe9929 4 роки тому

    Can't wait for your updates on this subject.

  • @railwayjade
    @railwayjade 4 роки тому

    Now we are talking! This is what I was hoping to see 😎😎🥳🥳

  • @scottericcatalano596
    @scottericcatalano596 4 роки тому +1

    I also recommend using #define this saves having to remember pin numbers down the road especially if you get more and more sensors and LEDs etc

  • @artyz2002
    @artyz2002 4 роки тому

    This is easy, thank you. I am preferring to use this system with my new layout as I be doing night operations, and the ir don't work to great in the dark.
    Thank you.

  • @HumancityJunction
    @HumancityJunction 4 роки тому

    Thanks Jimmy for a great explanation that is easy to follow about current sensing.

  • @redwoodcityintheuknscalera7179
    @redwoodcityintheuknscalera7179 4 роки тому

    Hi jimmy the quicker you show us how to do this for the block signals the better i think i can do it but can't wait to follow along with your video

  • @KaiDon1
    @KaiDon1 3 роки тому

    I used standard 5 Amp, one , you need to wire more turn to CT , It works fine and stable on my layout.

    • @KaiDon1
      @KaiDon1 3 роки тому

      Also,need to set up the A/D unit.

  • @ariegt
    @ariegt 4 роки тому +1

    ever tried the "ACS712" ? it will set you back just 1 buck !!! for the axle sensing you can put special resistence paint on them , old trick ... but it is best to use only the last car for it , otherwise you can put to much load on your track. You will see it is not flawless for detecting the whole train. i still prefer the infra-reds ( begin + end ) in combination with the asc712 load detector to get it water tight. P.S i am also looking into motor drivers (PWM and or DCC) with a current sensor build in . A Power(dcc) unit with a build in sensor of usage sounds perfect to me. keep it up, kind regards Arie-gt

    • @ariegt
      @ariegt 4 роки тому

      @Randy Rinker well if you take ohms low and do your math it goes a little bit faster then that. If you take 15 cars with 10K axles you end up at almost 300-Ohm , nothing to smoke up your wiring but still something to take in mind

    • @ariegt
      @ariegt 4 роки тому

      @Randy Rinker who is talking about 300ma ? you can also use just 10k on just only the last car or caboose , but don't forget to hang it on the tail or the system fails

    • @ariegt
      @ariegt 4 роки тому +2

      @Randy Rinker yes in a perfect world you know exactly where the front of the train is at and also the end. As you also stated earlier , it is nice to have IR at certain spots. You can also use 0.1-Ohm resistor in series of your track and meassure the voltage over it , maybe the cheapest solution for train detection

  • @austinhale7265
    @austinhale7265 4 роки тому +1

    I had been trying to figure out how to use IR without having to blow a bunch of holes in everything, so this is a much better option, and nicely presented/explained as always! How many blocks done this way can a single Arduino monitor/control?

  • @1964cali
    @1964cali 3 роки тому

    Need a sensor on the loco to turn on sectional block lights within a block, say the length of loco. And a sensor to turn off lights on the caboose as it leaves a section of block.
    This way one wouldn’t worry about the length of train and it’ll show as it leaves the sectional blocks to show the end of train.

    • @1964cali
      @1964cali 3 роки тому

      Let’s say for each 20” section of a block, the loco would turn on the light and leave them on as it progress forward. Then as the caboose comes through, it would turn off the lights. Wouldn’t matter if it’s a 3 car train or a 10 car train.
      The lights left on would indicate occupancy as train moves through the layout. For each light left on would indicate the presence of a car.
      It would continually show the location of the loco as it moves forward a sectional block and location of caboose as it leaves a section block.
      Kinda like running LEDs.

  • @l.rod2827
    @l.rod2827 Рік тому

    Just watched your video and it was very helpful. I'm looking at installing 2 BD20 (one for each mainline) to run operate (2) two aspect signals. I'm thinking for the coding to have two inputs (pin7,&6) and four output pins (5,4,3,2) with the similar coding {if va1A1,

  • @darrentecklenberg4280
    @darrentecklenberg4280 4 місяці тому

    Hi Jimmy, Thanks for the video which I have found useful, however as I am new to Arduino coding I am a little puzzled at point 08:40 of the video when you specify the if statements where if (valA10) then show the LED as LOW - surely valA10 are both TRUE statements?

  • @davelees3922
    @davelees3922 Рік тому

    Hi Jimmy, I'm a relatively new subscriber, but love the videos... can I ask, how easy would it be to have the Arduino code monitoring 4 inputs (and therefore controlling 4 LEDs)...?

  • @wmjwell
    @wmjwell 2 роки тому

    Hi Jimmy, thanks for the classes and I really enjoy them. Keep on making them. Please add me to the drawing. Thanks, Jim

  • @williambryant5946
    @williambryant5946 4 роки тому +2

    So you could use this with CTC panels to light the bulb on the panel and show what block the train is in. Will it work if the train is in two blocks? What I mean is if you have several of these sensors and blocks back to back will it show the train in each one using the same code or would the code need to be changed? I don't see why it wouldn't or why you'd have to change the code but I'm not great with writing code and understanding how it works completely. I'm at the level of I can do it if you show me what to write like you have in this video. You are doing great videos that share awesome information. Thanks for doing these videos. Stay well. -Wil 👍

    • @joegusherowski8548
      @joegusherowski8548 7 місяців тому

      Hey Will, sorry for the very late response. But the idea that you are describing is totally feasible. In the video, he mentions that you do not specifically need a locomotive with a motor to cause an increase in current draw to trigger the sensor. If you were to add any sort of resistance to any other piece of rolling stock (ex. use a resistor on a caboose axle), it would also trigger the sensor in any block it traveled through. If you were to add resistance to every locomotive/railcar of a 100 car train, and your blocks were for 40 car lengths, your train would show up in 3 blocks at a time.
      So the changes you would need to make from this video to make a CTC panel would be:
      - Follow the same wiring for each block, so you would have a wire from each block sensor going to the Arduino digital pins.
      - In the code, under VoidSetup, you would need to write a pinMode(#, Input/Output) for every pin you were using. So this includes inputs for all the new sensors, and outputs for all the LEDs you would use.
      - In the code, under VoidLoop, you would need to create a new variable for each input (int = ValA#)
      - Copy the "if" and "else if" statements with your new variable(s), and obviously change the digitalWrite(#, H/L) to the correct pin number.
      Hope this helps.

  • @yawarsaeed6499
    @yawarsaeed6499 3 роки тому

    Thanks for sharing such an Awesome project. Can you please share where did you connect the current sensing loop wires to the track. Can you please preferably share the wiring diagram as in video all is clear except the sending loop wires termination to the track .
    An early response will be highly appreciated.
    Take care, stay safe.

  • @jeffemaxse8928
    @jeffemaxse8928 Рік тому

    Hi Jimmy, Hi guys,
    Another great video. Living in France, I can't get my BD20 sensor easily and quickly (except to order them in the United States, or in the United Kingdom with mind-blowing customs duties !!!), can a sensor such as the ACS712 be used instead ? If someone has tested this type of sensor, please let me know if I can use it to control the barriers of a crossing (until now opening and closing with a switch).
    Many Thanks

  • @TimberSurf
    @TimberSurf 4 роки тому +1

    You have finally worked out current sensing is way better than infra red, problem is that at £14.50 a pop, I need 40 detectors, its just not an option to buy BD20's!

    • @DIYDigitalRailroad
      @DIYDigitalRailroad  4 роки тому +1

      I wish they were cheaper. I first tried to use the generic ones and they just weren't sensitive enough and they couldnt pick up the train consistently. I will keep working on it.

    • @scottericcatalano596
      @scottericcatalano596 4 роки тому

      There are CT modules on Amazon and eBay that work just fine for Nscale and HO scale....a few years ago I did the testing....I have pictures no video...it worked for DC and DCC just fine.

    • @TimberSurf
      @TimberSurf 4 роки тому

      @@scottericcatalano596 I found this years ago thenscaler.com/?p=1080, but it was inconclusive! If you could share the type of sensor you used, we could work out the rest!

    • @scottericcatalano596
      @scottericcatalano596 4 роки тому +1

      @@TimberSurf this is what I used arduino.cfnet.org/CT-COIL/DEMOLAYOUT-CURRENTDETECTOR-1.jpg

    • @TimberSurf
      @TimberSurf 4 роки тому

      @@scottericcatalano596 Ok so you are measuring the AC, rather than the more complicated shield jimmy is showing!

  • @paulbarcham1356
    @paulbarcham1356 4 роки тому

    Just looking at this video I do projects myself, but have not seen these before, been knocking ideas around my head on how to do dcc mcb cheaper. The question are these a standard arduino input device I. E the current is turned into a 0 to 5 vdc? As I think you could use these into the anlog input and have the out puts controling a relay with some compare logic to open the relay on a voltage raise over time or once limit reached. Please can you let me know and what they are called. Let you the out come if you are interested.

  • @willmilberger5307
    @willmilberger5307 4 роки тому

    Do you link your arduinos together, or do you have them seperate and categorize (lighting, sensors, loco and turnout), or a individual one and add a new one as you go?

  • @geofflarcombe3084
    @geofflarcombe3084 4 роки тому

    Need to state this only works for AC current ? eg DCC Not for DC only layouts

  • @downunderDSB
    @downunderDSB 4 роки тому

    Aarghh, just bought a handful of LED detectors - your video is a few weeks late! This solution is much better and less intrusive than LEDs poking up...oh well

  • @ClinchfieldModelRailroad
    @ClinchfieldModelRailroad 3 роки тому

    I must have missed something because I don't see where you mention how to hook up the wire going through the coil. Looks incomplete to me.

    • @DIYDigitalRailroad
      @DIYDigitalRailroad  3 роки тому

      So that was representative of the bus wire going to the section of track.

  • @jspupster
    @jspupster 3 роки тому

    so you need a BD20 and an Arduino per block?

    • @DIYDigitalRailroad
      @DIYDigitalRailroad  3 роки тому

      Yes, but I am trying to figure out better ways that are less expensive to accomplish this.

  • @YigalBZ
    @YigalBZ 6 місяців тому

    This is not checking for exitance of train on the rail. It is checking for moving train on the rails. There is a bid difference.

    • @DIYDigitalRailroad
      @DIYDigitalRailroad  6 місяців тому

      Actually this checks for a current draw on the tracks. A Locomotive will complete a circuit and draw some current even when completely stopped. You can also do this with rolling stock by using resistor wheelsets.

    • @YigalBZ
      @YigalBZ 6 місяців тому

      @@DIYDigitalRailroad Although it is often true, it is a very risky method: sometimes the current consumes is very low, so measurement can result with error conclusions. Small current can flow without a train, or if a wagon was left. Or a train that is not consuming power due to a problem. My point is that this method detects power, not existence of a train.

  • @swyntopia
    @swyntopia 2 роки тому

    How many ampere is the threshold of this sensor ?

    • @DIYDigitalRailroad
      @DIYDigitalRailroad  2 роки тому

      The BD-20 ranges from 0.1 to 20 amps. It’s a very solid detector.

    • @swyntopia
      @swyntopia 2 роки тому

      @@DIYDigitalRailroad Thank you !

  • @colintelfer2756
    @colintelfer2756 5 місяців тому

    good video however being hard of hearing the music doesn't do it any favours

  • @HelmutFischer-thehefi
    @HelmutFischer-thehefi 4 роки тому +5

    Please!
    No Music while you are talking!
    I don't know why so much UA-camrs do that.
    Hate it!

    • @williambryant5946
      @williambryant5946 4 роки тому +1

      Agreed I can't focus on what he's saying.

    • @Ax89
      @Ax89 4 роки тому +2

      That was going to be my comment but you beat me to it!

    • @gravesclay
      @gravesclay 4 роки тому

      It's called a lead in and is pretty standard in all media production.

    • @HelmutFischer-thehefi
      @HelmutFischer-thehefi 4 роки тому +2

      @@gravesclay No. It's no lead in, when during the whole talking and therefore not common in good productions. And even it would be both, I still don't like it, because it is disturbing. I also don't want it in news on the radio. It's simple idiotic.