element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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 Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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
Dev Tools
  • Products
  • More
Dev Tools
Forum L298 current sensor pin, convert pulsed current signal to consumption flag
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Dev Tools to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 20 replies
  • Answers 2 answers
  • Subscribers 82 subscribers
  • Views 4244 views
  • Users 0 members are here
Related

L298 current sensor pin, convert pulsed current signal to consumption flag

modelrailwaycat
modelrailwaycat over 10 years ago

Hello,

 

I am designing a small, simple 12V motor controller fed by a L298 H-bridge driver. The H-bridge input pins are supplied by means of PWM at 40 Hz. The motor can be connected or disconnected from the output even with the input and enable on. For this reason, I am interested in adding additional circuitry in order to obtain a binary signal of consumption using the current sensor pins; that is obtain a permanent high level while some current is detected and a permanent low level when no current is detected (after at least 1 period, but this is flexible).

 

The idea is to use a 0.5 ohm resistor to connect the sense pin to ground, and then use the voltage across the resistor to obtain the signal. I consider that the voltage measured will be from 5 mV to 1V and the Duty Cycle can be down to 1%. Because the sensor signal is also pulsed, I need somehow to filter it and obtain an stable output while consumption is 'on'. The problem is that I had not success to set properly a low-pass filter plus op-amp buffer configuration from this signal working reliably with all the mentioned conditions. I also tried to pre-amplify the sensor signal with another op-amp, then output that into the low-pass filter plus buffer, but had no success too.

 

Any idea is appreciated. Thank you very much!

  • Sign in to reply
  • Cancel

Top Replies

  • D_Hersey
    D_Hersey over 10 years ago +2 suggested
    Can you draw it up? What op-amp are you using? Not all op amps have common mode input range all of the way to BoS.
  • D_Hersey
    D_Hersey over 10 years ago +2
    "If you are going to reverse the current, you will need to set up a different reference voltage as with everything referred to 0V you will not get a negative swing. And your comparator will have to work…
  • peterjcs23
    peterjcs23 over 10 years ago in reply to modelrailwaycat +1
    Hi John, is your motor turning ok? If you put a DVM across Rsense what voltage do you see when turning and when stationary? Do you have a scope to look at waveforms? Peter
Parents
  • D_Hersey
    0 D_Hersey over 10 years ago

    Can you draw it up?  What op-amp are you using?  Not all op amps have common mode input range all of the way to

    BoS.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • modelrailwaycat
    0 modelrailwaycat over 10 years ago in reply to D_Hersey

    Hi Don, thank you for your advice.

     

    Here's the circuit which I'm currently simulating. The op-amps are LM324. Maybe there's something related with what you commented regarding common mode input range in the first op-amp.

     

    Even before the PWM input sends the first pulse, the output of it is in high state. Then, when simulating a certain Duty Cycle, for instance 50%, the filter doesn't hold the value properly, causing output CONSUMTION_FLAG to switch at the PWM frequency. Maybe the design of the filter itself is wrong too.

     

    Any further comment is appreciated.

     

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • peterjcs23
    0 peterjcs23 over 10 years ago in reply to modelrailwaycat

    Hi John, is your motor turning ok?

    If you put a DVM across Rsense what voltage do you see when turning and when stationary?

    Do you have a scope to look at waveforms?

     

    Peter

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • peterjcs23
    0 peterjcs23 over 10 years ago in reply to modelrailwaycat

    Hi John, is your motor turning ok?

    If you put a DVM across Rsense what voltage do you see when turning and when stationary?

    Do you have a scope to look at waveforms?

     

    Peter

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • modelrailwaycat
    0 modelrailwaycat over 10 years ago in reply to peterjcs23

    Hi Peter, thank you for your reply.

     

    Yes, the motor turns OK according to the Duty Cycle defined.

     

    The voltage across Rsense (R3), Vsens, is according to the current on pin 1 (divided by 2). Attached is a capture of the waveforms for a simulation of 110 ms. PWM start is delayed 50ms. As you can see, the output of the op-amp (Vsat in blue, on the right axis) has some disturbance, but its value is in high state even at the start of PWM. Vsens is in green and Vthreshold in red. Duty Cycle is 10% in this case.

     

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • peterjcs23
    0 peterjcs23 over 10 years ago in reply to modelrailwaycat

    Hi John

     

    okay this is what I'd do.

    1. The LM324 is a very old fashioned opamp with poor offset and does not operate rail to rail. You might like to choose a better one like OPA4241.
    2. An op amp is a poor comparator, the LM324 is just not working in this mode at a voltage near the rail.
    3. I would make the first stage of the processing a positive gain amplifier to get a bigger signal (you need to know your max current to set the gain for full scale)
    4. The next stage could be your RC filter which needs to be around 4Hz for a 40Hz pwm say 39k with 1uF.
    5. The next stage should be your comparator, which is now working with a higher more manageable voltage. Use a LM339 for a cheap standard part. That will drive your led directly on the output which needs a pull up to make it work.
    6. If you are going to reverse the current, you will need to set up a different reference voltage as with everything referred to 0V you will not get a negative swing. And your comparator will have to work with + an - current as both represent the on state.

    Peter

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • peterjcs23
    0 peterjcs23 over 10 years ago in reply to modelrailwaycat

    ...oh yes and one more thing...

     

    You show zener diodes on the motor drive for the fly back current. These should be rectifier diodes 2A fast recovery types. For example ES2A.

     

    Peter

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • gdstew
    0 gdstew over 10 years ago in reply to peterjcs23

    I'm pretty sure those are schottky diodes not zeners. The symbols used are very similar however usually with zeners the "flags" on the ends are at an angle, not straight up and down.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • 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 © 2025 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