element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Experimenting with Current Sense Amplifiers
  • Challenges & Projects
  • Design Challenges
  • Experimenting with Current Sense Amplifiers
  • More
  • Cancel
Experimenting with Current Sense Amplifiers
Challenge Blog Blog #4: Getting it wrong. The Epiphany
  • Blog
  • Forum
  • Documents
  • Files
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: colporteur
  • Date Created: 15 Apr 2022 1:11 PM Date Created
  • Views 2700 views
  • Likes 4 likes
  • Comments 11 comments
  • raspberry pi
  • current sense amplifier
  • MAX40080
Related
Recommended

Blog #4: Getting it wrong. The Epiphany

colporteur
colporteur
15 Apr 2022

Before nodding off in the early AM, I was rolling around the connection I proposed to measure the motor current using for the Current 6 Click sensor. Even when this challenge was in it's infancy, I made posts that reflected my uncertainty of how to connect the device to take measurements. Misza offered some suggestions but I still was not convinced I had a configuration that would work. As slumber was about to overtake me, I realized my connection proposal was wrong and would work once but then never again:( Sleep would have to wait!

image

The problem is the power bus voltage, the polarity reverses when the direction of the locomotive changes. That same voltage is the reference for the Current 6 Click device. When the locomotive is travelling forward Vin would be connected to the positive rail and GND connected to the negative. When the locomotive is made to travel backwards the voltage would reverse. Most devices I have used do not play well when the supply voltage or in this case the reference voltage is reversed! I suspect, the ground pin on the device being connected to a voltage was the nagging electronics at fault that invaded my sleep.

To put the connection demons haunting my shut-eye to rest, I got out of bed and sat at the desk trying to napkin design a solution. Something in the recesses of my mind suggested a bridge rectifier would solve this. Typically a bridge rectifier is used in a circuit to convert AC voltage to DC voltage. I recall seeing it used to prevent polarity reversal on power a connection, but how?

image

Please electronics aficionado's if I am in error tell me! I have yet to wire the device to a circuit. I need to get it right the first time or this challenge for me goes up in smoke. The two voltage polarities that can be reversed on the left are constantly translated to the right. The left would be connected to the power bus and the right to the Current 6 Click device. Voltage reversal problem solved (I think?).

I appreciate the power bus voltage will be reduced by the voltage drop across the two diodes before arriving at the Current 6 Click device. That voltage would vary as the speed of the locomotive is changed, so a voltage variance issue was anticipated.

I suspect this might impact the detection when the locomotive is moving at a slow speed. I have indicated in my first post speed testing voltages would be established as part of testing. That is one of the tests to determine if the circuit will still detect the locomotive motor.

I'm going to let this idea soak for a few days. No actual power connections during this soak period. I could really use a few thumbs up from the guru's to boost my confidence, if you happened to be reading by.

BACK TO NAPKIN FOR MORE EVALUATION

The bridge rectifier to adjust for polarity reversal suggested above will create a directional issue for the locomotive on the block of track the sensor is monitoring. That calls for another napkin. 

image

This MAX40080 chip schematic shows the load hookup. I just found a best practice recommendation that a DC current shunt should be connected on the grounded side of the load to minimize voltage present at the shunt and metering. I'm not sure how important that is for this circuit. I'm going to use the recommendation for my configuration.

The hookup I've planned without the bridge will work for the locomotive moving in one direction but creates an issue when the power bus polarity reverses for travel in the opposite direction. That indicates I can do testing in the forward direction for the DC system but not in the opposite direction. I have to remember to prevent a polarity reversal in my DC tests or I may damage the device.

The circuit should work for the DCC system since it doesn't use polarity on the rails to determine direction.

  • Sign in to reply
  • scottiebabe
    scottiebabe over 3 years ago

    Provided the RPI and/or train's power supplies are floating you can measure the train's load current as follows:

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • colporteur
    colporteur over 3 years ago in reply to jc2048

    I understand what you are proposing but lack the confidence to initiate. My biggest concern is moving from napkin design to reality and finding I let the magic smoke out of the device.

    Your experience level on the device is reflected in your comments. I had to do some reading to refresh my knowledge of shunts. A fork in my career path took me to computer systems administration away from electronic systems design and support in the late 90's. I'm using knowledge laid down with tubes to navigate most of this stuff.

    I do appreciate your input. Your feedback is indicative of the coffee time at work when all the guys were sitting around and you could throw out something to flush out an idea. 

    My plan currently (ha) is to test the DC system in the one direction only so that I can preserve the device to test the DCC rail system.

    The price of this unit $32 US doesn't make it viable for my model railroad layout. There is over 200 feet of track in the layout. A track rail section out of the box is 3ft long. That would be well over 60 of these boards if I wanted to monitor each section and that doesn't count siding rail. I am hoping to find a current sense solution in the $5 CD range.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • jc2048
    jc2048 over 3 years ago in reply to colporteur

    You're right, it can't work like that.

    The fundamental issue is that the sense resistor voltages MUST stay above the GND voltage. The chip is designed for situations where that would be the case. The datasheet says that the common-mode range extends down to -100mV, so in theory the sense voltage could be down around ground, but in your case you would need to be careful even of that because of switching spikes from the dc motor (even with high-side sensing, you might want to consider how you could protect the sensing better, though it's easier up there).

    If the controller internally is a simple power supply [with a positive and a negative] followed by a rheostat and switching to do the direction change, you could, if you felt confident about it, delve in and find the most negative point and connect it to the click GND. [My experience of such controllers dates back 50 years - I don't suppose it's all quite the same now.] Then all the voltages you'd expose the click to would be higher than that. It's a bit kludgy, but it would enable you to do something for the competition. It still leaves you with the problem of the sense being down close to the GND with one direction of travel.

    Another possibility would be to generate an extra negative voltage (battery?) so that you could offset the GND of the click from the negative output of the bridge.

    A further possibility might be to build an interface circuit to measure the motor current [over a higher common-mode range than the click board] and output a proportional [but lesser] current that the click board could then read safely.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • colporteur
    colporteur over 3 years ago in reply to jc2048

    I took out a napkin to develop an approach that accomplishes what you suggest but I couldn't make it work.

    image

    I have this fear of creating some unexpected loop or worst shorting the power supply with the Current 6 Click being the fuse. The MAX40080 block diagram discourages me from trying further. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • jc2048
    jc2048 over 3 years ago in reply to colporteur

    I thought you meant you would have the locomotive supplied from before the bridge. If it's after, my comment no longer applies, but, as you say, then the locomotive will only travel in one direction.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube