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
Op-Amp-a-Palooza
  • Challenges & Projects
  • Project14
  • Op-Amp-a-Palooza
  • More
  • Cancel
Op-Amp-a-Palooza
Blog Op-Amp Line Follower - Blog 1 First Steps
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Op-Amp-a-Palooza to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: javagoza
  • Date Created: 11 Apr 2022 11:42 AM Date Created
  • Views 14958 views
  • Likes 6 likes
  • Comments 2 comments
  • opampsch
  • triangle wave oscillator
  • pwm
  • msop adapter
  • opamps
  • analog discovery 2
Related
Recommended

Op-Amp Line Follower - Blog 1 First Steps

javagoza
javagoza
11 Apr 2022
Op-Amp Line Follower - Blog 1 First Steps

This was going to be the first blog of my line follower project made with Op-Amps. Unfortunately I have ruined the Op-Amps due to an error when going to test them. My lessons learned.

Project Blogs

  • Op-Amp Line Follower - Blog 1 First Steps
  • Op-Amp Line Follower - Blog 2 Following the research
  • Op-Amp Line Follower - Blog 3 The Line Follower

MCP6007 Op Amp and more from Maxim Integrated / Analog Devices

I received some 8-lead SOIC MSOP packaged Microchip MCP6007 Op-amps.

MCP6007-E/MS 2 OpAmps , 1 MHz, 1.9 V/µs, 1.8V to 5.5V, MSOP, 8 Pin

Supply Voltage Range: 1.8V to 5.5V

