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
555 Timer Madness
  • Challenges & Projects
  • Project14
  • 555 Timer Madness
  • More
  • Cancel
555 Timer Madness
Blog Let's Try to Create a Simple ADC based on a 555 timer!
  • Blog
  • Forum
  • Documents
  • Events
  • Leaderboard
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join 555 Timer Madness to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: strb
  • Date Created: 23 Sep 2022 7:52 PM Date Created
  • Views 69595 views
  • Likes 11 likes
  • Comments 2 comments
  • 555 timer
  • 555timermadnessch
Related
Recommended

Let's Try to Create a Simple ADC based on a 555 timer!

strb
strb
23 Sep 2022

The idea to write a blog for this challenge has come into my mind almost as a coincidence. I was checking the datasheet for an attiny microcontroller, and I noticed that the particular model I have hasn't any ADC embedded into it. That's not a problem for many applications, but if you need to read an analog voltage, even from the simplest resistor divider or a potentiometer, that becomes a problem.

Well, when I found this challenge the idea almost came by itself: let's try to create a simple ADC using a 555!

The concept is pretty straightforward and based on "integrating ADCs": the input signal is processed by a voltage controlled current source and then integrated by a capacitor. The time the voltage across this capacitor takes to reach a certain threshold represent the analog value, and the resulting square wave it's our output signal. This signal can then be processed by a counter or directly by a microcontroller to convert time (which every uC is pretty good at measuring it) into the "digital twin" of our initial analog signal.

imageADC block diagram

From this block diagram I came up with the following scheme. Resistor values maybe are a little weird, but that's what I have on hand at the moment Slight smile Absolute value is not that critical, it's much more important ratio between resistors.

imageADC scheme

As opamp I've chosen the LM358, due to it's ability to work close to gnd. Current source has been designed to have minimum voltage drop across resistor R5 and a transconductance more or less of 250uS. A rapid simulation with LTspice confirmed that.

imageLTspice simulation: with 1V input it estimates an output current of 230uA

The 555 timer is set up as astable, with a capacitor value (C1) to obtain a conversion frequency in the kHz range (not too fast because I'm using a standard bjt based 555 chip). R6 is present to limit discharge rate and ensure that C6 voltage is mantained between 1/3Vcc and 2/3Vcc. This is very important because it allow the LM358 to operate (mostly) without saturating.

Now to the fun part: prototyping and testing!

Due to circuit simplicity, breadboard is the prototype technique of choice this time. In the final set up 5V rail to supply the circuit will be handled by and arduino uno board, which is also used to acquire data and display it over serial monitor, already converted into volt. Input signal is created with a bench power supply.

image
First circuit test: checking capacitor voltage waveform. During first test the current generator is supplied with 7.5V to avoid any possible saturation

Let's explore together this circuit:

imageC1 voltage (blue) and opamp output voltage (yellow). The difference (purple) between those two  signals is the voltage drop across R6 (around 120mV). No saturation visible here

imageIncreasing input voltage to 5V lead to a slight saturation of the LM358 (supply set to 5V), visible on the yellow trace

imageThis is the output signal: a square wave with a frequency proportional to input voltage. Reading it is pretty simple with any kind of microcontroller

As finalt touch, I decided to plot the curve that represent the ADC reading compared to input voltage from my power supply. The whole circuit is being powered up with 5V and the input voltage swing is between 0V and 5V.
 Having the frequency to voltage conversion automatically done by the microcontroller played a big role to simplify this measure Slight smile.

imageThis is the final result! The solid line represent measured data, while the dotted line represent the fit. Equation of this rect is shown on top of it.

I have to say that it's much better than I would ever expected! We can see a bit of noise in measurement and a small drop in the upper portion of the graph (probably due to opamp saturation) but overall I'm extremely happy with the final result.

For sure there is room for improvement, but still I'm stoked about how well this concept works. Also, it has been a bit of time since I've built a circuit on a breadboard and I had a bunch of fun doing it again! For me this small project has been a great win, both for circuit performance as much as for the fun of building it.

I hope you enjoied it too Slight smile 
Bye!

  • Sign in to reply
Parents
  • DAB
    DAB over 2 years ago

    Very interesting post.

    For an experimental circuit, you achieved very good linearity.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • strb
    strb over 2 years ago in reply to DAB

    Hi DAB,
    Thank you!

    I completely agree with you, the linearity is pretty good for a prototype. I think the "trick" is keeping opamps output always in the same voltage range: in this case the voltage variation due to input signal (the difference between blue and yellow trace in images above) is less than 0.5V for the entire 0V to 5V input swing.

    One thing that is not obvious from this graph is output noise: here I simply take one reading every second and basically discarding all other readings.
    On the upper portion of the graph, when frequency is higher, noise and jitter start to be noticeable so a better approach would have been taking multiple consecutive readings and taking the average as final value.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • strb
    strb over 2 years ago in reply to DAB

    Hi DAB,
    Thank you!

    I completely agree with you, the linearity is pretty good for a prototype. I think the "trick" is keeping opamps output always in the same voltage range: in this case the voltage variation due to input signal (the difference between blue and yellow trace in images above) is less than 0.5V for the entire 0V to 5V input swing.

    One thing that is not obvious from this graph is output noise: here I simply take one reading every second and basically discarding all other readings.
    On the upper portion of the graph, when frequency is higher, noise and jitter start to be noticeable so a better approach would have been taking multiple consecutive readings and taking the average as final value.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
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