element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • More
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • More
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • More
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • More
  • 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
Internet of Things
  • Technologies
  • More
Internet of Things
Blog Building your own IoT oscilloscope for less than $25
  • Blog
  • Forum
  • Documents
  • Events
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Internet of Things requires membership for participation - click to join
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: vish
  • Date Created: 23 Jun 2014 6:45 PM Date Created
  • Views 414 views
  • Likes 5 likes
  • Comments 9 comments
  • texas-instruments
  • internet_of_things
  • energia
  • oscilloscope
  • iot
  • arduino
  • launchpad
Related
Recommended

Building your own IoT oscilloscope for less than $25

vish
vish
23 Jun 2014

Hello element14,

 

In this post, I'm introducing a oscilloscope-like instrument that you can build for less than $25. And the good thing is it can work over internet.

 

Introduction

Are you a electronics tinkerer? How many times you wished for an oscilloscope?? What about building one? And how awesome it would be if it can work over internet??

 

It all started when I saw a roadtest, here in element14. It was the road test for Tiva C Series TM4C1294 Connected LaunchPad. It is a evaluation kit from Texas Instruments. After going through the hardware specs, I was just blown away. For just $20, they are offering :

  • TM4C1294NCPDT MCU: 120MHz 32-bit ARM Cortex-M4 CPU with floating point
  • 1MB Flash
  • 256KB SRAM
  • 6KB EEPROM
  • Integrated 10/100 Ethernet MAC+PHY
  • data protection hardware
  • 8x 32-bit timers
  • dual 12-bit 2MSPS ADCs
  • motion control PWMs
  • USB H/D/O
  • Ten I2C modules with four transmission speeds including high-speed mode
  • On-board, in-circuit debug interface (ICDI)

 

Blown away, right? The feature is just a snapshot of what it actually have in its chest. You could go to Tiva C Series Connected LaunchPad (EK-TM4C1294XL) for more information. I posted my idea of an oscilloscope for the roadtest application and managed to get one. Thanks element14.

And when it came, it surprised me more. My laptop if running on Ubuntu. When I searched through the forums, I found that although Code Composer Studio( TI's own IDE ) works with linux, it won't support debugging feature. I went through the list of the boards fully supported, partially supported etc., but was not able to figure out exactly whether it will work or not. And when it came, it worked. Thanks TI, you people are now adding both development and debugging support to linux too. I'm so sure now linux fans will be happy.

And then I found 'Energia' - arduino like IDE for launchpads. With that, development is super easy. My previous experience with arduino helped me a lot. In Energia, you can simply put your arduino code( of course modified for GPIO pins ) and it will compile for launchpads. Energia has been around for a while and recently they added supported for TM4C1294 Connected launchpad. So I decided to use Energia rather than CCS. It actually accelerated my development time a lot.

 

A walk through

Before taking you to the hardware stuff, I would like to take you to a tour about how it works. As you might have figured out from the title of this post, it works over ethernet. You can connect it to your PC's ethernet port or to your home router. I'm using it by connecting it to my wifi router, so I have coded it to acquire IP via DHCP. But if you want to use it along with your PC, you would probably have to code it for acquiring static IP. If you used arduino with ethernet sheild, you know how to do it. If you are not, it's not a big deal. You could easily google it out. And make sure that a working internet connection is available in your PC( I'll explain why later ).After connecting it to router/PC, once it acquires IP, it will print the IP address via serial port. If you connect it to your PC via USB, you can see that in your serial monitor as shown below.

Once you know the IP address, you can use this to connect to launchpad. Please note that only firefox is supported currently. Once you access launchpad with firefox, you will be presented with a page like this.

This page will allow you to control the onboard leds. I added this page as a point to test whether the connections are working fine. You can click on the 'Oscilloscope' link and it will take you to oscilloscope page, like this :

It has the ability to acquire from 5 analog channels and can control upto 10 GPIO pins. Feature to trigger some digital ouputs via the web interface which I think will be very useful when you want to trigger some external devices while taking the trace.

You can start measuring by clicking 'START' button. A sample trace is shown below.

You will be able to see traces from three channels in the figure above. After you stop the trace, you can zoom to particular part of the trace and can see individual channel values by hovering mouse over it as shown in figure below.

 

 

 

How it works

