Current pulse sensing using a microcontroller - Page 1
Forum section: electronics / projects

author: danners430
author_rank: Regular Contributor
timestamp: February 11, 2018, 02:04:46 pm
content: Afternoon all,I'm looking to build a board for the control of points etc. On a model railway. It would include automatic route setting, indication and basic point indications.The person who I'm building this for, however, wants this to be essentially a "drop-in" unit, which means that all the switches on the control panel will be hardwired to the point motors (solenoids) they control.My question therefore is: is there a method for a microcontroller to detect the pulse of current sent to the point motor, where the microcontroller is essentially in parallel to the motor?I know there's plenty of products out there that have that kind of detection (eg.http://www.microminiatures.co.uk/acatalog/Model-Rail-Points-Position-Indicator.html), but I'm an enthusiast and a maker - I want to try and understand how these work, and try and make my own with the added features :-)Any help would be appreciated!!Sent from my ONEPLUS A3003 using Tapatalk

author: ogden
author_rank: Super Contributor
timestamp: February 11, 2018, 03:54:58 pm
content: Quote from: danners430 on February 11, 2018, 02:04:46 pmSure. With proper circuit it can sense voltage, current or other kind of inputs. Note that "microcontroller in parallel to motor" usually ends with puff of smoke. According to user manual of product you mention, devicedoes notsense current but voltage instead. You definitely shall investigate further - check existing products, their manuals. Maybe buy most popular one and investigate/measure how it works. Here in the public forum you shall be careful. Many people (like me) can give you advice w/o actual knowledge of subject (model railways).

author: danners430
author_rank: Regular Contributor
timestamp: February 11, 2018, 03:58:33 pm
content: Quote from: ogden on February 11, 2018, 03:54:58 pmVoltage would make more sense, thinking about it more, since it is in parallel, not series. I'll keep searching for a little while :-)I'd happily use something simple like a relay to act in series with the point motor, but they're connected to capacitor discharge units that pulse faster than most relays can handle..... I've had a few smokey moments testing that one out :-)Cheers!Sent from my ONEPLUS A3003 using Tapatalk

author: phil from seattle
author_rank: Super Contributor
timestamp: February 11, 2018, 05:09:04 pm
content: The answer is yes but depends on how short the pulse is. An arduino can get to about 10K samples per second (100 nS period) though that takes some pretty thoughtful programming. 1K samples per second (1 mS) is relatively easy. It sounds like these aren't terribly short pulses, though.I wonder if you understand your use of the word parallel in this context. Care to elaborate? Power to the micro definitely should be separate. Sensors depend on what you are sensing. If what you are looking for is positive confirmation that a motor has run (to switch a track or such) then current will give you more information than voltage - how much current (power) and how long. Voltage on the other hand can't tell you as much. A stalled motor's voltage will look somewhat similar to a running one but current draw will be different (higher).Maybe you can give some examples with details - you would get higher quality answers.Quote from: ogden on February 11, 2018, 03:54:58 pmWell said. I prefer a more humorous approach but deep truth in that.

author: danners430
author_rank: Regular Contributor
timestamp: February 11, 2018, 05:25:20 pm
content: Quote from: phil from seattle on February 11, 2018, 05:09:04 pmUnfortunately, I don't know how long the pulse is - the capacitor discharge unit has circuitry that sends a single pulse of current to the solenoid motor, changing the points, and immediately shuts off after it is discharged. It doesn't then send another pulse until the switch that was pressed is released, returning the entire system to Open Circuit. The capacitor discharge unit manufacturer doesn't publish any specifics about how long the pulse is, I'd have to ask them... And they usually take a while to respond. But I'll do it anyway :-)The chips I'm using are PICAXE chips which can be overclocked to 32MHz.With parallel, I mean the following: imagine you simply clip on two leads from the sensor onto the positive and return sides of the solenoid motor. I'm aiming for a system where the buttons on the control panel are directly hardwired to the solenoids, but the microcontroller senses the pulse from the CDU and does things according to that.Finally, I would definitely be using a separate power supply, either a standard 240v - 5v adapter, or a 16V-5V regulated supply.I've added an image extracted from the datasheet for the product I posted above, as that's basically what I'm hoping to get :-)Oh, and woof. ;-)Sent from my ONEPLUS A3003 using Tapatalk

author: phil from seattle
author_rank: Super Contributor
timestamp: February 11, 2018, 06:36:35 pm
content: You can figure out the length of the pulse from V, R and C. Look up RC constant.You can also test it.I'd focus on voltage sensing.be careful with the pulse, know the voltage before you test it