Vdd - Vss = 6 V max. (This was my mistake, I got distracted, I didn't respect the limits and I broke the Op-Amps when testing all of them Disappointed relieved)

Along with the op-amps I also received this Essential Analog Toolkit from Maxim Integrated / Analog Devices. Kit from which I hope to be able to use more than one component in future projects.

image

MSOP to DIP adapters

I don't have much experience with Op Amps. My idea was to first experiment with them and then build a working circuit.

I wanted to use a breadboard for testing and then a Eurocard prototyping board.

So I bought some MSOP to DIP adapters from Amazon.

The adapters are very curious, they are two-sided and each side is for a different footprint.

image

I also ordered these others in the shopping basket of the prize of another edition of Project14, but they arrived late.
Roth Adapter MSOP8

image

I soldered the op-amps to the adapters.  I soldered them on a breadboard, first soldering the side pin headers to have a good hold on the base.

image

I used a Weller WE 1010  soldering station with a 0.8mm conical tip.

The first one cost me a lot to solder it, I soldered too much and it was difficult to eliminate all the short circuits. 

image

The following with the lesson learned, a lot of flux and little tin was an easier task than I had thought.

image

Testing the Line Follower Stages

The next task in my plan was to test the different stages of the line follower separately: Triangular Wave Generator for PWM Controller, PWM Controller, Motor Drivers, Voltage Regulator and Virtual Ground, Line Sensor Adder, PID Control, Wheels speed adjustment.

Triangle wave oscillator

The PWM controller was made of a triangular wave oscillator and a comparator. The triangle wave oscillator creates a symmetrical triangle wave.

The triangle wave oscillator first uses an integrator with a constant dc input voltage to generate a ramp. The integrator output drives a Schmitt trigger. The output of the Schmitt is what ought to determine the direction of the ramp. And use its output as the input to the integrator.

The Schmidt Trigger uses positive feedback to prevent multiple output transitions. (Ref: The Art Of Electronics. Horowitz/Hill)

image

I built the circuit on a breadboard.

image

The values are known from a circuit that I searched for on the Internet, later if it works I will adjust to what interests me. At the moment I want to see something that works.

image

Theoretical calculation of the frequency:

  • Rt = 470 kΩ
  • Rb = 20 kΩ
  • Ra = 20 kΩ || 470 kΩ = 19 kΩ
  • C= 45p
  • Freq = (20/19) / (4  *45e-12 * 470e3) = 12442.45365186

I was expecting a 12 kHz frequency but it only reaches 9.7 kHz

image

PWM Generator

The next stage is going to generate a PWM (Pulse Width Modulation) signal using a comparator and the triangular wave generated by the oscillator from the previous stage.

The circuit needs two PWM generators, one for the motor on the right and one for the motor on the left.

image

For the comparator I used an LM393P Dual Voltage Comparator

I haven't adjusted the frequency to the values I'm interested in yet. At these frequencies the chosen comparator did not give good results,

image

According to this article https://learn.adafruit.com/improve-brushed-dc-motor-performance/choosing-decay-mode-and-pwm-frequency the motor winding works best when the applied voltage is relatively stable, as it takes time for its magnetic field to build up to the necessary strength. At higher PWM frequencies, the motor driver board pulses change too quickly to provide enough power to spin the motor.
Slow decay mode is typically selected for controlling brushed DC motors due to its ability to dynamically apply braking. It also helps linearize the relationship between duty cycle and motor speed.
Most small brushed DC motors will work fine with a PWM frequency of 50Hz to 100Hz and a slow decay mode.

I tried with a frequency of about 56 Hz changing the capacitor to 10 nF. At this frequency the LM393 works better.

Theoretical calculation of the frequency:

  • Rt = 470 kΩ
  • Rb = 20 kΩ
  • Ra = 20 kΩ || 470 kΩ = 19 kΩ
  • C= 10 nF
  • Freq = (20/19) / (4  *10e-9 * 470e3) = 55.9910414334 Hz

image

The stimulus variation changes the duration of the pulse from 0% to 100% positive duty cycle.

image

The circuit with a single comparator, later add the second comparator for the other wheel.

image

Controlling two PWM Outputs for the left and right motors

image

Circuit with the two comparators. The two function generators of the Analog Discovery 2 are generating two phase-shifted sinusoidal signals to see the behavior of the PWM generator.

image

Stimulus simulation for left and right motors

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

At this point, instead of going for a walk I decided to test if all the Op-Amps I had received worked and compare their response.

But something didn't work.

I didn't check well and I don't know for what stupid reason I tried them all and broke them all. They are now shorted from Vdd to Vss.

Next steps

  • First I'll go for a walk.
  • Next I'll try to continue the project with other Op-Amps but this time slowly.

Project Blogs

  • Op-Amp Line Follower - Blog 1 First Steps
  • Op-Amp Line Follower - Blog 2 Following the research
  • Op-Amp Line Follower - Blog 3 The Line Follower
  • Sign in to reply

Top Comments

  • jc2048
    jc2048 over 3 years ago +1
    I was curious about your LM393 problem, so I thought I'd give it a try it. The blue waveform is the voltage on the timing capacitor of a 555 circuit (this is all running on a 5V supply). The comparator…
  • javagoza
    javagoza over 3 years ago in reply to jc2048

    Thank you very much for reviewing the blog and taking your time to do those tests. You are amazing.

    You were absolutely right with the pull up. There was no pull up resistor. I still have a lot to learn.

    I have added a 10k pull-up resistor on the output.

    Trying with a triangle wave at 200Hz, 4v peak to peak, comparing it to 2V

    image

    In more detail:

    image

    image

    I have also tried your suggestion to add some hysteresis 

    image

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

    I was curious about your LM393 problem, so I thought I'd give it a try it.

    image

    The blue waveform is the voltage on the timing capacitor of a 555 circuit (this is all running on a 5V supply). The comparator is comparing it to half the supply. These are the comparator output transitions in more detail.

    image

    image

    The pull-up resistor on the output was 10k.

    That's all fast enough to 'slice' a waveform up to about a megahertz, or so.

    I did think it might need a small amount of external hysteresis added, but it's quite clean without. For a noisier waveform you may need to add some.

    So I'm not sure why your circuit is misbehaving. If the pull-up became disconnected it might behave strangely, depending what else you had it connected to.

    • Cancel
    • Vote Up +1 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 © 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