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
  • 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
Embedded and Microcontrollers
  • Technologies
  • More
Embedded and Microcontrollers
Embedded Forum reproducing sine wave accurately
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Embedded and Microcontrollers to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Suggested Answer
  • Replies 6 replies
  • Answers 4 answers
  • Subscribers 469 subscribers
  • Views 985 views
  • Users 0 members are here
  • cortex-m0 mcu
Related

reproducing sine wave accurately

gnsh
gnsh over 6 years ago

I am using a cortex M0 microcontroller. i am giving a  sine wave input of 1 Hz. this input signal is given to a 12 bit adc and this converted data is given to uart This uart data Im plotting through a serial plotter. image

 

 

how to get a smooth sine wave? from the uart data.

Attachments:
SINEWAVE.c.zip
  • Sign in to reply
  • Cancel

Top Replies

  • michaelkellett
    michaelkellett over 6 years ago +4 suggested
    So many things could be wrong that it's hard to know where to start suggesting. What does you code do, and where did it come from. How fast are you sampling, how is the data being presented to the UART…
  • Jan Cumps
    Jan Cumps over 5 years ago in reply to michaelkellett +3 suggested
    I found this function in the attachment: int32_t adc_sine(void) { int32_t u32Result; unsigned char buffer[20]; ADC_Open(ADC, ADC_INPUT_MODE_SINGLE_END, ADC_OPERATION_MODE_CONTINUOUS, ADC_CH_1_MASK);…
  • shabaz
    shabaz over 5 years ago in reply to Jan Cumps +3
    He's using sprintf with %d, so not sending the number, but an ASCII representation. I don't know what his serial plotter is doing, but maybe it is mashing up the characters into nonsense words or long…
Parents
  • aspork42
    0 aspork42 over 5 years ago

    Hello,

     

    Could you open a serial monitor program (i.e. PuTTY) and show us what it is sending? I'm willing to bet that the issue is on the side of SerialPlot. I had never heard of SerialPlot, but it is super useful! Now I don't have to use Processing to create simple charts.

     

    I was able to recreate some semblance of your setup with a 1hz sine wave. I'm using an arduino MKR 1010 with its onboard ADC. I think the trick was in how i sent data out the port, then how I asked SerialPlot to display it. I was able to get a cleanish sine wave recreated; although it didn't work until I had gone into the "Data Format" tab and chose ASCII.

    image

     

    Any incorrect setting would result in a garbage plot that didn't reflect the actual data.

     

    This is what my data look like on the serial port:

    image

     

    Sampling at 10Hz:

    image

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
Reply
  • aspork42
    0 aspork42 over 5 years ago

    Hello,

     

    Could you open a serial monitor program (i.e. PuTTY) and show us what it is sending? I'm willing to bet that the issue is on the side of SerialPlot. I had never heard of SerialPlot, but it is super useful! Now I don't have to use Processing to create simple charts.

     

    I was able to recreate some semblance of your setup with a 1hz sine wave. I'm using an arduino MKR 1010 with its onboard ADC. I think the trick was in how i sent data out the port, then how I asked SerialPlot to display it. I was able to get a cleanish sine wave recreated; although it didn't work until I had gone into the "Data Format" tab and chose ASCII.

    image

     

    Any incorrect setting would result in a garbage plot that didn't reflect the actual data.

     

    This is what my data look like on the serial port:

    image

     

    Sampling at 10Hz:

    image

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • 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