What happens behind the scene is really simple. Evey time you clicks a button( LED/GPIO pins ), an ajax request is framed and send to the launchpad. It will respond by a corresponding status message, which upon reception, we will update to the UI. And when you click the start button, a function is called every 100ms which will query the launchpad for analog values. Once launchpad receives this query, it will sample the first five anaog channels( A0 ~ A4 ) and reports back the values. We will update this to the graph. For graph plotting purpose, I'm using an open source charting library, dygraphs. (http://dygraphs.com/). It is an incredibly simple charting library and has lots of features. But as I said, the update happens every 100ms, the sampling is also done at only 100ms intervals, which I know is not an appreciable rate. I'm working to a prototype which can handle upto 200kHz, but it very buggy and not much efficient for now. More on this below. I have also created a demo video to explain the functionality.

 

 

Testing the idea

For testing the idea I came up with a simple test circuit as shown in figure :

I have added two pots to analog pins A0 and A1 each and a LED to ground via switch at A3. Also at D0, an LED is added to ground via a 4K7. So when I change the pots, a sinusoidal waveform will be caught on screen. And when I press the switch, A3 will be pulled down via an LED, plotting a square wave. When you press 'D0' button in webpage, it will trigger LED2 in the circuit. Here is a few snaps of my test setup

This a video of my test :

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

 

Same video in youtube( in the case you are getting any error accessing this video :

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

 

The code

You can find the code and related HTML files from here : https://github.com/v-i-s-h/scope_lite


 

Future plans

As I said, the 100ms sampling interval is not something very appreciable for serious measurements. So I'm currently working on a prototype which can handle  200+kHz. The proto type is now at a very buggy stage( almost hangs the browser after a few minutes of acquisition ) As I found it difficult to manage such a large bug prone software in Energia, I'm now porting it to CCS project where it will be easy to debug. With 2MSPS ADCs sitting inside the launchpad, sampling at higher rate is not a problem. It involves triggering ADCs via timed interrupts and optimize the ethernet packet for more efficient communications.The idea is to add more payload to each ethernet packet and send which will be unpacked at client end and plotted properly. Hope I can soon post the modified version.


A request to arduino community

As I mentioned above,  the energia is 100% code compatible with arduino. Can any one of you with a ethernet shield can compile it with arduino and post the results. I'm just curious to know how this performs in arduino.

 

Thanks a lot for reading

 

Happy tinkering,

vish

Anonymous

Top Comments

  • peteroakes
    peteroakes over 8 years ago +2

    I will try it for you, I have just posted a similar concept in an Arduino tutorial and it is all still set-up so it should not take much to try

    Fast Track to Arduino Programming - Lesson 4b, How to use…

  • tekmeister
    tekmeister over 8 years ago +2

    Great job. This really does demonstrate the capabilities of the TI MCU nicely. Thanks for sharing.

  • vish
    vish over 8 years ago in reply to shabaz

    Sorry shabaz if I confused you. I'm taking about the proto which is in development to handle higher frequencies. The one I mentioned in the above post works perfect for me.

     

    The idea of taking fixed number of samples sounds good. But I'm worried about the part of the waveform that goes unsampled. I think we will have to optimize the number of samples for RAM-network latency parameters so that we will lose only minimum part of waveform unsampled.

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • shabaz
    shabaz over 8 years ago in reply to vish

    I looked at the code, but I couldn't really see anything that could point at memory usage rising, it could be the Ethernet library as you say. And the html page that is being served may be copied into RAM since it will be put into a buffer for the Ethernet module - no idea : ( Still that shouldn't cause the memory to keep increasing over time, so it could be a bug in a library.

    Regarding speed, in order to get speed up, I kept space for 500 samples (enough for 1 screen in my case), and after they had been captured, the processor would not capture any more until they had been retrieved by the browser request. Then in the browser I avoided a timer, and just made it request as fast as possibly (i.e. immediately after rendering the previous set of data), so the refresh period will vary depending on the client PC speed and browser for my case.

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • vish
    vish over 8 years ago in reply to shabaz

    Hi Shabaz,

    Thanks for your comments.

    Though I'm not sure, I think the I'm filling launchpad's ethernet receiver buffer too quickly. Also all the samples which have been taken from the time of last query is stored in RAM till the next query which increases( I should use explodes ) with time to time, which I think is eating up my RAM every now and then if any of the new query is arriving a bit late. Now I'm working to check whether any quick compression algo will work, in that case I can reduce the RAM usage.

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • shabaz
    shabaz over 8 years ago

    Hi Vish,

     

    This is nice! Great project. And TI are doing great things always, that's a pretty powerful processor. 

    I love your UI too. It's a coincidence, I recently worked on an oscilloscope project too, published it just yesterday on element 14. I used websockets, but even without that, you seem to be fine in terms of update rate. If the browser is hanging, it might not be your code, it may be the library.. do you think it is due to the charting library? (It is not one I am familiar with).

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
<
Element14

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 © 2022 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

  • Facebook
  • Twitter
  • linkedin
  • YouTube